|
|
let shareData = {
|
|
|
title: '有货社区',
|
|
|
title: '来YO!社区,一起玩潮流!',
|
|
|
link: '',
|
|
|
desc: '',
|
|
|
desc: 'Yoho!buy有货App',
|
|
|
imgUrl: 'http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png'
|
|
|
};
|
|
|
|
...
|
...
|
@@ -14,12 +14,13 @@ let jsApiList = [ |
|
|
'onMenuShareQZone'
|
|
|
];
|
|
|
|
|
|
const setWxShareData = function() {
|
|
|
window.wx.onMenuShareTimeline(shareData);
|
|
|
window.wx.onMenuShareAppMessage(shareData);
|
|
|
window.wx.onMenuShareQQ(shareData);
|
|
|
window.wx.onMenuShareQZone(shareData);
|
|
|
window.wx.onMenuShareWeibo(shareData);
|
|
|
const setWxShareData = function(shareInfo) {
|
|
|
shareInfo = shareInfo || shareData;
|
|
|
window.wx.onMenuShareTimeline(shareInfo);
|
|
|
window.wx.onMenuShareAppMessage(shareInfo);
|
|
|
window.wx.onMenuShareQQ(shareInfo);
|
|
|
window.wx.onMenuShareQZone(shareInfo);
|
|
|
window.wx.onMenuShareWeibo(shareInfo);
|
|
|
};
|
|
|
|
|
|
function loadScript(url, success) {
|
...
|
...
|
@@ -115,20 +116,19 @@ export default { |
|
|
init,
|
|
|
setShareInfo(data) {
|
|
|
setTimeout(() => {
|
|
|
shareData.title = data.title || document.title || '有货社区';
|
|
|
shareData.desc = data.desc || document.description || '';
|
|
|
shareData.link = data.link || location.href;
|
|
|
shareData.imgUrl = data.imgUrl || shareData.imgUrl;
|
|
|
let shareInfo = Object.assign({}, shareData, data || {});
|
|
|
|
|
|
shareInfo.link = shareInfo.link || location.href;
|
|
|
|
|
|
if (window.wx) {
|
|
|
setWxShareData();
|
|
|
setWxShareData(shareInfo);
|
|
|
}
|
|
|
|
|
|
window.setShareInfo && window.setShareInfo({
|
|
|
title: shareData.title,
|
|
|
summary: shareData.desc,
|
|
|
pic: shareData.imgUrl,
|
|
|
url: shareData.link
|
|
|
title: shareInfo.title,
|
|
|
summary: shareInfo.desc,
|
|
|
pic: shareInfo.imgUrl,
|
|
|
url: shareInfo.link
|
|
|
});
|
|
|
}, 100);
|
|
|
}
|
...
|
...
|
|