...
|
...
|
@@ -86,6 +86,59 @@ const getNewReportFloorData = data => { |
|
|
return list;
|
|
|
};
|
|
|
|
|
|
//人气单品
|
|
|
const getSingleHotFloorData = data => {
|
|
|
let list = [];
|
|
|
|
|
|
_.forEach(data, (item, index) => {
|
|
|
let len = 10;
|
|
|
|
|
|
if (item.data.text === '人气单品') {
|
|
|
for (let i = 0; i < len; i ++) {
|
|
|
let pos = i;
|
|
|
let val = {};
|
|
|
let obj = {};
|
|
|
if (i == 1) {
|
|
|
val = data[index + 1].data[0]; // 第二个是大图
|
|
|
}
|
|
|
else if (i == len - 1) {
|
|
|
val = data[index + 1].data[1]; // 最后一个是大图
|
|
|
}
|
|
|
else {
|
|
|
if (pos > 1) { // 小图
|
|
|
pos = pos - 1;
|
|
|
}
|
|
|
val = data[index + 2].data[pos];
|
|
|
}
|
|
|
obj.href = val.url;
|
|
|
obj.img = val.src;
|
|
|
list.push(obj);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
return list;
|
|
|
};
|
|
|
|
|
|
const getadbannerData = data => {
|
|
|
let adbanner = [];
|
|
|
let temp = [];
|
|
|
let obj = {};
|
|
|
_.forEach(data, (item, index) => {
|
|
|
if(item.template_name === 'single_image'){
|
|
|
temp.push(item);
|
|
|
}
|
|
|
|
|
|
})
|
|
|
console.log(temp);
|
|
|
obj.href = temp[2].data[0].url;
|
|
|
obj.img = temp[2].data[0].src;
|
|
|
obj.name = temp[2].data[0].title;
|
|
|
|
|
|
adbanner.push(obj);
|
|
|
return adbanner;
|
|
|
|
|
|
}
|
|
|
|
|
|
const requestContent = (type) => {
|
|
|
let data = sign.apiSign({
|
|
|
/* eslint-disable */
|
...
|
...
|
@@ -124,6 +177,14 @@ exports.getContent = (type) => { |
|
|
name: '最新速报',
|
|
|
list: getNewReportFloorData(contentData.list)
|
|
|
};
|
|
|
|
|
|
data.singlehot = {
|
|
|
name: '人气单品',
|
|
|
imgHot: getSingleHotFloorData(contentData.list)
|
|
|
};
|
|
|
|
|
|
//广告
|
|
|
data.adbanner = getadbannerData(contentData.list);
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|