Authored by zhangxiaoru

editorial

... ... @@ -42,7 +42,7 @@ const _processListData = (list) => {
// key: index,
// brands: value
// });
});
listKey.sort();
... ... @@ -54,8 +54,9 @@ const _processListData = (list) => {
key: key,
brands: list.data.allList[key]
});
});
//console.log(listData)
});
// console.log(listData)
return listData;
};
... ...
... ... @@ -8,6 +8,7 @@
const editorialModel = require('../models/editorial');
const md5 = require('md5');
/**
* 资讯首页数据
* @param req
... ... @@ -115,7 +116,8 @@ const list = (req, res) => {
*/
const detail = (req, res, next) => {
let id = req.params.id;
let clientType = 'pc';
// let clientType = 'pc';
editorialModel.getDetailData(id).then((result) => {
res.display('detail', {
... ...
... ... @@ -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,12 +267,13 @@ 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,25 +303,22 @@ 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]);
});
}
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
... ...
... ... @@ -185,11 +185,11 @@ $('#comment-info').trigger('keyup');
if (tag === 0) {
$('.article-tag').hide();
}
if($('.collocation').find('.good-info').length === 0) {
if ($('.collocation').find('.good-info').length === 0) {
$('.related-collo').hide();
}
if($('.goods').find('.good-info').length === 0) {
if ($('.goods').find('.good-info').length === 0) {
$('.related-group').hide();
}
\ No newline at end of file
}
... ...
... ... @@ -105,7 +105,7 @@
.good-info {
width: 219px;
float: left;
margin:0 20px 15px 0;
margin: 0 20px 15px 0;
img {
width: 219px;
... ... @@ -118,8 +118,8 @@
height: 30px;
overflow: hidden;
display: block;
text-overflow:ellipsis;
white-space:nowrap
text-overflow: ellipsis;
white-space: nowrap;
}
.price {
... ...