Authored by ccbikai

完善分享

@@ -12,8 +12,11 @@ const logger = global.yoho.logger; @@ -12,8 +12,11 @@ const logger = global.yoho.logger;
12 const cache = global.yoho.cache; 12 const cache = global.yoho.cache;
13 13
14 // 此处请勿使用有货公众号的 appId, 此处使用的是 女生志 的appId 14 // 此处请勿使用有货公众号的 appId, 此处使用的是 女生志 的appId
15 -const appId = 'wxb52ec6a352f0b090';  
16 -const secret = '9fe6bedb0b7f30986a168c7fc44f34c0'; 15 +// const appId = 'wxb52ec6a352f0b090';
  16 +// const secret = '9fe6bedb0b7f30986a168c7fc44f34c0';
  17 +
  18 +const appId = 'wx7b3dd56c9e9dd409';
  19 +const secret = '5d1b51755bbb4f24b9d2dc34d97acdff';
17 20
18 const sha1 = (str) => { 21 const sha1 = (str) => {
19 const generator = crypto.createHash('sha1'); 22 const generator = crypto.createHash('sha1');
@@ -51,11 +51,11 @@ @@ -51,11 +51,11 @@
51 </a> 51 </a>
52 </div> 52 </div>
53 <div class="group-list"> 53 <div class="group-list">
54 - <a class="list-item no-intercept" href="/home/favorite"> 54 + <a class="list-item" href="/home/favorite">
55 收藏的商品 55 收藏的商品
56 <span class="num">{{product_favorite_total}} <span class="icon icon-right"></span></span> 56 <span class="num">{{product_favorite_total}} <span class="icon icon-right"></span></span>
57 </a> 57 </a>
58 - <a class="list-item no-intercept" href="/home/favorite?tab=brand"> 58 + <a class="list-item" href="/home/favorite?tab=brand">
59 收藏的品牌 59 收藏的品牌
60 <span class="num">{{brand_favorite_total}} <span class="icon icon-right"></span></span> 60 <span class="num">{{brand_favorite_total}} <span class="icon icon-right"></span></span>
61 </a> 61 </a>
@@ -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 };
@@ -276,6 +276,17 @@ const yoho = { @@ -276,6 +276,17 @@ const yoho = {
276 } 276 }
277 }, 277 },
278 278
  279 + goPageView(args, success, fail) {
  280 + if (this.isApp) {
  281 + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
  282 + method: 'go.pageView',
  283 + arguments: args
  284 + });
  285 + } else {
  286 + tip(tipInfo);
  287 + }
  288 + },
  289 +
279 /** 290 /**
280 * 原生调用 JS 方法 291 * 原生调用 JS 方法
281 * @param name 方法名 292 * @param name 方法名