...
|
...
|
@@ -16,27 +16,6 @@ const logger = global.yoho.logger; |
|
|
// const helpers = global.yoho.helpers;
|
|
|
|
|
|
/**
|
|
|
* 资讯首页tab数据处理
|
|
|
* @param type
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
const _processNavData = (list, type) => {
|
|
|
let formatData = [];
|
|
|
|
|
|
list = list || [];
|
|
|
list = camelCase(list);
|
|
|
|
|
|
_.forEach(list, (data, index) => {
|
|
|
data.url = `/editorial?type=${data.id}`;
|
|
|
data.isActive = index === parseInt(type, 10);
|
|
|
|
|
|
formatData.push(data);
|
|
|
});
|
|
|
|
|
|
return formatData;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 首页、列表页列表数据处理
|
|
|
* @param type
|
|
|
* @param pageNum
|
...
|
...
|
@@ -233,7 +212,7 @@ const _processHeadData = (list) => { |
|
|
*/
|
|
|
const _getRelatedData = (idList) => {
|
|
|
return api.get('', {
|
|
|
query: '51121528,51191714,51176742,51176744,51188385,',
|
|
|
query: idList,
|
|
|
method: 'app.search.li'
|
|
|
}).then((result) => {
|
|
|
let productList = [];
|
...
|
...
|
@@ -288,11 +267,12 @@ const _processContentData = (list) => { |
|
|
contentData.contents = list;
|
|
|
|
|
|
let idList = '';
|
|
|
let recoLength = '';
|
|
|
|
|
|
// let recoLength = '';
|
|
|
let related = {
|
|
|
relatedReco: [],
|
|
|
relatedGroup: []
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
_.forEach(contentData.contents, function(value) {
|
...
|
...
|
@@ -306,16 +286,16 @@ const _processContentData = (list) => { |
|
|
});
|
|
|
}
|
|
|
|
|
|
recoLength = idList.length/9;
|
|
|
// recoLength = idList.length / 9;
|
|
|
|
|
|
if (value.goodsGroup) {
|
|
|
|
|
|
_.forEach(value.goodsGroup.data, function(data) {
|
|
|
|
|
|
_.forEach(data.list, function(value) {
|
|
|
idList += value.id + ',';
|
|
|
_.forEach(data.list, function(obj) {
|
|
|
idList += obj.id + ',';
|
|
|
|
|
|
related.relatedGroup.push(value);
|
|
|
related.relatedGroup.push(obj);
|
|
|
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -323,13 +303,11 @@ const _processContentData = (list) => { |
|
|
});
|
|
|
|
|
|
_getRelatedData(idList).then((result) => {
|
|
|
// console.log(result)
|
|
|
|
|
|
if (related.relatedReco) {
|
|
|
_.forEach(related.relatedReco, function(data, index) {
|
|
|
|
|
|
data= _.assign(data, result[index]);
|
|
|
//result.remove(index)
|
|
|
data = _.assign(data, result[index]);
|
|
|
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -337,11 +315,10 @@ const _processContentData = (list) => { |
|
|
if (related.relatedGroup) {
|
|
|
_.forEach(related.relatedGroup, function(data, index) {
|
|
|
|
|
|
data= _.assign(data, result[index]);
|
|
|
data = _.assign(data, result[index]);
|
|
|
|
|
|
});
|
|
|
}
|
|
|
// console.log(related)
|
|
|
|
|
|
return related;
|
|
|
|
...
|
...
|
@@ -349,7 +326,6 @@ const _processContentData = (list) => { |
|
|
contentData.contents.push({
|
|
|
related: related
|
|
|
});
|
|
|
console.log(contentData)
|
|
|
|
|
|
return contentData;
|
|
|
});
|
...
|
...
|
@@ -455,18 +431,19 @@ const _getRelateBrand = (id) => { |
|
|
};
|
|
|
|
|
|
const _getArticlePre = (id) => {
|
|
|
// return serviceAPI.get('guang/api/*/article/getArticlePre', {
|
|
|
// id: id
|
|
|
// }).then((result) => {
|
|
|
// if (result && result.code === 200) {
|
|
|
// console.log(result)
|
|
|
// return result;
|
|
|
// } else {
|
|
|
// logger.error('上一篇不是200');
|
|
|
// return {};
|
|
|
// }
|
|
|
// });
|
|
|
return serviceAPI.get('guang/api/*/article/getArticlePre', {
|
|
|
id: id
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
console.log(result);
|
|
|
return result;
|
|
|
} else {
|
|
|
logger.error('上一篇不是200');
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 资讯收藏
|
|
|
* @param uid
|
...
|
...
|
|