Authored by 郭成尧

'wx-share'

@@ -6,83 +6,83 @@ @@ -6,83 +6,83 @@
6 6
7 var $ = require('jquery'); 7 var $ = require('jquery');
8 8
9 -// module.exports = function() {  
10 -// var _weChatInterface = '/life/getSignPackage';  
11 -// $.getJSON(_weChatInterface + '?pageurl=' +  
12 -// encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function (json) {  
13 -// var _appId, _timestamp, _nonceStr, _signature; 9 +module.exports = function() {
  10 + var _weChatInterface = '/life/getSignPackage';
  11 + $.getJSON(_weChatInterface + '?pageurl=' +
  12 + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function (json) {
  13 + var _appId, _timestamp, _nonceStr, _signature;
14 14
15 -// if (!wx) {  
16 -// return;  
17 -// } 15 + if (!wx) {
  16 + return;
  17 + }
18 18
19 -// if (json !== undefined && json !== '') {  
20 -// _appId = json.appId.toString();  
21 -// _timestamp = json.timestamp;  
22 -// _nonceStr = json.nonceStr.toString();  
23 -// _signature = json.signature.toString(); 19 + if (json !== undefined && json !== '') {
  20 + _appId = json.appId.toString();
  21 + _timestamp = json.timestamp;
  22 + _nonceStr = json.nonceStr.toString();
  23 + _signature = json.signature.toString();
24 24
25 -// wx.config({  
26 -// debug: false,  
27 -// appId: _appId,  
28 -// timestamp: _timestamp,  
29 -// nonceStr: _nonceStr,  
30 -// signature: _signature,  
31 -// jsApiList: [  
32 -// 'checkJsApi',  
33 -// 'onMenuShareTimeline',  
34 -// 'onMenuShareAppMessage',  
35 -// 'onMenuShareQQ',  
36 -// 'onMenuShareWeibo',  
37 -// 'hideMenuItems',  
38 -// 'showMenuItems',  
39 -// 'hideAllNonBaseMenuItem',  
40 -// 'showAllNonBaseMenuItem',  
41 -// 'translateVoice',  
42 -// 'startRecord',  
43 -// 'stopRecord',  
44 -// 'onRecordEnd',  
45 -// 'playVoice',  
46 -// 'pauseVoice',  
47 -// 'stopVoice',  
48 -// 'uploadVoice',  
49 -// 'downloadVoice',  
50 -// 'chooseImage',  
51 -// 'previewImage',  
52 -// 'uploadImage',  
53 -// 'downloadImage',  
54 -// 'getNetworkType',  
55 -// 'openLocation',  
56 -// 'getLocation',  
57 -// 'hideOptionMenu',  
58 -// 'showOptionMenu',  
59 -// 'closeWindow',  
60 -// 'scanQRCode',  
61 -// 'chooseWXPay',  
62 -// 'openProductSpecificView',  
63 -// 'addCard',  
64 -// 'chooseCard',  
65 -// 'openCard'  
66 -// ]  
67 -// });  
68 -// }  
69 -// }); 25 + wx.config({
  26 + debug: false,
  27 + appId: _appId,
  28 + timestamp: _timestamp,
  29 + nonceStr: _nonceStr,
  30 + signature: _signature,
  31 + jsApiList: [
  32 + 'checkJsApi',
  33 + 'onMenuShareTimeline',
  34 + 'onMenuShareAppMessage',
  35 + 'onMenuShareQQ',
  36 + 'onMenuShareWeibo',
  37 + 'hideMenuItems',
  38 + 'showMenuItems',
  39 + 'hideAllNonBaseMenuItem',
  40 + 'showAllNonBaseMenuItem',
  41 + 'translateVoice',
  42 + 'startRecord',
  43 + 'stopRecord',
  44 + 'onRecordEnd',
  45 + 'playVoice',
  46 + 'pauseVoice',
  47 + 'stopVoice',
  48 + 'uploadVoice',
  49 + 'downloadVoice',
  50 + 'chooseImage',
  51 + 'previewImage',
  52 + 'uploadImage',
  53 + 'downloadImage',
  54 + 'getNetworkType',
  55 + 'openLocation',
  56 + 'getLocation',
  57 + 'hideOptionMenu',
  58 + 'showOptionMenu',
  59 + 'closeWindow',
  60 + 'scanQRCode',
  61 + 'chooseWXPay',
  62 + 'openProductSpecificView',
  63 + 'addCard',
  64 + 'chooseCard',
  65 + 'openCard'
  66 + ]
  67 + });
  68 + }
  69 + });
70 70
71 -// wx.ready(function () {  
72 -// var shareTitle = $('#shareTitle').val();  
73 -// var shareImg = $('#shareImg').val();  
74 -// var shareDesc = $('#shareDesc').val();  
75 -// var shareLink = $('#shareLink').val();  
76 -// var shareData = {  
77 -// title: shareTitle,  
78 -// desc: shareDesc,  
79 -// imgUrl: shareImg,  
80 -// link: shareLink  
81 -// }; 71 + wx.ready(function () {
  72 + var shareTitle = $('#shareTitle').val();
  73 + var shareImg = $('#shareImg').val();
  74 + var shareDesc = $('#shareDesc').val();
  75 + var shareLink = $('#shareLink').val();
  76 + var shareData = {
  77 + title: shareTitle,
  78 + desc: shareDesc,
  79 + imgUrl: shareImg,
  80 + link: shareLink
  81 + };
82 82
83 -// wx.onMenuShareAppMessage(shareData);  
84 -// wx.onMenuShareTimeline(shareData);  
85 -// wx.onMenuShareQQ(shareData);  
86 -// wx.onMenuShareWeibo(shareData);  
87 -// });  
88 -// }; 83 + wx.onMenuShareAppMessage(shareData);
  84 + wx.onMenuShareTimeline(shareData);
  85 + wx.onMenuShareQQ(shareData);
  86 + wx.onMenuShareWeibo(shareData);
  87 + });
  88 +};