...
|
...
|
@@ -5,7 +5,14 @@ import Vue from 'vue'; |
|
|
export default {
|
|
|
async fetchProductInfo({commit}, {productId}) {
|
|
|
const queryTasks = ['', '/resource', '/activity', '/recommend'].map(path => {
|
|
|
return this.$api.get(`/api/ufo/product${path}`, {product_id: productId}).then(result => {
|
|
|
let params = {product_id: productId};
|
|
|
|
|
|
if (path === '/resource') {
|
|
|
params = {
|
|
|
content_code: '05e4f5782dfc3a5e10d39b8f04a7dcb9',
|
|
|
};
|
|
|
}
|
|
|
return this.$api.get(`/api/ufo/product${path}`, params).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
return result.data;
|
|
|
} else {
|
...
|
...
|
@@ -14,10 +21,12 @@ export default { |
|
|
});
|
|
|
});
|
|
|
|
|
|
const [detail, resource, activity, recommend] = await Promise.all(queryTasks);
|
|
|
let [detail, resource, activity, recommend] = await Promise.all(queryTasks);
|
|
|
|
|
|
resource = get(resource, '[0].data[0]', null);
|
|
|
|
|
|
commit(Types.UPDATE_PRODUCT_DETAIL, Object.assign(detail.product_info, {
|
|
|
resource: get(resource, '[0].data[0]', null),
|
|
|
resource,
|
|
|
activity: activity || [],
|
|
|
recommend: recommend && recommend.product_list || [],
|
|
|
}));
|
...
|
...
|
|