联系官方销售客服

1835022288

028-61286886

分享经验 版主:论坛审计组
微信分享代码,把代码复制到手机端内容页就可以
类型:迅睿CMS 更新时间:2022-02-15 13:31:29

迅睿微信分享代码,把下面的代码复制到手机端内容页就可以!

{php \Phpcmf\Service::C()->init_file('weixin');$signPackage = \Phpcmf\Service::L('jssdk', 'weixin')->GetSignPackage();}
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>           
<script type="text/javascript">
  wx.config({
      appId: '<?php echo $signPackage["appId"];?>',
    timestamp: <?php echo $signPackage["timestamp"];?>,
    nonceStr: '<?php echo $signPackage["nonceStr"];?>',
    signature: '<?php echo $signPackage["signature"];?>',
      jsApiList: [
        'checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'hideMenuItems',
        'showMenuItems',
        'hideAllNonBaseMenuItem',
        'showAllNonBaseMenuItem',
        'translateVoice',
        'startRecord',
        'stopRecord',
        'onRecordEnd',
        'playVoice',
        'pauseVoice',
        'stopVoice',
        'uploadVoice',
        'downloadVoice',
        'chooseImage',
        'previewImage',
        'uploadImage',
        'downloadImage',
        'getNetworkType',
        'openLocation',
        'getLocation',
        'hideOptionMenu',
        'showOptionMenu',
        'closeWindow',
        'scanQRCode',
        'chooseWXPay',
        'openProductSpecificView',
        'addCard',
        'chooseCard',
        'openCard'
      ]
  });
  wx.ready(function () {
  
    var shareData = {
    title: '{$title}',
    desc: '{$description}',
    link: "{dr_now_url()}",
    imgUrl: '{dr_get_file($thumb)}',
  };
  //分享朋友
  wx.onMenuShareAppMessage({
       title: shareData.title,
      desc: shareData.desc,
      link: shareData.link,
      imgUrl:shareData.imgUrl,
      trigger: function (res) {
      },
      success: function (res) {
        window.location.href =adurl;
      },
      cancel: function (res) {
      },
      fail: function (res) {
        alert(JSON.stringify(res));
      }
    });
 //朋友圈
  wx.onMenuShareTimeline({
      title: shareData.title+"---"+shareData.desc,
      link: shareData.link,
      imgUrl:shareData.imgUrl,
      trigger: function (res) {
      },
      success: function (res) {
          window.location.href =adurl;
      },
      cancel: function (res) {
      },
      fail: function (res) {
        alert(JSON.stringify(res));
      }
    });   
    
  });
</script>


回帖
  • 欧尔麦特
    #1楼    欧尔麦特
    2019-12-07 16:16:28
    Chrome 0
    jsApiList
    可以少写几个
  • 125762285
    #2楼    125762285
    2019-12-09 12:19:56
    Chrome 0
    收藏了
  • 唉呦喂
    #3楼    唉呦喂
    2019-12-10 16:33:43
    Chrome 0
    必须收藏
  • 帝云网络-Deep
    #4楼    帝云网络-Deep
    2020-03-08 00:06:12
    Chrome 0
    赞,感谢分享,正需要
  • 良良
    #5楼    良良
    2022-02-15 13:31:29
    Edge 0
    这个怎么用呢?放到哪里?