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) => { @@ -175,10 +175,13 @@ const detail = (req, res, next) => {
175 userInfo: result.head, 175 userInfo: result.head,
176 comment: result.comment, 176 comment: result.comment,
177 brands: result.brands, 177 brands: result.brands,
178 - article: {  
179 - nextChapter: '来来来,让我们好好聊聊',  
180 - lastChapter: '除了黑白灰'  
181 - }, 178 +
  179 + // article: {
  180 + // nextChapter: '来来来,让我们好好聊聊',
  181 + // lastChapter: '除了黑白灰'
  182 + // },
  183 + nextArticle: result.nextArticle,
  184 + perArticle: result.perArticle,
182 share: { 185 share: {
183 shareImg: result.content.shareImg, 186 shareImg: result.content.shareImg,
184 shareDesc: result.head.title, 187 shareDesc: result.head.title,
@@ -190,8 +190,8 @@ const _processHeadData = (list) => { @@ -190,8 +190,8 @@ const _processHeadData = (list) => {
190 } 190 }
191 }); 191 });
192 192
193 - // newData.headData.time = newData.headData.time.replace(/-/g, '/');  
194 - // newData.headData.time = newData.headData.time.replace(':00', '', 2); 193 + newData.headData.time = newData.headData.time.replace(/-/g, '/');
  194 + newData.headData.time = newData.headData.time.replace(':00', '', 2);
195 195
196 let id = newData.headData.authorId; 196 let id = newData.headData.authorId;
197 197
@@ -447,13 +447,58 @@ const _getArticlePre = (id, appType) => { @@ -447,13 +447,58 @@ const _getArticlePre = (id, appType) => {
447 id: id, 447 id: id,
448 app_type: appType 448 app_type: appType
449 }).then((result) => { 449 }).then((result) => {
450 - // console.log(result.message) 450 +
451 if (result && result.code === 200) { 451 if (result && result.code === 200) {
452 - // console.log(result) 452 + let perArticle = {};
  453 +
  454 + perArticle.href = `${config.siteUrl}/editorial/${result.data.articleIdPre}.html`;
  455 +
  456 + _getHeadData(result.data.articleIdPre, appType).then((list) => {
  457 +
  458 + perArticle.lastChapter = list.title;
  459 +
  460 + }).then(() => {
  461 +
  462 + return perArticle;
  463 + });
  464 +
  465 + return perArticle;
  466 + } else {
  467 + logger.error('In the previous is not 200');
  468 + return {};
  469 + }
  470 + });
  471 +};
  472 +
  473 +/**
  474 + * 获取详情页下一篇
  475 + * @param id
  476 + * @returns {*}
  477 + */
  478 +const _getArticleNext = (id, appType) => {
  479 + return serviceAPI.get('/guang/api/*/article/getArticleNext', {
  480 + id: id,
  481 + app_type: appType
  482 + }).then((result) => {
  483 +
  484 + if (result && result.code === 200) {
  485 +
  486 + let nextArticle = {};
  487 +
  488 + nextArticle.href = `${config.siteUrl}/editorial/${result.data.articleIdNext}.html`;
  489 +
  490 + _getHeadData(result.data.articleIdNext, appType).then((list) => {
  491 +
  492 + nextArticle.lastChapter = list.title;
  493 + }).then(() => {
  494 +
  495 + return nextArticle;
  496 + });
  497 +
  498 + return nextArticle;
453 499
454 - return camelCase(result.data);  
455 } else { 500 } else {
456 - logger.error('上一篇 is not 200'); 501 + logger.error('The next article is not 200');
457 return {}; 502 return {};
458 } 503 }
459 }); 504 });
@@ -573,6 +618,7 @@ const getDetailData = (id, appType) => { @@ -573,6 +618,7 @@ const getDetailData = (id, appType) => {
573 _getContentData(id), 618 _getContentData(id),
574 _getCommentsData(id), 619 _getCommentsData(id),
575 _getArticlePre(id, appType), 620 _getArticlePre(id, appType),
  621 + _getArticleNext(id, appType),
576 _getRelateBrand(id)]); 622 _getRelateBrand(id)]);
577 let res = yield _processHeadData([result[0], result[1], result[3]]); 623 let res = yield _processHeadData([result[0], result[1], result[3]]);
578 624
@@ -581,7 +627,9 @@ const getDetailData = (id, appType) => { @@ -581,7 +627,9 @@ const getDetailData = (id, appType) => {
581 tags: res.tags, 627 tags: res.tags,
582 content: result[2], 628 content: result[2],
583 comment: result[3], 629 comment: result[3],
584 - brands: result[5] 630 + brands: result[6],
  631 + nextArticle: result[4],
  632 + perArticle: result[5]
585 }; 633 };
586 })(); 634 })();
587 }; 635 };
@@ -141,16 +141,22 @@ @@ -141,16 +141,22 @@
141 </div> 141 </div>
142 142
143 <div class="chapter"> 143 <div class="chapter">
144 - {{# article}} 144 +
145 <p class="chapter-right"> 145 <p class="chapter-right">
146 <span>下一篇</span><br> 146 <span>下一篇</span><br>
  147 + {{# nextArticle}}
147 <a href="{{href}}">{{nextChapter}}</a> 148 <a href="{{href}}">{{nextChapter}}</a>
  149 + {{/ nextArticle}}
148 </p> 150 </p>
  151 +
  152 +
149 <p class="chapter-left"> 153 <p class="chapter-left">
150 <span>上一篇</span><br> 154 <span>上一篇</span><br>
  155 + {{# perArticle}}
151 <a href="{{href}}">{{lastChapter}}</a> 156 <a href="{{href}}">{{lastChapter}}</a>
  157 + {{/ perArticle}}
152 </p> 158 </p>
153 - {{/ article}} 159 +
154 </div> 160 </div>
155 161
156 <div id="comment-area" class="comment-area"> 162 <div id="comment-area" class="comment-area">
@@ -124,6 +124,7 @@ @@ -124,6 +124,7 @@
124 </a> 124 </a>
125 </li> 125 </li>
126 <li class="pro-info"> 126 <li class="pro-info">
  127 + <a class="brand-name" href="/product/shop/{{brand_domain}}">{{brand_name}}</a>
127 <div class="pro-name"><a href="javascript:void(0)">{{product_name}}</a></div> 128 <div class="pro-name"><a href="javascript:void(0)">{{product_name}}</a></div>
128 <div> 129 <div>
129 {{#if color_name}} 130 {{#if color_name}}
@@ -41,6 +41,7 @@ var typeMap = { @@ -41,6 +41,7 @@ var typeMap = {
41 }; 41 };
42 42
43 require('../common/foreach-polyfill'); 43 require('../common/foreach-polyfill');
  44 +require('../common/bind-polyfill');
44 45
45 // 个人中心共用代码加载 46 // 个人中心共用代码加载
46 require('./me'); 47 require('./me');
@@ -2,6 +2,8 @@ var dialog = require('../../plugins/dialog'); @@ -2,6 +2,8 @@ var dialog = require('../../plugins/dialog');
2 var _dialog = dialog.Dialog; 2 var _dialog = dialog.Dialog;
3 var _alert = dialog.Alert; 3 var _alert = dialog.Alert;
4 4
  5 +
  6 +require('../../common/foreach-polyfill');
5 // 添加.check方法 7 // 添加.check方法
6 require('../../plugins/check'); 8 require('../../plugins/check');
7 9