...
|
...
|
@@ -362,95 +362,92 @@ const index = (req, res, next) => { |
|
|
data.guang.channel = channel;
|
|
|
data.guang.isShare = isShare;
|
|
|
|
|
|
if (detail.code !== 400) {
|
|
|
if (!detail.getArticle) {
|
|
|
// TODO 跳转到逛首页
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (isShare && detail && detail.sideNav) {
|
|
|
data.sideNav = detail.sideNav;
|
|
|
}
|
|
|
|
|
|
// 作者信息数据
|
|
|
if (detail && detail.getAuthor && (typeof detail.getAuthor.name !== 'undefined')) {
|
|
|
data.guang.author = {
|
|
|
avatar: detail.getAuthor.avatar.replace('http://', '//'),
|
|
|
name: detail.getAuthor.name,
|
|
|
intro: detail.getAuthor.author_desc
|
|
|
};
|
|
|
|
|
|
// guang双头部的问题 20160601
|
|
|
// 正确的URL
|
|
|
let url = `${detail.getAuthor.url}&openby:yohobuy={"action":"go.h5","params":{"param":{},"share":"","id":${detail.getAuthor.author_id},"type":0,"islogin":"N","url":"${detail.getAuthor.url}"}}`; // eslint-disable-line
|
|
|
if (detail.code === 400) {
|
|
|
return next();
|
|
|
}
|
|
|
if (!detail.getArticle) {
|
|
|
// TODO 跳转到逛首页
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
data.guang.author.url = helpers.https(url);
|
|
|
}
|
|
|
let guang = data.guang;
|
|
|
if (isShare && detail && detail.sideNav) {
|
|
|
data.sideNav = detail.sideNav;
|
|
|
}
|
|
|
|
|
|
guang.detail = {
|
|
|
id: _.get(detail, 'getArticle.id'),
|
|
|
title: detail.getArticle.article_title,
|
|
|
publishTime: detail.getArticle.publishTime,
|
|
|
pageView: detail.getArticle.pageViews,
|
|
|
content: []
|
|
|
// 作者信息数据
|
|
|
if (detail && detail.getAuthor && (typeof detail.getAuthor.name !== 'undefined')) {
|
|
|
data.guang.author = {
|
|
|
avatar: detail.getAuthor.avatar.replace('http://', '//'),
|
|
|
name: detail.getAuthor.name,
|
|
|
intro: detail.getAuthor.author_desc
|
|
|
};
|
|
|
|
|
|
// guang双头部的问题 20160601
|
|
|
// 正确的URL
|
|
|
let url = `${detail.getAuthor.url}&openby:yohobuy={"action":"go.h5","params":{"param":{},"share":"","id":${detail.getAuthor.author_id},"type":0,"islogin":"N","url":"${detail.getAuthor.url}"}}`; // eslint-disable-line
|
|
|
|
|
|
if (detail.getArticleContent) {
|
|
|
// 生成内容部分
|
|
|
return _pageArticleContent(detail.getArticleContent,
|
|
|
isApp,
|
|
|
gender,
|
|
|
isWeixin,
|
|
|
isqq,
|
|
|
isWeibo).then((contents) => {
|
|
|
guang.detail.content = contents;
|
|
|
|
|
|
// 相关品牌
|
|
|
if (detail.getBrand && detail.getBrand.length) {
|
|
|
guang.relatedBrand = _relatedBrand(detail.getBrand);
|
|
|
}
|
|
|
data.guang.author.url = helpers.https(url);
|
|
|
}
|
|
|
let guang = data.guang;
|
|
|
|
|
|
guang.detail = {
|
|
|
id: _.get(detail, 'getArticle.id'),
|
|
|
title: detail.getArticle.article_title,
|
|
|
publishTime: detail.getArticle.publishTime,
|
|
|
pageView: detail.getArticle.pageViews,
|
|
|
content: []
|
|
|
};
|
|
|
if (!detail.getArticleContent) {
|
|
|
return next();
|
|
|
}
|
|
|
|
|
|
// 相关标签
|
|
|
if (detail.getArticle.tags && detail.getArticle.tags.length) {
|
|
|
guang.relatedTag = _relatedTag(detail.getArticle.tags, isApp);
|
|
|
}
|
|
|
// 生成内容部分
|
|
|
return _pageArticleContent(detail.getArticleContent,
|
|
|
isApp,
|
|
|
gender,
|
|
|
isWeixin,
|
|
|
isqq,
|
|
|
isWeibo).then((contents) => {
|
|
|
guang.detail.content = contents;
|
|
|
|
|
|
// 相关品牌
|
|
|
if (detail.getBrand && detail.getBrand.length) {
|
|
|
guang.relatedBrand = _relatedBrand(detail.getBrand);
|
|
|
}
|
|
|
|
|
|
// 相关文章
|
|
|
if (detail.getOtherArticle && detail.getOtherArticle.length) {
|
|
|
guang.relatedInfo = _relatedInfo(detail.getOtherArticle, isApp);
|
|
|
}
|
|
|
// 相关标签
|
|
|
if (detail.getArticle.tags && detail.getArticle.tags.length) {
|
|
|
guang.relatedTag = _relatedTag(detail.getArticle.tags, isApp);
|
|
|
}
|
|
|
|
|
|
// 分享参数
|
|
|
if (detail.getArticle.cover_image) {
|
|
|
let shareInfo = _shareInfo(id, detail.getArticle);
|
|
|
// 相关文章
|
|
|
if (detail.getOtherArticle && detail.getOtherArticle.length) {
|
|
|
guang.relatedInfo = _relatedInfo(detail.getOtherArticle, isApp);
|
|
|
}
|
|
|
|
|
|
Object.assign(guang, shareInfo);
|
|
|
data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停';
|
|
|
data.title_more = true;
|
|
|
data.description = detail.getArticle.article_summary;
|
|
|
data.description_more = true;
|
|
|
}
|
|
|
// 分享参数
|
|
|
if (detail.getArticle.cover_image) {
|
|
|
let shareInfo = _shareInfo(id, detail.getArticle);
|
|
|
|
|
|
// 标识有微信分享
|
|
|
data.hasWxShare = true;
|
|
|
res.render('info/index', Object.assign({
|
|
|
page: 'info-index',
|
|
|
title: '逛',
|
|
|
gender: gender,
|
|
|
wechatShare: true,
|
|
|
isWeixin: isWeixin,
|
|
|
localCss: true,
|
|
|
isShare: isShare
|
|
|
}, data, parameter));
|
|
|
});
|
|
|
} else {
|
|
|
next();
|
|
|
return;
|
|
|
}
|
|
|
Object.assign(guang, shareInfo);
|
|
|
data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停';
|
|
|
data.title_more = true;
|
|
|
data.description = detail.getArticle.article_summary;
|
|
|
data.description_more = true;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
// 标识有微信分享
|
|
|
data.hasWxShare = true;
|
|
|
res.render('info/index', Object.assign({
|
|
|
page: 'info-index',
|
|
|
title: '逛',
|
|
|
gender: gender,
|
|
|
wechatShare: true,
|
|
|
isWeixin: isWeixin,
|
|
|
localCss: true,
|
|
|
isShare: isShare
|
|
|
}, data, parameter));
|
|
|
}).catch(next);
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
...
|
...
|
|