articleList.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. use common\components\stringUtil;
  3. ?>
  4. <div class="lay-til J_MenuBody" id="J_SubHead">
  5. <div class="header-con">
  6. <i class="arrow-back" onclick="history.go(-1)"><img src="/images/pay_03.png" alt=""></i>
  7. <h1><a href="/article/article-list?id=<?= $category->id ?>&account=<?= $_GET['account'] ?>" style="color:#595757;text-decoration:none;" ><?= $category->categoryName ?></a></h1>
  8. </div>
  9. </div>
  10. <div class="lay-body" id="J_MainBody">
  11. <div class="reg">
  12. <div class="reg-form">
  13. <?php if(!empty($relation)){ foreach($relation as $key => $val){ ?>
  14. <div style="color:#595757; position: relative; relative;width: 90%;height: 35px;margin: 10px 5%;background-color: #fff;border-bottom: 1px solid #dddee0;">
  15. <a style="color:#5A5A5A;text-decoration:none;" href="/article/article-detail?cId=<?= $_GET['id'] ?>&id=<?= $val->xhArticle->id ?>&account=<?= $_GET['account'] ?>"><?= $val->xhArticle->title ?> [<?php echo date("m-d H:i",strtotime($val->xhArticle->createTime)) ?>]</a>
  16. </div>
  17. <?php } } ?>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. <script>
  23. <?php if($this->context->isWeixin){?>
  24. //微信分享
  25. var shareTitle = '<?= $this->context->webTitle ?>';
  26. var descContent = '<?php echo stringUtil::subStringUtf8($category->description,26,'…'); ?>';
  27. var lineLink = '<?= Yii::$app->request->hostInfo ?>/article/article-list?id=<?= $category->id ?>&account=<?= $_GET['account'] ?>&weixinShare=yes';
  28. var imgUrl = '<?php if(!empty($category->cover)){ echo Yii::$app->params['imgUrl'].$category->cover; }else{ echo "/images/weixinSharelogo.jpg"; }?>';
  29. wx.config({
  30. //debug:true,
  31. appId: '<?= $this->context->signPackage['appId'] ?>',
  32. timestamp: <?= $this->context->signPackage['timestamp'] ?>,
  33. nonceStr: '<?= $this->context->signPackage['nonceStr'] ?>',
  34. signature: '<?= $this->context->signPackage['signature'] ?>',
  35. jsApiList: [
  36. 'checkJsApi',
  37. 'onMenuShareTimeline',
  38. 'onMenuShareAppMessage',
  39. 'onMenuShareQQ',
  40. 'onMenuShareWeibo',
  41. ]
  42. });
  43. wx.ready(function () {
  44. var shareData = {
  45. title: shareTitle,
  46. link: lineLink,
  47. imgUrl: imgUrl,
  48. desc:descContent,
  49. };
  50. wx.onMenuShareAppMessage(shareData);
  51. wx.onMenuShareTimeline({
  52. title: shareTitle,
  53. link: lineLink,
  54. imgUrl: imgUrl,
  55. desc:descContent,
  56. success: function () {
  57. //分享成功后的操作
  58. },
  59. cancel: function () {
  60. // 用户取消分享后执行的回调函数
  61. }
  62. });
  63. wx.onMenuShareQQ({
  64. title: shareTitle,
  65. link: lineLink,
  66. imgUrl: imgUrl,
  67. desc:descContent,
  68. success: function () {
  69. //分享成功后的操作
  70. },
  71. cancel: function () {
  72. // 用户取消分享后执行的回调函数
  73. }
  74. });
  75. wx.onMenuShareWeibo(shareData);
  76. });
  77. <?php } ?>
  78. </script>