...
|
...
|
@@ -75,7 +75,6 @@ export default { |
|
|
inx = index;
|
|
|
article.lazy = false;
|
|
|
} else if (inx && index - inx < 3) {
|
|
|
console.log(index, inx)
|
|
|
article.lazy = false;
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -87,6 +86,26 @@ export default { |
|
|
}
|
|
|
});
|
|
|
},
|
|
|
[Types.CHANGE_ARTICLE_TOPIC_SLIDE](state, {articleId, index}) {
|
|
|
state.articleListByTopic.forEach(article => {
|
|
|
if (article.articleId === articleId) {
|
|
|
article.blockIndex = index;
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
[Types.CHANGE_ARTICLE_TOPIC_SCROLL](state, {articleId}) {
|
|
|
let inx;
|
|
|
|
|
|
state.articleListByTopic.forEach((article, index) => {
|
|
|
if (article.articleId === articleId) {
|
|
|
inx = index;
|
|
|
article.lazy = false;
|
|
|
} else if (inx && index - inx < 3) {
|
|
|
article.lazy = false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
[Types.FETCH_ARTICLE_TOPIC_REQUEST](state, {page}) {
|
|
|
state.fetchArticleListByTopic = true;
|
|
|
if (page === 1) {
|
...
|
...
|
@@ -96,10 +115,26 @@ export default { |
|
|
},
|
|
|
[Types.FETCH_ARTICLE_TOPIC_SUCCESS](state, {data}) {
|
|
|
state.fetchArticleListByTopic = false;
|
|
|
state.articleListByTopic = state.articleListByTopic.concat(data.detailList);
|
|
|
state.articleLastedTimeByTopic = data.lastedTime;
|
|
|
data.detailList.forEach(item => {
|
|
|
get(item, 'productList', []).forEach(product => {
|
|
|
product.favorite = false;
|
|
|
});
|
|
|
item.blockIndex = 1;
|
|
|
item.lazy = true;
|
|
|
});
|
|
|
state.articleListByTopic = state.articleListByTopic.concat(data.detailList);
|
|
|
|
|
|
state.articleListByTopic.forEach((item, index) => {
|
|
|
const imageBlocks = get(item, 'blockList', []).filter(block => block.templateKey === 'image');
|
|
|
const firstImage = first(imageBlocks);
|
|
|
|
|
|
if (firstImage) {
|
|
|
let {width, height} = getArticleImageSize(firstImage);
|
|
|
|
|
|
firstImage.width = width;
|
|
|
firstImage.height = height;
|
|
|
}
|
|
|
item.index = index;
|
|
|
});
|
|
|
},
|
...
|
...
|
|