Authored by yyq

author page

... ... @@ -69,6 +69,8 @@
<script>
import {assign, get} from 'lodash';
import Share from 'plugins/share';
import {getAuthorShareData} from 'utils/share-handler';
import {Scroll, Loading} from 'cube-ui';
import FavTabBlock from './fav-tab-block';
import WaterFall from './scroll-reveal';
... ... @@ -306,6 +308,7 @@ export default {
data.showAvatar = true;
this.authorBaseData = data;
this.isOwner = +data.userType === 1;
this.setShareInfo({...data, ...this.authorInfo});
});
this[this._apiNamePre + 'AritcleNum'](this.authorInfo).then(res => {
... ... @@ -421,6 +424,13 @@ export default {
});
}
},
setShareInfo(author) {
if (this.$yoho.isApp || !author) {
return;
}
Share.setShareInfo(getAuthorShareData(author));
},
toDownloadPage() {
!this.publishUrl && this.$links.toDownloadApp();
},
... ...
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);
}
... ...
... ... @@ -50,7 +50,18 @@ const getTopicShareData = (topic) => {
};
};
const getAuthorShareData = (author) => {
return {
title: `@${author.nickName} YO!社区,一起来玩潮流!`,
imgUrl: handleProtocol(get(author, 'headIco', '').split('?')[0] || DEFAULT_SHARE_IMAGE),
link: handleProtocol(`${location.origin}/grass/author/${author.authorType}/${author.authorUid}`),
desc: author.signature || '',
hideType: ['7', '8', '9']
};
};
export {
getDetailShareData,
getTopicShareData
getTopicShareData,
getAuthorShareData
};
... ...