|
@@ -6,6 +6,20 @@ |
|
@@ -6,6 +6,20 @@ |
6
|
*/
|
6
|
*/
|
7
|
|
7
|
|
8
|
const $ = require('yoho-jquery');
|
8
|
const $ = require('yoho-jquery');
|
|
|
9
|
+const jsApiList = [
|
|
|
10
|
+ 'checkJsApi',
|
|
|
11
|
+ 'onMenuShareTimeline',
|
|
|
12
|
+ 'onMenuShareAppMessage',
|
|
|
13
|
+ 'onMenuShareQQ',
|
|
|
14
|
+ 'onMenuShareWeibo',
|
|
|
15
|
+ 'onMenuShareQZone'
|
|
|
16
|
+];
|
|
|
17
|
+let shareData = {
|
|
|
18
|
+ title: document.title,
|
|
|
19
|
+ link: location.href,
|
|
|
20
|
+ desc: '我在BLK发现了一个不错的品牌,赶快来看看吧!',
|
|
|
21
|
+ imgUrl: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg'
|
|
|
22
|
+};
|
9
|
|
23
|
|
10
|
if (/MicroMessenger/i.test(navigator.userAgent)) {
|
24
|
if (/MicroMessenger/i.test(navigator.userAgent)) {
|
11
|
$.ajax({
|
25
|
$.ajax({
|
|
@@ -26,42 +40,14 @@ if (/MicroMessenger/i.test(navigator.userAgent)) { |
|
@@ -26,42 +40,14 @@ if (/MicroMessenger/i.test(navigator.userAgent)) { |
26
|
timestamp: res.timestamp,
|
40
|
timestamp: res.timestamp,
|
27
|
nonceStr: res.nonceStr,
|
41
|
nonceStr: res.nonceStr,
|
28
|
signature: res.signature,
|
42
|
signature: res.signature,
|
29
|
- jsApiList: [
|
|
|
30
|
- 'checkJsApi',
|
|
|
31
|
- 'onMenuShareTimeline',
|
|
|
32
|
- 'onMenuShareAppMessage',
|
|
|
33
|
- 'onMenuShareQQ',
|
|
|
34
|
- 'onMenuShareWeibo',
|
|
|
35
|
- 'hideMenuItems',
|
|
|
36
|
- 'showMenuItems',
|
|
|
37
|
- 'hideAllNonBaseMenuItem',
|
|
|
38
|
- 'showAllNonBaseMenuItem',
|
|
|
39
|
- 'translateVoice',
|
|
|
40
|
- 'startRecord',
|
|
|
41
|
- 'stopRecord',
|
|
|
42
|
- 'onRecordEnd',
|
|
|
43
|
- 'playVoice',
|
|
|
44
|
- 'pauseVoice',
|
|
|
45
|
- 'stopVoice',
|
|
|
46
|
- 'uploadVoice',
|
|
|
47
|
- 'downloadVoice',
|
|
|
48
|
- 'chooseImage',
|
|
|
49
|
- 'previewImage',
|
|
|
50
|
- 'uploadImage',
|
|
|
51
|
- 'downloadImage',
|
|
|
52
|
- 'getNetworkType',
|
|
|
53
|
- 'openLocation',
|
|
|
54
|
- 'getLocation',
|
|
|
55
|
- 'hideOptionMenu',
|
|
|
56
|
- 'showOptionMenu',
|
|
|
57
|
- 'closeWindow',
|
|
|
58
|
- 'scanQRCode',
|
|
|
59
|
- 'chooseWXPay',
|
|
|
60
|
- 'openProductSpecificView',
|
|
|
61
|
- 'addCard',
|
|
|
62
|
- 'chooseCard',
|
|
|
63
|
- 'openCard'
|
|
|
64
|
- ]
|
43
|
+ jsApiList: jsApiList
|
|
|
44
|
+ });
|
|
|
45
|
+ window.wx.ready(function() {
|
|
|
46
|
+ window.wx.onMenuShareAppMessage(shareData);
|
|
|
47
|
+ window.wx.onMenuShareTimeline(shareData);
|
|
|
48
|
+ window.wx.onMenuShareQQ(shareData);
|
|
|
49
|
+ window.wx.onMenuShareWeibo(shareData);
|
|
|
50
|
+ window.wx.onMenuShareQZone(shareData);
|
65
|
});
|
51
|
});
|
66
|
}
|
52
|
}
|
67
|
}
|
53
|
}
|
|
@@ -69,13 +55,14 @@ if (/MicroMessenger/i.test(navigator.userAgent)) { |
|
@@ -69,13 +55,14 @@ if (/MicroMessenger/i.test(navigator.userAgent)) { |
69
|
}
|
55
|
}
|
70
|
});
|
56
|
});
|
71
|
}
|
57
|
}
|
72
|
-module.exports = (shareData) => {
|
58
|
+module.exports = (data) => {
|
|
|
59
|
+ shareData = data;
|
|
|
60
|
+
|
73
|
if (window.wx) {
|
61
|
if (window.wx) {
|
74
|
- window.wx.ready(function() {
|
|
|
75
|
- window.wx.onMenuShareAppMessage(shareData);
|
|
|
76
|
- window.wx.onMenuShareTimeline(shareData);
|
|
|
77
|
- window.wx.onMenuShareQQ(shareData);
|
|
|
78
|
- window.wx.onMenuShareWeibo(shareData);
|
|
|
79
|
- });
|
62
|
+ window.wx.onMenuShareAppMessage(shareData);
|
|
|
63
|
+ window.wx.onMenuShareTimeline(shareData);
|
|
|
64
|
+ window.wx.onMenuShareQQ(shareData);
|
|
|
65
|
+ window.wx.onMenuShareWeibo(shareData);
|
|
|
66
|
+ window.wx.onMenuShareQZone(shareData);
|
80
|
}
|
67
|
}
|
81
|
}; |
68
|
}; |