...
|
...
|
@@ -2,7 +2,6 @@ import * as Types from './types'; |
|
|
import { get } from 'lodash';
|
|
|
import * as guangProcess from './guangProcess';
|
|
|
import * as sleep from '../../utils/sleep';
|
|
|
import sdk from 'common/sdk';
|
|
|
|
|
|
export default {
|
|
|
async fetchArticleList({ commit }, { articleId, authorUid, authorType, limit = 5, page = 1, thumb = false }) {
|
...
|
...
|
@@ -171,39 +170,28 @@ export default { |
|
|
|
|
|
await sleep.sleep(200);
|
|
|
commit(Types.GUANG_ARTICLE_CONTENT, processContents.finalDetail);
|
|
|
commit(Types.GUANG_DETAIL_PRODUCT_LIST, processContents.allgoods);
|
|
|
|
|
|
//再处理其他信息
|
|
|
const [goodsList, favsList, zan, article] = await Promise.all([
|
|
|
const [goodsList, zan, article] = await Promise.all([
|
|
|
this.$api.post('/api/guang/article/queryGoods', {
|
|
|
query: processContents.allgoods.skn.join(','),
|
|
|
order: 's_t_desc',
|
|
|
limit: processContents.allgoods.skn.length || 1
|
|
|
}),
|
|
|
sdk.getUser().then((u) => {
|
|
|
if (u && u.uid) {
|
|
|
return this.$api.post('/api/favorite/batchCheckIsFavorite', {
|
|
|
favIds: processContents.allgoods.id.join(','),
|
|
|
type: 'product'
|
|
|
});
|
|
|
} else {
|
|
|
return {};
|
|
|
}
|
|
|
}),
|
|
|
this.$api.post('/api/guang/article/zan', { articleId: grass_id }),
|
|
|
this.$api.get('/api/guang/article/detail', { article_id })
|
|
|
]).then(([res1, res2, res3, res4]) => {
|
|
|
]).then(([res1, res2, res3]) => {
|
|
|
return [
|
|
|
get(res1, 'data.product_list', []),
|
|
|
get(res2, 'data', []),
|
|
|
get(res3, 'data', false),
|
|
|
get(res4, 'data', false)
|
|
|
get(res2, 'data', false),
|
|
|
get(res3, 'data', false)
|
|
|
];
|
|
|
});
|
|
|
|
|
|
result.getArticleContent = guangProcess.pushGoodsInfo(
|
|
|
processContents.finalDetail,
|
|
|
goodsList,
|
|
|
favsList
|
|
|
goodsList
|
|
|
);
|
|
|
|
|
|
result.getRecommendProducts = processContents.recommends;
|
...
|
...
|
@@ -229,8 +217,21 @@ export default { |
|
|
}
|
|
|
|
|
|
// 等待动画完成后,提交数据
|
|
|
commit(Types.FETCH_GUANG_SUCCESS, result);
|
|
|
},
|
|
|
|
|
|
async fetchProductFav({ commit, state }) {
|
|
|
if (!state.articleProductList.id.length) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
commit(Types.FETCH_GUANG_SUCCESS, result);
|
|
|
const favsList = await this.$api.post('/api/favorite/batchCheckIsFavorite', {
|
|
|
favIds: state.articleProductList.id.join(','),
|
|
|
type: 'product'
|
|
|
}).then(result => {
|
|
|
return get(result, 'data', []);
|
|
|
});
|
|
|
|
|
|
commit(Types.GUANG_CHANGE_PRODUCT_FAV, favsList);
|
|
|
}
|
|
|
}; |
...
|
...
|
|