...
|
...
|
@@ -7,67 +7,68 @@ |
|
|
|
|
|
const $ = require('yoho-jquery');
|
|
|
|
|
|
$.ajax({
|
|
|
url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js',
|
|
|
dataType: 'script',
|
|
|
cache: true,
|
|
|
success: function() {
|
|
|
$.ajax({
|
|
|
url: '/api/wechat/share/token',
|
|
|
data: {
|
|
|
url: location.href
|
|
|
},
|
|
|
success: function(res) {
|
|
|
if (window.wx) {
|
|
|
window.wx.config({
|
|
|
debug: false,
|
|
|
appId: res.appId,
|
|
|
timestamp: res.timestamp,
|
|
|
nonceStr: res.nonceStr,
|
|
|
signature: res.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'
|
|
|
]
|
|
|
});
|
|
|
if (/MicroMessenger/i.test(navigator.userAgent)) {
|
|
|
$.ajax({
|
|
|
url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js',
|
|
|
dataType: 'script',
|
|
|
cache: true,
|
|
|
success: function() {
|
|
|
$.ajax({
|
|
|
url: '/api/wechat/share/token',
|
|
|
data: {
|
|
|
url: location.href
|
|
|
},
|
|
|
success: function(res) {
|
|
|
if (window.wx) {
|
|
|
window.wx.config({
|
|
|
debug: false,
|
|
|
appId: res.appId,
|
|
|
timestamp: res.timestamp,
|
|
|
nonceStr: res.nonceStr,
|
|
|
signature: res.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'
|
|
|
]
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
module.exports = (shareData) => {
|
|
|
if (window.wx) {
|
|
|
window.wx.ready(function() {
|
...
|
...
|
|