Authored by yyq

fix blockindex

@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 <TopicBanner v-if="data.data.topicHead" ref="topicHead" :data="topicInfo" @on-follow="onFollowTopic"></TopicBanner> 29 <TopicBanner v-if="data.data.topicHead" ref="topicHead" :data="topicInfo" @on-follow="onFollowTopic"></TopicBanner>
30 <ArticleItem 30 <ArticleItem
31 v-else 31 v-else
32 - :type="type" 32 + type="topic"
33 :index="data.index" 33 :index="data.index"
34 :data="data.data" 34 :data="data.data"
35 :share="share" 35 :share="share"
@@ -79,18 +79,6 @@ const throttleTime = 40; @@ -79,18 +79,6 @@ const throttleTime = 40;
79 79
80 export default { 80 export default {
81 name: 'TopicPage', 81 name: 'TopicPage',
82 - props: {  
83 - share: Boolean,  
84 - type: String,  
85 - thumbs: {  
86 - type: Array,  
87 - default() {  
88 - return [];  
89 - }  
90 - },  
91 - posId: Number,  
92 - userUid: Number  
93 - },  
94 created() { 82 created() {
95 this.topicName = this.$route.params.topicName; 83 this.topicName = this.$route.params.topicName;
96 }, 84 },
@@ -120,29 +108,20 @@ export default { @@ -120,29 +108,20 @@ export default {
120 }, 108 },
121 data() { 109 data() {
122 return { 110 return {
  111 + share: false,
  112 + thumbs: [],
  113 + posId: YAS.scene.topicList,
123 topicId: 0, 114 topicId: 0,
124 topicName: '', 115 topicName: '',
125 headerAnimateStep: 0, 116 headerAnimateStep: 0,
126 -  
127 articleId: 0, 117 articleId: 0,
128 articleIndex: -1, 118 articleIndex: -1,
129 showCommentAction: false, 119 showCommentAction: false,
130 showCommentActioning: false, 120 showCommentActioning: false,
131 showArticleDetailAction: false, 121 showArticleDetailAction: false,
132 showMoreAction: true, 122 showMoreAction: true,
133 - inx: 0,  
134 scrollTop: 0, 123 scrollTop: 0,
135 - showHeader: false,  
136 - currentId: 0,  
137 - currentAuthor: {  
138 - authorUid: 0,  
139 - authorName: '',  
140 - authorHeadIco: '',  
141 - hasAttention: 'N',  
142 - isAuthor: 'N',  
143 - isShare: false,  
144 - authorType: 1  
145 - } 124 + currentId: 0
146 }; 125 };
147 }, 126 },
148 computed: { 127 computed: {
@@ -157,21 +136,6 @@ export default { @@ -157,21 +136,6 @@ export default {
157 methods: { 136 methods: {
158 ...mapActions(['fetchTopicSimpleInfo', 'fetchTopicRelatedArticles', 'fetchArticleProductFavs']), 137 ...mapActions(['fetchTopicSimpleInfo', 'fetchTopicRelatedArticles', 'fetchArticleProductFavs']),
159 ...mapMutations(['ASYNC_ARTICLE_COMMENT', 'CHANGE_AUTHOR_FOLLOW', 'CHANGE_TOPIC_FOLLOW']), 138 ...mapMutations(['ASYNC_ARTICLE_COMMENT', 'CHANGE_AUTHOR_FOLLOW', 'CHANGE_TOPIC_FOLLOW']),
160 - toUserPage() {  
161 - if (this.share) {  
162 - return this.$links.toDownloadApp();  
163 - }  
164 -  
165 - this.$router.push({  
166 - name: 'author',  
167 - params: {  
168 - type: this.currentAuthor.authorType,  
169 - id: this.currentAuthor.authorUid  
170 - }  
171 - });  
172 -  
173 - this.reportClickAvatar();  
174 - },  
175 onShowComment({articleId, index}) { 139 onShowComment({articleId, index}) {
176 this.articleId = articleId; 140 this.articleId = articleId;
177 this.articleIndex = index; 141 this.articleIndex = index;
@@ -302,9 +266,6 @@ export default { @@ -302,9 +266,6 @@ export default {
302 } 266 }
303 }, 267 },
304 onFollow(data, follow) { 268 onFollow(data, follow) {
305 - if (data.authorUid === this.currentAuthor.authorUid) {  
306 - this.currentAuthor.hasAttention = follow ? 'Y' : 'N';  
307 - }  
308 this.CHANGE_AUTHOR_FOLLOW({authorUid: data.authorUid, follow, type: this.type}); 269 this.CHANGE_AUTHOR_FOLLOW({authorUid: data.authorUid, follow, type: this.type});
309 }, 270 },
310 onFollowTopic(follow) { 271 onFollowTopic(follow) {
@@ -321,17 +282,6 @@ export default { @@ -321,17 +282,6 @@ export default {
321 this.$refs.actionSheet.show(params); 282 this.$refs.actionSheet.show(params);
322 }); 283 });
323 }, 284 },
324 - reportClickAvatar() {  
325 - this.$store.dispatch('reportYas', {  
326 - params: {  
327 - appop: YAS.eventName.avatar,  
328 - param: {  
329 - AUTH_ID: this.currentAuthor.authorUid,  
330 - POS_ID: this.posId  
331 - }  
332 - }  
333 - });  
334 - },  
335 startReportShow() { 285 startReportShow() {
336 let preview = null; 286 let preview = null;
337 let name = this.$yoho.isiOS ? 'iFP_ArticleList' : 'aFP_ArticleList'; 287 let name = this.$yoho.isiOS ? 'iFP_ArticleList' : 'aFP_ArticleList';
@@ -259,17 +259,27 @@ export default { @@ -259,17 +259,27 @@ export default {
259 return result; 259 return result;
260 }, 260 },
261 async fetchTopicRelatedArticles({ commit, state }, {topicId, page, lastedTime}) { 261 async fetchTopicRelatedArticles({ commit, state }, {topicId, page, lastedTime}) {
262 - if (state.fetchTopicArticles) { 262 + if (state.fetchArticleListByTopic) {
263 return Promise.resolve({}); 263 return Promise.resolve({});
264 } 264 }
265 265
266 - commit(Types.FETCH_TOPIC_ARTICLE_REQUEST);  
267 - const result = await this.$api.post('/api/grass/topicRelatedArticles', {topicId, page, lastedTime}); 266 + commit(Types.FETCH_ARTICLE_TOPIC_REQUEST, { page });
  267 + const result = await this.$api.post('/api/grass/topicRelatedArticles', {
  268 + topicId,
  269 + page,
  270 + lastedTime: state.articleLastedTimeByTopic || void 0
  271 + });
268 272
269 - if (result.code === 200) {  
270 - commit(Types.FETCH_TOPIC_ARTICLE_SUCCESS); 273 + if (result && result.code === 200) {
  274 + if (!result.data.detailList) {
  275 + result.data.detailList = [];
  276 + }
  277 + commit(Types.FETCH_ARTICLE_TOPIC_SUCCESS, {
  278 + data: result.data.detailList,
  279 + page
  280 + });
271 } else { 281 } else {
272 - commit(Types.FETCH_TOPIC_ARTICLE_FAILD); 282 + commit(Types.FETCH_ARTICLE_TOPIC_FAILD);
273 } 283 }
274 284
275 return result; 285 return result;
@@ -142,6 +142,7 @@ export default { @@ -142,6 +142,7 @@ export default {
142 }); 142 });
143 }, 143 },
144 [Types.CHANGE_ARTICLE_LIST_SLIDE](state, {articleId, index, type}) { 144 [Types.CHANGE_ARTICLE_LIST_SLIDE](state, {articleId, index, type}) {
  145 + console.log(articleId, index, type);
145 state[articlefield(type)].forEach(article => { 146 state[articlefield(type)].forEach(article => {
146 if (article.articleId === articleId) { 147 if (article.articleId === articleId) {
147 article.blockIndex = index; 148 article.blockIndex = index;
@@ -226,13 +227,4 @@ export default { @@ -226,13 +227,4 @@ export default {
226 state.topicInfo.hasAttention = follow; 227 state.topicInfo.hasAttention = follow;
227 } 228 }
228 }, 229 },
229 - [Types.FETCH_TOPIC_ARTICLE_REQUEST](state, topicId) {  
230 - state.fetchTopicArticles = true;  
231 - },  
232 - [Types.FETCH_TOPIC_ARTICLE_SUCCESS](state) {  
233 - state.fetchTopicArticles = false;  
234 - },  
235 - [Types.FETCH_TOPIC_ARTICLE_FAILD](state) {  
236 - state.fetchTopicArticles = false;  
237 - },  
238 }; 230 };
@@ -33,9 +33,3 @@ export const FETCH_TOPIC_INFO_REQUEST = 'FETCH_TOPIC_INFO_REQUEST'; @@ -33,9 +33,3 @@ export const FETCH_TOPIC_INFO_REQUEST = 'FETCH_TOPIC_INFO_REQUEST';
33 export const FETCH_TOPIC_INFO_FAILD = 'FETCH_TOPIC_INFO_FAILD'; 33 export const FETCH_TOPIC_INFO_FAILD = 'FETCH_TOPIC_INFO_FAILD';
34 export const FETCH_TOPIC_INFO_SUCCESS = 'FETCH_TOPIC_INFO_SUCCESS'; 34 export const FETCH_TOPIC_INFO_SUCCESS = 'FETCH_TOPIC_INFO_SUCCESS';
35 export const CHANGE_TOPIC_FOLLOW = 'CHANGE_TOPIC_FOLLOW'; 35 export const CHANGE_TOPIC_FOLLOW = 'CHANGE_TOPIC_FOLLOW';
36 -  
37 -export const FETCH_TOPIC_ARTICLE_REQUEST = 'FETCH_TOPIC_ARTICLE_REQUEST';  
38 -export const FETCH_TOPIC_ARTICLE_FAILD = 'FETCH_TOPIC_ARTICLE_FAILD';  
39 -export const FETCH_TOPIC_ARTICLE_SUCCESS = 'FETCH_TOPIC_ARTICLE_SUCCESS';  
40 -  
41 -