Authored by whb

测试微信

@@ -82,42 +82,45 @@ @@ -82,42 +82,45 @@
82 <?php $this->_endblock();?> 82 <?php $this->_endblock();?>
83 <?php $this->_block('js');?> 83 <?php $this->_block('js');?>
84 <script type="text/javascript"> 84 <script type="text/javascript">
  85 + var shareData = {
  86 + title: $('.detail-title').find('.title'),
  87 + desc: '',
  88 + imgUrl: $(".share").attr("cover-url"),
  89 + link: $(".share").attr("data-link")
  90 + };
  91 + var wechatAppId = $(".share").attr("wechatAppId"),
  92 + wechatTimestamp = $(".share").attr("wechatTimestamp"),
  93 + wechatNonceStr = $(".share").attr("wechatNonceStr"),
  94 + wechatSignature = $(".share").attr("wechatSignature");
  95 + wx.config({
  96 + debug: true,
  97 + appId: wechatAppId,
  98 + timestamp: wechatTimestamp,
  99 + nonceStr: wechatNonceStr,
  100 + signature: wechatSignature,
  101 + jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ',
  102 + 'onMenuShareWeibo','hideMenuItems','showMenuItems','hideAllNonBaseMenuItem','showAllNonBaseMenuItem',
  103 + 'translateVoice','startRecord','stopRecord','onRecordEnd','playVoice','pauseVoice','stopVoice',
  104 + 'uploadVoice','downloadVoice','chooseImage','previewImage','uploadImage','downloadImage',
  105 + 'getNetworkType','openLocation','getLocation','hideOptionMenu','showOptionMenu','closeWindow',
  106 + 'scanQRCode','chooseWXPay','openProductSpecificView','addCard','chooseCard','openCard'
  107 + ]
  108 + });
  109 + wx.ready(function () {
  110 + // 2.1 “分享给朋友”
  111 + wx.onMenuShareAppMessage(shareData);
  112 + // 2.2 “分享到朋友圈”
  113 + wx.onMenuShareTimeline(shareData);
  114 + // 2.3 “分享到QQ”
  115 + wx.onMenuShareQQ(shareData);
  116 + // 2.4 “分享到微博”
  117 + wx.onMenuShareWeibo(shareData);
  118 + });
  119 + wx.error(function (res) {
  120 + alert(res.errMsg);
  121 + });
85 seajs.use(['jquery', 'mobile'],function($, mobile) { 122 seajs.use(['jquery', 'mobile'],function($, mobile) {
86 mobile.detail(); 123 mobile.detail();
87 - var shareData = {  
88 - title: $('.detail-title').find('.title'),  
89 - desc: '',  
90 - imgUrl: $(".share").attr("cover-url"),  
91 - link: $(".share").attr("data-link")  
92 - };  
93 - var wechatAppId = $(".share").attr("wechatAppId"),  
94 - wechatTimestamp = $(".share").attr("wechatTimestamp"),  
95 - wechatNonceStr = $(".share").attr("wechatNonceStr"),  
96 - wechatSignature = $(".share").attr("wechatSignature");  
97 - wx.config({  
98 - debug: false,  
99 - appId: wechatAppId,  
100 - timestamp: wechatTimestamp,  
101 - nonceStr: wechatNonceStr,  
102 - signature: wechatSignature,  
103 - jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ',  
104 - 'onMenuShareWeibo','hideMenuItems','showMenuItems','hideAllNonBaseMenuItem','showAllNonBaseMenuItem',  
105 - 'translateVoice','startRecord','stopRecord','onRecordEnd','playVoice','pauseVoice','stopVoice',  
106 - 'uploadVoice','downloadVoice','chooseImage','previewImage','uploadImage','downloadImage',  
107 - 'getNetworkType','openLocation','getLocation','hideOptionMenu','showOptionMenu','closeWindow',  
108 - 'scanQRCode','chooseWXPay','openProductSpecificView','addCard','chooseCard','openCard'  
109 - ]  
110 - });  
111 - wx.ready(function () {  
112 - // 2.1 “分享给朋友”  
113 - wx.onMenuShareAppMessage(shareData);  
114 - // 2.2 “分享到朋友圈”  
115 - wx.onMenuShareTimeline(shareData);  
116 - // 2.3 “分享到QQ”  
117 - wx.onMenuShareQQ(shareData);  
118 - // 2.4 “分享到微博”  
119 - wx.onMenuShareWeibo(shareData);  
120 - });  
121 }); 124 });
122 </script> 125 </script>
123 <?php $this->_endblock();?> 126 <?php $this->_endblock();?>