...
|
...
|
@@ -30,7 +30,7 @@ export default { |
|
|
});
|
|
|
|
|
|
let [detail, resource, activity, recommend, limitInfo] = await Promise.all(queryTasks);
|
|
|
|
|
|
|
|
|
// 视频资源位
|
|
|
const videoResourceInfo = resource.find(r=> /(\.mp4)/.test(r.data[0].url));
|
|
|
const videoResource = get(videoResourceInfo, 'data[0]', {});
|
...
|
...
|
@@ -141,4 +141,87 @@ export default { |
|
|
async payment(context, { skup }) {
|
|
|
return this.$api.post('/api/ufo/product/order/payment', { skup, api_version: 1 });
|
|
|
},
|
|
|
|
|
|
// 获取详情页展示的社区内容
|
|
|
async fecthGrassAricles({state, commit}, {productSkn}) {
|
|
|
let articleResult = await this.$api.get('/api/grass/product/article', {
|
|
|
productSkn,
|
|
|
productType: 2,
|
|
|
fromXianYu: 'Y'
|
|
|
});
|
|
|
|
|
|
if (articleResult && articleResult.data && articleResult.data.list && articleResult.data.list.length > 0) {
|
|
|
let articles = articleResult.data.list || [];
|
|
|
|
|
|
let articleIds = [];
|
|
|
let newArticleList = [];
|
|
|
let newImages = [];
|
|
|
|
|
|
// 找出所有ariticleId
|
|
|
articles.forEach(item => {
|
|
|
articleIds.push(item.articleId);
|
|
|
newArticleList.push(item);
|
|
|
});
|
|
|
|
|
|
// 传入articleId获取所有需要展示的图片列表
|
|
|
let imagesResult = await this.$api.get(
|
|
|
'/api/grass/product/articleImages',
|
|
|
{
|
|
|
articleIds: articleIds.join(',')
|
|
|
});
|
|
|
|
|
|
// 处理数据,把对应数据整合到articles
|
|
|
if (imagesResult && imagesResult.data && imagesResult.data.imageMap) {
|
|
|
let imageData = imagesResult.data.imageMap;
|
|
|
let imageIndex = 0;
|
|
|
|
|
|
// 处理每篇文章下面的图片
|
|
|
newArticleList.forEach(articleItem => {
|
|
|
articleItem.imageindex = imageIndex;
|
|
|
|
|
|
if (imageData[articleItem.articleId]) {// 如果找到对应id的图片列表
|
|
|
imageIndex += imageData[articleItem.articleId].length;
|
|
|
|
|
|
let imageList = [];
|
|
|
|
|
|
imageData[articleItem.articleId].forEach(listItem => {
|
|
|
listItem.contentData = listItem.contentData.replace(/{mode}/, 2).replace(/{width}/, 750).replace(/\/h\/{height}/, '/q/60');
|
|
|
imageList.push(listItem);
|
|
|
newImages.push(listItem.contentData);
|
|
|
});
|
|
|
articleItem.coverImage = articleItem.coverImage.replace(/{mode}/, 2).replace(/{width}/, 200).replace(/{height}/, 200)
|
|
|
|
|
|
articleItem.imageList = imageList;
|
|
|
} else { // 没找到对应id的图片列表则把自己的图插入
|
|
|
let imageList = [
|
|
|
{
|
|
|
articleId: articleItem.articleId,
|
|
|
contentData: articleItem.coverImage.replace(/{mode}/, 2).replace(/{width}/, 750).replace(/\/h\/{height}/, '/q/60')
|
|
|
}
|
|
|
];
|
|
|
|
|
|
articleItem.imageList = imageList;
|
|
|
articleItem.coverImage = articleItem.coverImage.replace(/{mode}/, 2).replace(/{width}/, 200).replace(/{height}/, 200);
|
|
|
imageIndex += 1;
|
|
|
newImages = newImages.push(imageList.contentData);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
articleResult.data.imageList = newImages;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// console.log('articleFinalResult=', articleResult);
|
|
|
|
|
|
return articleResult;
|
|
|
},
|
|
|
|
|
|
async getProductSizeImage({state}, {product_id, brand_id}) {
|
|
|
let result = await this.$api.get('/api/ufo/product/sizeImage', {
|
|
|
product_id,
|
|
|
brand_id
|
|
|
});
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}; |
...
|
...
|
|