Authored by yyq

fix blockindex

... ... @@ -29,7 +29,7 @@
<TopicBanner v-if="data.data.topicHead" ref="topicHead" :data="topicInfo" @on-follow="onFollowTopic"></TopicBanner>
<ArticleItem
v-else
:type="type"
type="topic"
:index="data.index"
:data="data.data"
:share="share"
... ... @@ -79,18 +79,6 @@ const throttleTime = 40;
export default {
name: 'TopicPage',
props: {
share: Boolean,
type: String,
thumbs: {
type: Array,
default() {
return [];
}
},
posId: Number,
userUid: Number
},
created() {
this.topicName = this.$route.params.topicName;
},
... ... @@ -120,29 +108,20 @@ export default {
},
data() {
return {
share: false,
thumbs: [],
posId: YAS.scene.topicList,
topicId: 0,
topicName: '',
headerAnimateStep: 0,
articleId: 0,
articleIndex: -1,
showCommentAction: false,
showCommentActioning: false,
showArticleDetailAction: false,
showMoreAction: true,
inx: 0,
scrollTop: 0,
showHeader: false,
currentId: 0,
currentAuthor: {
authorUid: 0,
authorName: '',
authorHeadIco: '',
hasAttention: 'N',
isAuthor: 'N',
isShare: false,
authorType: 1
}
currentId: 0
};
},
computed: {
... ... @@ -157,21 +136,6 @@ export default {
methods: {
...mapActions(['fetchTopicSimpleInfo', 'fetchTopicRelatedArticles', 'fetchArticleProductFavs']),
...mapMutations(['ASYNC_ARTICLE_COMMENT', 'CHANGE_AUTHOR_FOLLOW', 'CHANGE_TOPIC_FOLLOW']),
toUserPage() {
if (this.share) {
return this.$links.toDownloadApp();
}
this.$router.push({
name: 'author',
params: {
type: this.currentAuthor.authorType,
id: this.currentAuthor.authorUid
}
});
this.reportClickAvatar();
},
onShowComment({articleId, index}) {
this.articleId = articleId;
this.articleIndex = index;
... ... @@ -302,9 +266,6 @@ export default {
}
},
onFollow(data, follow) {
if (data.authorUid === this.currentAuthor.authorUid) {
this.currentAuthor.hasAttention = follow ? 'Y' : 'N';
}
this.CHANGE_AUTHOR_FOLLOW({authorUid: data.authorUid, follow, type: this.type});
},
onFollowTopic(follow) {
... ... @@ -321,17 +282,6 @@ export default {
this.$refs.actionSheet.show(params);
});
},
reportClickAvatar() {
this.$store.dispatch('reportYas', {
params: {
appop: YAS.eventName.avatar,
param: {
AUTH_ID: this.currentAuthor.authorUid,
POS_ID: this.posId
}
}
});
},
startReportShow() {
let preview = null;
let name = this.$yoho.isiOS ? 'iFP_ArticleList' : 'aFP_ArticleList';
... ...
... ... @@ -259,17 +259,27 @@ export default {
return result;
},
async fetchTopicRelatedArticles({ commit, state }, {topicId, page, lastedTime}) {
if (state.fetchTopicArticles) {
if (state.fetchArticleListByTopic) {
return Promise.resolve({});
}
commit(Types.FETCH_TOPIC_ARTICLE_REQUEST);
const result = await this.$api.post('/api/grass/topicRelatedArticles', {topicId, page, lastedTime});
commit(Types.FETCH_ARTICLE_TOPIC_REQUEST, { page });
const result = await this.$api.post('/api/grass/topicRelatedArticles', {
topicId,
page,
lastedTime: state.articleLastedTimeByTopic || void 0
});
if (result.code === 200) {
commit(Types.FETCH_TOPIC_ARTICLE_SUCCESS);
if (result && result.code === 200) {
if (!result.data.detailList) {
result.data.detailList = [];
}
commit(Types.FETCH_ARTICLE_TOPIC_SUCCESS, {
data: result.data.detailList,
page
});
} else {
commit(Types.FETCH_TOPIC_ARTICLE_FAILD);
commit(Types.FETCH_ARTICLE_TOPIC_FAILD);
}
return result;
... ...
... ... @@ -142,6 +142,7 @@ export default {
});
},
[Types.CHANGE_ARTICLE_LIST_SLIDE](state, {articleId, index, type}) {
console.log(articleId, index, type);
state[articlefield(type)].forEach(article => {
if (article.articleId === articleId) {
article.blockIndex = index;
... ... @@ -226,13 +227,4 @@ export default {
state.topicInfo.hasAttention = follow;
}
},
[Types.FETCH_TOPIC_ARTICLE_REQUEST](state, topicId) {
state.fetchTopicArticles = true;
},
[Types.FETCH_TOPIC_ARTICLE_SUCCESS](state) {
state.fetchTopicArticles = false;
},
[Types.FETCH_TOPIC_ARTICLE_FAILD](state) {
state.fetchTopicArticles = false;
},
};
... ...
... ... @@ -33,9 +33,3 @@ export const FETCH_TOPIC_INFO_REQUEST = 'FETCH_TOPIC_INFO_REQUEST';
export const FETCH_TOPIC_INFO_FAILD = 'FETCH_TOPIC_INFO_FAILD';
export const FETCH_TOPIC_INFO_SUCCESS = 'FETCH_TOPIC_INFO_SUCCESS';
export const CHANGE_TOPIC_FOLLOW = 'CHANGE_TOPIC_FOLLOW';
export const FETCH_TOPIC_ARTICLE_REQUEST = 'FETCH_TOPIC_ARTICLE_REQUEST';
export const FETCH_TOPIC_ARTICLE_FAILD = 'FETCH_TOPIC_ARTICLE_FAILD';
export const FETCH_TOPIC_ARTICLE_SUCCESS = 'FETCH_TOPIC_ARTICLE_SUCCESS';
... ...