|
@@ -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
|