Authored by ccbikai

完善分享

... ... @@ -12,8 +12,11 @@ const logger = global.yoho.logger;
const cache = global.yoho.cache;
// 此处请勿使用有货公众号的 appId, 此处使用的是 女生志 的appId
const appId = 'wxb52ec6a352f0b090';
const secret = '9fe6bedb0b7f30986a168c7fc44f34c0';
// const appId = 'wxb52ec6a352f0b090';
// const secret = '9fe6bedb0b7f30986a168c7fc44f34c0';
const appId = 'wx7b3dd56c9e9dd409';
const secret = '5d1b51755bbb4f24b9d2dc34d97acdff';
const sha1 = (str) => {
const generator = crypto.createHash('sha1');
... ...
... ... @@ -51,11 +51,11 @@
</a>
</div>
<div class="group-list">
<a class="list-item no-intercept" href="/home/favorite">
<a class="list-item" href="/home/favorite">
收藏的商品
<span class="num">{{product_favorite_total}} <span class="icon icon-right"></span></span>
</a>
<a class="list-item no-intercept" href="/home/favorite?tab=brand">
<a class="list-item" href="/home/favorite?tab=brand">
收藏的品牌
<span class="num">{{brand_favorite_total}} <span class="icon icon-right"></span></span>
</a>
... ...
... ... @@ -6,6 +6,20 @@
*/
const $ = require('yoho-jquery');
const jsApiList = [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
];
let shareData = {
title: document.title,
link: location.href,
desc: '我在BLK发现了一个不错的品牌,赶快来看看吧!',
imgUrl: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg'
};
if (/MicroMessenger/i.test(navigator.userAgent)) {
$.ajax({
... ... @@ -26,42 +40,14 @@ if (/MicroMessenger/i.test(navigator.userAgent)) {
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'
]
jsApiList: jsApiList
});
window.wx.ready(function() {
window.wx.onMenuShareAppMessage(shareData);
window.wx.onMenuShareTimeline(shareData);
window.wx.onMenuShareQQ(shareData);
window.wx.onMenuShareWeibo(shareData);
window.wx.onMenuShareQZone(shareData);
});
}
}
... ... @@ -69,13 +55,14 @@ if (/MicroMessenger/i.test(navigator.userAgent)) {
}
});
}
module.exports = (shareData) => {
module.exports = (data) => {
shareData = data;
if (window.wx) {
window.wx.ready(function() {
window.wx.onMenuShareAppMessage(shareData);
window.wx.onMenuShareTimeline(shareData);
window.wx.onMenuShareQQ(shareData);
window.wx.onMenuShareWeibo(shareData);
});
window.wx.onMenuShareAppMessage(shareData);
window.wx.onMenuShareTimeline(shareData);
window.wx.onMenuShareQQ(shareData);
window.wx.onMenuShareWeibo(shareData);
window.wx.onMenuShareQZone(shareData);
}
};
... ...
... ... @@ -276,6 +276,17 @@ const yoho = {
}
},
goPageView(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.pageView',
arguments: args
});
} else {
tip(tipInfo);
}
},
/**
* 原生调用 JS 方法
* @param name 方法名
... ...