| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- use common\components\stringUtil;
- ?>
- <div class="lay-til J_MenuBody" id="J_SubHead">
- <div class="header-con">
- <i class="arrow-back" onclick="history.go(-1)"><img src="/images/pay_03.png" alt=""></i>
- <h1><a href="javascript:;" style="color:#595757;text-decoration:none;" ><?= $article['title'] ?></a></h1>
- </div>
- </div>
- <div class="lay-body" id="J_MainBody" style="margin-top:10px;">
- <div class="hzg-content">
- <?= $article['content'] ?>
- </div>
- </div>
- <script>
- <?php if($this->context->isWeixin){?>
- //微信分享
- var shareTitle = '<?php echo $article['title'] ?>';
- var descContent = '<?php echo stringUtil::subStringUtf8($article['summary'],26,'…'); ?>';
- var lineLink = '<?= Yii::$app->request->hostInfo ?>/article/article-detail?id=<?= $article['id'] ?>&account=<?= $_GET['account'] ?>&weixinShare=yes';
- var imgUrl = '<?php if(!empty($article['cover'])){ echo Yii::$app->params['imgUrl'].$article['cover']; }else{ echo "/images/weixinSharelogo.jpg"; }?>';
- wx.config({
- //debug:true,
- appId: '<?= $this->context->signPackage['appId'] ?>',
- timestamp: <?= $this->context->signPackage['timestamp'] ?>,
- nonceStr: '<?= $this->context->signPackage['nonceStr'] ?>',
- signature: '<?= $this->context->signPackage['signature'] ?>',
- jsApiList: [
- 'checkJsApi',
- 'onMenuShareTimeline',
- 'onMenuShareAppMessage',
- 'onMenuShareQQ',
- 'onMenuShareWeibo',
- ]
- });
- wx.ready(function () {
- var shareData = {
- title: shareTitle,
- link: lineLink,
- imgUrl: imgUrl,
- desc:descContent,
- };
- wx.onMenuShareAppMessage(shareData);
- wx.onMenuShareTimeline({
- title: shareTitle,
- link: lineLink,
- imgUrl: imgUrl,
- desc:descContent,
- success: function () {
- //分享成功后的操作
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- wx.onMenuShareQQ({
- title: shareTitle,
- link: lineLink,
- imgUrl: imgUrl,
- desc:descContent,
- success: function () {
- //分享成功后的操作
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- wx.onMenuShareWeibo(shareData);
- });
- <?php } ?>
- </script>
|