Authored by zhangxiaoru

editorial

@@ -42,7 +42,7 @@ const _processListData = (list) => { @@ -42,7 +42,7 @@ const _processListData = (list) => {
42 // key: index, 42 // key: index,
43 // brands: value 43 // brands: value
44 // }); 44 // });
45 - 45 +
46 }); 46 });
47 47
48 listKey.sort(); 48 listKey.sort();
@@ -54,8 +54,9 @@ const _processListData = (list) => { @@ -54,8 +54,9 @@ const _processListData = (list) => {
54 key: key, 54 key: key,
55 brands: list.data.allList[key] 55 brands: list.data.allList[key]
56 }); 56 });
57 - });  
58 - //console.log(listData) 57 + });
  58 +
  59 + // console.log(listData)
59 60
60 return listData; 61 return listData;
61 }; 62 };
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 8
9 const editorialModel = require('../models/editorial'); 9 const editorialModel = require('../models/editorial');
10 const md5 = require('md5'); 10 const md5 = require('md5');
  11 +
11 /** 12 /**
12 * 资讯首页数据 13 * 资讯首页数据
13 * @param req 14 * @param req
@@ -115,7 +116,8 @@ const list = (req, res) => { @@ -115,7 +116,8 @@ const list = (req, res) => {
115 */ 116 */
116 const detail = (req, res, next) => { 117 const detail = (req, res, next) => {
117 let id = req.params.id; 118 let id = req.params.id;
118 - let clientType = 'pc'; 119 +
  120 + // let clientType = 'pc';
119 121
120 editorialModel.getDetailData(id).then((result) => { 122 editorialModel.getDetailData(id).then((result) => {
121 res.display('detail', { 123 res.display('detail', {
@@ -16,27 +16,6 @@ const logger = global.yoho.logger; @@ -16,27 +16,6 @@ const logger = global.yoho.logger;
16 // const helpers = global.yoho.helpers; 16 // const helpers = global.yoho.helpers;
17 17
18 /** 18 /**
19 - * 资讯首页tab数据处理  
20 - * @param type  
21 - * @returns {*}  
22 - */  
23 -const _processNavData = (list, type) => {  
24 - let formatData = [];  
25 -  
26 - list = list || [];  
27 - list = camelCase(list);  
28 -  
29 - _.forEach(list, (data, index) => {  
30 - data.url = `/editorial?type=${data.id}`;  
31 - data.isActive = index === parseInt(type, 10);  
32 -  
33 - formatData.push(data);  
34 - });  
35 -  
36 - return formatData;  
37 -};  
38 -  
39 -/**  
40 * 首页、列表页列表数据处理 19 * 首页、列表页列表数据处理
41 * @param type 20 * @param type
42 * @param pageNum 21 * @param pageNum
@@ -233,7 +212,7 @@ const _processHeadData = (list) => { @@ -233,7 +212,7 @@ const _processHeadData = (list) => {
233 */ 212 */
234 const _getRelatedData = (idList) => { 213 const _getRelatedData = (idList) => {
235 return api.get('', { 214 return api.get('', {
236 - query: '51121528,51191714,51176742,51176744,51188385,', 215 + query: idList,
237 method: 'app.search.li' 216 method: 'app.search.li'
238 }).then((result) => { 217 }).then((result) => {
239 let productList = []; 218 let productList = [];
@@ -288,12 +267,13 @@ const _processContentData = (list) => { @@ -288,12 +267,13 @@ const _processContentData = (list) => {
288 contentData.contents = list; 267 contentData.contents = list;
289 268
290 let idList = ''; 269 let idList = '';
291 - let recoLength = ''; 270 +
  271 + // let recoLength = '';
292 let related = { 272 let related = {
293 relatedReco: [], 273 relatedReco: [],
294 relatedGroup: [] 274 relatedGroup: []
295 - }  
296 - 275 + };
  276 +
297 277
298 _.forEach(contentData.contents, function(value) { 278 _.forEach(contentData.contents, function(value) {
299 279
@@ -306,16 +286,16 @@ const _processContentData = (list) => { @@ -306,16 +286,16 @@ const _processContentData = (list) => {
306 }); 286 });
307 } 287 }
308 288
309 - recoLength = idList.length/9; 289 + // recoLength = idList.length / 9;
310 290
311 if (value.goodsGroup) { 291 if (value.goodsGroup) {
312 292
313 _.forEach(value.goodsGroup.data, function(data) { 293 _.forEach(value.goodsGroup.data, function(data) {
314 294
315 - _.forEach(data.list, function(value) {  
316 - idList += value.id + ','; 295 + _.forEach(data.list, function(obj) {
  296 + idList += obj.id + ',';
317 297
318 - related.relatedGroup.push(value); 298 + related.relatedGroup.push(obj);
319 299
320 }); 300 });
321 }); 301 });
@@ -323,25 +303,22 @@ const _processContentData = (list) => { @@ -323,25 +303,22 @@ const _processContentData = (list) => {
323 }); 303 });
324 304
325 _getRelatedData(idList).then((result) => { 305 _getRelatedData(idList).then((result) => {
326 - // console.log(result)  
327 306
328 if (related.relatedReco) { 307 if (related.relatedReco) {
329 _.forEach(related.relatedReco, function(data, index) { 308 _.forEach(related.relatedReco, function(data, index) {
330 309
331 - data= _.assign(data, result[index]);  
332 - //result.remove(index) 310 + data = _.assign(data, result[index]);
333 311
334 }); 312 });
335 } 313 }
336 - 314 +
337 if (related.relatedGroup) { 315 if (related.relatedGroup) {
338 _.forEach(related.relatedGroup, function(data, index) { 316 _.forEach(related.relatedGroup, function(data, index) {
339 317
340 - data= _.assign(data, result[index]); 318 + data = _.assign(data, result[index]);
341 319
342 }); 320 });
343 } 321 }
344 - // console.log(related)  
345 322
346 return related; 323 return related;
347 324
@@ -349,7 +326,6 @@ const _processContentData = (list) => { @@ -349,7 +326,6 @@ const _processContentData = (list) => {
349 contentData.contents.push({ 326 contentData.contents.push({
350 related: related 327 related: related
351 }); 328 });
352 - console.log(contentData)  
353 329
354 return contentData; 330 return contentData;
355 }); 331 });
@@ -455,18 +431,19 @@ const _getRelateBrand = (id) => { @@ -455,18 +431,19 @@ const _getRelateBrand = (id) => {
455 }; 431 };
456 432
457 const _getArticlePre = (id) => { 433 const _getArticlePre = (id) => {
458 - // return serviceAPI.get('guang/api/*/article/getArticlePre', {  
459 - // id: id  
460 - // }).then((result) => {  
461 - // if (result && result.code === 200) {  
462 - // console.log(result)  
463 - // return result;  
464 - // } else {  
465 - // logger.error('上一篇不是200');  
466 - // return {};  
467 - // }  
468 - // }); 434 + return serviceAPI.get('guang/api/*/article/getArticlePre', {
  435 + id: id
  436 + }).then((result) => {
  437 + if (result && result.code === 200) {
  438 + console.log(result);
  439 + return result;
  440 + } else {
  441 + logger.error('上一篇不是200');
  442 + return {};
  443 + }
  444 + });
469 }; 445 };
  446 +
470 /** 447 /**
471 * 资讯收藏 448 * 资讯收藏
472 * @param uid 449 * @param uid
@@ -185,11 +185,11 @@ $('#comment-info').trigger('keyup'); @@ -185,11 +185,11 @@ $('#comment-info').trigger('keyup');
185 if (tag === 0) { 185 if (tag === 0) {
186 $('.article-tag').hide(); 186 $('.article-tag').hide();
187 } 187 }
188 -  
189 -if($('.collocation').find('.good-info').length === 0) { 188 +
  189 +if ($('.collocation').find('.good-info').length === 0) {
190 $('.related-collo').hide(); 190 $('.related-collo').hide();
191 } 191 }
192 192
193 -if($('.goods').find('.good-info').length === 0) { 193 +if ($('.goods').find('.good-info').length === 0) {
194 $('.related-group').hide(); 194 $('.related-group').hide();
195 -}  
  195 +}
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 .good-info { 105 .good-info {
106 width: 219px; 106 width: 219px;
107 float: left; 107 float: left;
108 - margin:0 20px 15px 0; 108 + margin: 0 20px 15px 0;
109 109
110 img { 110 img {
111 width: 219px; 111 width: 219px;
@@ -118,8 +118,8 @@ @@ -118,8 +118,8 @@
118 height: 30px; 118 height: 30px;
119 overflow: hidden; 119 overflow: hidden;
120 display: block; 120 display: block;
121 - text-overflow:ellipsis;  
122 - white-space:nowrap 121 + text-overflow: ellipsis;
  122 + white-space: nowrap;
123 } 123 }
124 124
125 .price { 125 .price {