|
@@ -86,6 +86,59 @@ const getNewReportFloorData = data => { |
|
@@ -86,6 +86,59 @@ const getNewReportFloorData = data => { |
86
|
return list;
|
86
|
return list;
|
87
|
};
|
87
|
};
|
88
|
|
88
|
|
|
|
89
|
+//人气单品
|
|
|
90
|
+const getSingleHotFloorData = data => {
|
|
|
91
|
+ let list = [];
|
|
|
92
|
+
|
|
|
93
|
+ _.forEach(data, (item, index) => {
|
|
|
94
|
+ let len = 10;
|
|
|
95
|
+
|
|
|
96
|
+ if (item.data.text === '人气单品') {
|
|
|
97
|
+ for (let i = 0; i < len; i ++) {
|
|
|
98
|
+ let pos = i;
|
|
|
99
|
+ let val = {};
|
|
|
100
|
+ let obj = {};
|
|
|
101
|
+ if (i == 1) {
|
|
|
102
|
+ val = data[index + 1].data[0]; // 第二个是大图
|
|
|
103
|
+ }
|
|
|
104
|
+ else if (i == len - 1) {
|
|
|
105
|
+ val = data[index + 1].data[1]; // 最后一个是大图
|
|
|
106
|
+ }
|
|
|
107
|
+ else {
|
|
|
108
|
+ if (pos > 1) { // 小图
|
|
|
109
|
+ pos = pos - 1;
|
|
|
110
|
+ }
|
|
|
111
|
+ val = data[index + 2].data[pos];
|
|
|
112
|
+ }
|
|
|
113
|
+ obj.href = val.url;
|
|
|
114
|
+ obj.img = val.src;
|
|
|
115
|
+ list.push(obj);
|
|
|
116
|
+ }
|
|
|
117
|
+ }
|
|
|
118
|
+ });
|
|
|
119
|
+ return list;
|
|
|
120
|
+};
|
|
|
121
|
+
|
|
|
122
|
+const getadbannerData = data => {
|
|
|
123
|
+ let adbanner = [];
|
|
|
124
|
+ let temp = [];
|
|
|
125
|
+ let obj = {};
|
|
|
126
|
+ _.forEach(data, (item, index) => {
|
|
|
127
|
+ if(item.template_name === 'single_image'){
|
|
|
128
|
+ temp.push(item);
|
|
|
129
|
+ }
|
|
|
130
|
+
|
|
|
131
|
+ })
|
|
|
132
|
+ console.log(temp);
|
|
|
133
|
+ obj.href = temp[2].data[0].url;
|
|
|
134
|
+ obj.img = temp[2].data[0].src;
|
|
|
135
|
+ obj.name = temp[2].data[0].title;
|
|
|
136
|
+
|
|
|
137
|
+ adbanner.push(obj);
|
|
|
138
|
+ return adbanner;
|
|
|
139
|
+
|
|
|
140
|
+}
|
|
|
141
|
+
|
89
|
const requestContent = (type) => {
|
142
|
const requestContent = (type) => {
|
90
|
let data = sign.apiSign({
|
143
|
let data = sign.apiSign({
|
91
|
/* eslint-disable */
|
144
|
/* eslint-disable */
|
|
@@ -124,6 +177,14 @@ exports.getContent = (type) => { |
|
@@ -124,6 +177,14 @@ exports.getContent = (type) => { |
124
|
name: '最新速报',
|
177
|
name: '最新速报',
|
125
|
list: getNewReportFloorData(contentData.list)
|
178
|
list: getNewReportFloorData(contentData.list)
|
126
|
};
|
179
|
};
|
|
|
180
|
+
|
|
|
181
|
+ data.singlehot = {
|
|
|
182
|
+ name: '人气单品',
|
|
|
183
|
+ imgHot: getSingleHotFloorData(contentData.list)
|
|
|
184
|
+ };
|
|
|
185
|
+
|
|
|
186
|
+ //广告
|
|
|
187
|
+ data.adbanner = getadbannerData(contentData.list);
|
127
|
|
188
|
|
128
|
|
189
|
|
129
|
|
190
|
|