Authored by 姜枫

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-blk into release/1.0

... ... @@ -175,10 +175,13 @@ const detail = (req, res, next) => {
userInfo: result.head,
comment: result.comment,
brands: result.brands,
article: {
nextChapter: '来来来,让我们好好聊聊',
lastChapter: '除了黑白灰'
},
// article: {
// nextChapter: '来来来,让我们好好聊聊',
// lastChapter: '除了黑白灰'
// },
nextArticle: result.nextArticle,
perArticle: result.perArticle,
share: {
shareImg: result.content.shareImg,
shareDesc: result.head.title,
... ...
... ... @@ -190,8 +190,8 @@ const _processHeadData = (list) => {
}
});
// newData.headData.time = newData.headData.time.replace(/-/g, '/');
// newData.headData.time = newData.headData.time.replace(':00', '', 2);
newData.headData.time = newData.headData.time.replace(/-/g, '/');
newData.headData.time = newData.headData.time.replace(':00', '', 2);
let id = newData.headData.authorId;
... ... @@ -447,13 +447,58 @@ const _getArticlePre = (id, appType) => {
id: id,
app_type: appType
}).then((result) => {
// console.log(result.message)
if (result && result.code === 200) {
// console.log(result)
let perArticle = {};
perArticle.href = `${config.siteUrl}/editorial/${result.data.articleIdPre}.html`;
_getHeadData(result.data.articleIdPre, appType).then((list) => {
perArticle.lastChapter = list.title;
}).then(() => {
return perArticle;
});
return perArticle;
} else {
logger.error('In the previous is not 200');
return {};
}
});
};
/**
* 获取详情页下一篇
* @param id
* @returns {*}
*/
const _getArticleNext = (id, appType) => {
return serviceAPI.get('/guang/api/*/article/getArticleNext', {
id: id,
app_type: appType
}).then((result) => {
if (result && result.code === 200) {
let nextArticle = {};
nextArticle.href = `${config.siteUrl}/editorial/${result.data.articleIdNext}.html`;
_getHeadData(result.data.articleIdNext, appType).then((list) => {
nextArticle.lastChapter = list.title;
}).then(() => {
return nextArticle;
});
return nextArticle;
return camelCase(result.data);
} else {
logger.error('上一篇 is not 200');
logger.error('The next article is not 200');
return {};
}
});
... ... @@ -573,6 +618,7 @@ const getDetailData = (id, appType) => {
_getContentData(id),
_getCommentsData(id),
_getArticlePre(id, appType),
_getArticleNext(id, appType),
_getRelateBrand(id)]);
let res = yield _processHeadData([result[0], result[1], result[3]]);
... ... @@ -581,7 +627,9 @@ const getDetailData = (id, appType) => {
tags: res.tags,
content: result[2],
comment: result[3],
brands: result[5]
brands: result[6],
nextArticle: result[4],
perArticle: result[5]
};
})();
};
... ...
... ... @@ -141,16 +141,22 @@
</div>
<div class="chapter">
{{# article}}
<p class="chapter-right">
<span>下一篇</span><br>
{{# nextArticle}}
<a href="{{href}}">{{nextChapter}}</a>
{{/ nextArticle}}
</p>
<p class="chapter-left">
<span>上一篇</span><br>
{{# perArticle}}
<a href="{{href}}">{{lastChapter}}</a>
{{/ perArticle}}
</p>
{{/ article}}
</div>
<div id="comment-area" class="comment-area">
... ...
... ... @@ -124,6 +124,7 @@
</a>
</li>
<li class="pro-info">
<a class="brand-name" href="/product/shop/{{brand_domain}}">{{brand_name}}</a>
<div class="pro-name"><a href="javascript:void(0)">{{product_name}}</a></div>
<div>
{{#if color_name}}
... ...
... ... @@ -41,6 +41,7 @@ var typeMap = {
};
require('../common/foreach-polyfill');
require('../common/bind-polyfill');
// 个人中心共用代码加载
require('./me');
... ...
... ... @@ -2,6 +2,8 @@ var dialog = require('../../plugins/dialog');
var _dialog = dialog.Dialog;
var _alert = dialog.Alert;
require('../../common/foreach-polyfill');
// 添加.check方法
require('../../plugins/check');
... ...