...
|
...
|
@@ -65,7 +65,6 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
skns.push(goods.id);
|
|
|
arr[goods.id] = goods.src;
|
|
|
});
|
|
|
|
|
|
// 通过SKN获取商品信息
|
|
|
productDetailModel.productInfoBySkns(skns).then((product) => {
|
|
|
if (product.data.product_list) {
|
...
|
...
|
@@ -146,15 +145,16 @@ const _pageArticleContent = (articleContent, isApp, gender) => { |
|
|
build.moreLink = art.link.data[0].url;
|
|
|
contents.push(build);
|
|
|
joinContentFunc(++i, len);
|
|
|
} else {
|
|
|
joinContentFunc(++i, len);
|
|
|
}
|
|
|
} else {
|
|
|
resolve(contents);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
joinContentFunc(0, articleContent.length);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* [处理品牌数据]
|
|
|
* @param {[array]} getBrand [品牌原数据]
|
...
|
...
|
@@ -165,8 +165,7 @@ const _relatedBrand = (getBrand) => { |
|
|
brand.thumb = brand.thumb.replace('http://', '//');
|
|
|
});
|
|
|
return relatedBrand;
|
|
|
};
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* [处理标签数据]
|
|
|
* @param {[array]} tags [标签原数据]
|
...
|
...
|
@@ -183,8 +182,7 @@ const _relatedTag = (tags, isApp) => { |
|
|
relatedTag.push(value);
|
|
|
});
|
|
|
return relatedTag;
|
|
|
};
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* [处理相关文章数据]
|
|
|
* @param {[array]} getOtherArticle [相关文章原数据]
|
...
|
...
|
@@ -202,8 +200,7 @@ const _relatedInfo = (getOtherArticle, isApp) => { |
|
|
relatedInfo.push(value);
|
|
|
});
|
|
|
return relatedInfo;
|
|
|
};
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* [处理分享内容]
|
|
|
* @param {[int]} id [资讯id]
|
...
|
...
|
@@ -222,8 +219,7 @@ const _shareInfo = (id, getArticle) => { |
|
|
shareInfo.shareImg = helpers.image(getArticle.cover_image, 640, 320);
|
|
|
}
|
|
|
return shareInfo;
|
|
|
};
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* [逛资讯详情页]
|
|
|
*/
|
...
|
...
|
@@ -247,8 +243,7 @@ const index = (req, res, next) => { |
|
|
parameter = {
|
|
|
pageHeader: headerModel.setNav({
|
|
|
navTitle: title
|
|
|
}),
|
|
|
pageFooter: true
|
|
|
})
|
|
|
};
|
|
|
}
|
|
|
|
...
|
...
|
@@ -284,13 +279,12 @@ const index = (req, res, next) => { |
|
|
pageView: detail.getArticle.pageViews,
|
|
|
content: []
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (detail.getArticleContent) {
|
|
|
// 生成内容部分
|
|
|
//生成内容部分
|
|
|
return _pageArticleContent(detail.getArticleContent, isApp, gender).then((contents) => {
|
|
|
guang.detail.content = contents;
|
|
|
|
|
|
// 相关品牌
|
|
|
if (detail.getBrand && detail.getBrand.length) {
|
|
|
guang.relatedBrand = _relatedBrand(detail.getBrand);
|
...
|
...
|
@@ -310,7 +304,7 @@ const index = (req, res, next) => { |
|
|
if (detail.getArticle.cover_image) {
|
|
|
let shareInfo = _shareInfo(id, detail.getArticle);
|
|
|
Object.assign(guang, shareInfo);
|
|
|
data.title = detail.getArticle.article_title;
|
|
|
data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停';
|
|
|
data.title_more = true;
|
|
|
data.description = detail.getArticle.article_summary;
|
|
|
data.description_more = true;
|
...
|
...
|
@@ -333,7 +327,6 @@ const index = (req, res, next) => { |
|
|
}
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [逛mini内容页]
|
|
|
*/
|
...
|
...
|
@@ -368,13 +361,12 @@ const mini = (req, res, next) => { |
|
|
pageView: detail.getArticle.pageViews,
|
|
|
content: []
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (detail.getArticleContent) {
|
|
|
// 生成内容部分
|
|
|
//生成内容部分
|
|
|
return _pageArticleContent(detail.getArticleContent, isApp, gender).then((contents) => {
|
|
|
guang.detail.content = contents;
|
|
|
|
|
|
// 相关品牌
|
|
|
if (detail.getBrand && detail.getBrand.length) {
|
|
|
guang.relatedBrand = _relatedBrand(detail.getBrand);
|
...
|
...
|
@@ -430,17 +422,16 @@ const foryoho = (req, res, next) => { |
|
|
data.brand = detail.getBrand;
|
|
|
|
|
|
if (detail.getArticleContent) {
|
|
|
// 生成内容部分
|
|
|
//生成内容部分
|
|
|
return _pageArticleContent(detail.getArticleContent, isApp, gender).then((contents) => {
|
|
|
data.content = contents;
|
|
|
|
|
|
// 内容中的相关推荐和悬浮商品移到data层级
|
|
|
//内容中的相关推荐和悬浮商品移到data层级
|
|
|
let relatedRecoIndex = data.content.findIndex((cont) => {
|
|
|
return typeof cont.relatedReco !== 'undefined';
|
|
|
});
|
|
|
})
|
|
|
let collocationIndex = data.content.findIndex((cont) => {
|
|
|
return typeof cont.collocation !== 'undefined';
|
|
|
});
|
|
|
})
|
|
|
if (relatedRecoIndex > 0) {
|
|
|
data.goods = data.content[relatedRecoIndex].relatedReco;
|
|
|
data.content.splice(relatedRecoIndex, 1);
|
...
|
...
|
@@ -458,7 +449,7 @@ const foryoho = (req, res, next) => { |
|
|
|
|
|
}
|
|
|
}).catch(next);
|
|
|
};
|
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
|
index,
|
...
|
...
|
|