...
|
...
|
@@ -220,8 +220,8 @@ export default { |
|
|
}, 400);
|
|
|
|
|
|
this.scrollEvent(params);
|
|
|
|
|
|
setTimeout(() => {
|
|
|
this._ttTimer && clearTimeout(this._ttTimer);
|
|
|
this._ttTimer = setTimeout(() => {
|
|
|
this.scrollEvent(params);
|
|
|
}, throttleTime)
|
|
|
},
|
...
|
...
|
@@ -251,62 +251,62 @@ export default { |
|
|
this.page = 1;
|
|
|
this.headerAnimateStep = 0;
|
|
|
|
|
|
this.fetchTopicSimpleInfo({topicId: this.topicId}).then(res => {
|
|
|
let {topicName, topicImageUrl, topicDesc} = get(res, 'data') || {};
|
|
|
|
|
|
if (this.share) {
|
|
|
document && (document.title = topicName);
|
|
|
}
|
|
|
|
|
|
if (this.share && !this.$yoho.isApp && res.code === 200) {
|
|
|
Share.setShareInfo({
|
|
|
title: topicName,
|
|
|
imgUrl: topicImageUrl,
|
|
|
desc: '我在有货的社区发现一个热门话题。' + topicDesc,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (!topicImageUrl) {
|
|
|
this.headerAnimateStep = 100;
|
|
|
}
|
|
|
if (this.$refs.scroll) {
|
|
|
this.$refs.scroll.$el.scrollTop = 0;
|
|
|
this.$refs.scroll.clear();
|
|
|
}
|
|
|
|
|
|
return this.load().then(() => {
|
|
|
this.$nextTick(() => {
|
|
|
if (this.$refs.scroll) {
|
|
|
this.$refs.scroll.$el.scrollTop = 0;
|
|
|
this.$refs.scroll.init();
|
|
|
}
|
|
|
this.$refs.scroll && this.$refs.scroll.init();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
load() {
|
|
|
this.listPreCache = {};
|
|
|
|
|
|
return Promise.all([
|
|
|
this.fetchTopicSimpleInfo({topicId: this.topicId}).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.setPageShareInfo(get(res, 'data', {}));
|
|
|
}
|
|
|
|
|
|
if (!get(res, 'data.topicImageUrl')) {
|
|
|
this.headerAnimateStep = 100;
|
|
|
}
|
|
|
}),
|
|
|
this.fetchTopicRelatedArticles({topicId: this.topicId, page: 1}).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.listPreCache[`${this.topicId}-1`] = res;
|
|
|
}
|
|
|
})
|
|
|
]);
|
|
|
},
|
|
|
async onFetch() {
|
|
|
const topicId = parseInt(this.topicId, 10);
|
|
|
|
|
|
if (!topicId) {
|
|
|
return;
|
|
|
if (!topicId || this.fetching) {
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
this.fetching = true;
|
|
|
this.page = this.page || 1;
|
|
|
|
|
|
const result = await this.fetchTopicRelatedArticles({
|
|
|
topicId,
|
|
|
page: this.page
|
|
|
});
|
|
|
let result = get(this.listPreCache, `${this.topicId}-${this.page}`);
|
|
|
|
|
|
if (!result) {
|
|
|
result = await this.fetchTopicRelatedArticles({
|
|
|
topicId,
|
|
|
page: this.page
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.fetching = false;
|
|
|
let list = [];
|
|
|
|
|
|
if (result.code === 200) {
|
|
|
this.page++;
|
|
|
list = get(result, 'data.detailList', []);
|
|
|
|
|
|
if (list.length) {
|
|
|
this.$sdk.getUser().then(user => {
|
|
|
if (user && user.uid) {
|
|
|
this.fetchArticleProductFavs({
|
|
|
articles: list
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
this.$createToast && this.$createToast({
|
|
|
txt: result.message || '服务器开小差了',
|
...
|
...
|
@@ -316,7 +316,7 @@ export default { |
|
|
}
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
if (this.topicInfo.viewModel === 1 && this.page <= 2) {
|
|
|
if (get(this.topicInfo, 'viewModel') === 1 && this.page <= 2) {
|
|
|
list = [{topicHead: true}, ...list];
|
|
|
}
|
|
|
|
...
|
...
|
@@ -348,6 +348,19 @@ export default { |
|
|
this.$refs.actionSheet.show(params);
|
|
|
});
|
|
|
},
|
|
|
setPageShareInfo({topicName, topicImageUrl, topicDesc}) {
|
|
|
if (this.share) {
|
|
|
document && (document.title = topicName || '话题');
|
|
|
|
|
|
if (!this.$yoho.isApp) {
|
|
|
Share.setShareInfo({
|
|
|
title: topicName,
|
|
|
imgUrl: topicImageUrl,
|
|
|
desc: '我在有货的社区发现一个热门话题。' + topicDesc,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
startReportShow() {
|
|
|
let preview = null;
|
|
|
let name = this.$yoho.isiOS ? 'iFP_ArticleList' : 'aFP_ArticleList';
|
...
|
...
|
|