Showing
2 changed files
with
46 additions
and
29 deletions
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | */ | 5 | */ |
6 | 'use strict'; | 6 | 'use strict'; |
7 | const serviceAPI = global.yoho.ServiceAPI; | 7 | const serviceAPI = global.yoho.ServiceAPI; |
8 | +const api = global.yoho.API; | ||
8 | const logger = global.yoho.logger; | 9 | const logger = global.yoho.logger; |
9 | const helpers = global.yoho.helpers; | 10 | const helpers = global.yoho.helpers; |
10 | const guangProcess = require(`${global.utils}/guang-process`); | 11 | const guangProcess = require(`${global.utils}/guang-process`); |
@@ -167,10 +168,13 @@ const getArticle = (param) => { | @@ -167,10 +168,13 @@ const getArticle = (param) => { | ||
167 | _article(param) | 168 | _article(param) |
168 | ]).then(result => { | 169 | ]).then(result => { |
169 | 170 | ||
171 | + let type = param.type; | ||
172 | + | ||
170 | let resu = { | 173 | let resu = { |
171 | guang: { | 174 | guang: { |
172 | infos: [{ | 175 | infos: [{ |
173 | show: true, | 176 | show: true, |
177 | + swiper: [], | ||
174 | info: [{ | 178 | info: [{ |
175 | 'article_type': '1', | 179 | 'article_type': '1', |
176 | author: { | 180 | author: { |
@@ -195,40 +199,54 @@ const getArticle = (param) => { | @@ -195,40 +199,54 @@ const getArticle = (param) => { | ||
195 | 'url': 'http://guang.m.yohobuy.com/info/index?id=34380' | 199 | 'url': 'http://guang.m.yohobuy.com/info/index?id=34380' |
196 | }, | 200 | }, |
197 | img: 'https://img13.static.yhbimg.com/article/2016/09/05/14/02d732942cdd9647465736cb79796b0ddd.jpg?imageView/2/w/640/h/640', | 201 | img: 'https://img13.static.yhbimg.com/article/2016/09/05/14/02d732942cdd9647465736cb79796b0ddd.jpg?imageView/2/w/640/h/640', |
198 | - 'title': '验证逛文章图片压缩测试', | 202 | + title: '11验证逛文章图片压缩测试', |
199 | 'url': 'http://guang.m.yohobuy.com/info/index?id=34380', | 203 | 'url': 'http://guang.m.yohobuy.com/info/index?id=34380', |
200 | pageView: '50' | 204 | pageView: '50' |
201 | }] | 205 | }] |
202 | }], | 206 | }], |
203 | - navs: [{ | ||
204 | - typeId: '0', | ||
205 | - type: '推荐', | ||
206 | - focus: true | ||
207 | - }, { | ||
208 | - typeId: '1', | ||
209 | - type: '话题' | ||
210 | - }, { | ||
211 | - typeId: '2', | ||
212 | - type: '搭配' | ||
213 | - }, { | ||
214 | - typeId: '3', | ||
215 | - type: '潮人' | ||
216 | - }, { | ||
217 | - typeId: '4', | ||
218 | - type: '潮品' | ||
219 | - }, { | ||
220 | - typeId: '19', | ||
221 | - type: '专题' | ||
222 | - }], | ||
223 | - swiper: [{ | ||
224 | - img: 'https://img11.static.yhbimg.com/yhb-img01/2016/09/01/10/017b5ce31285f9062469303ba9ca197660.jpg?imageView2/2/w/830/h/327', | ||
225 | - url: 'http://feature.yoho.cn/0418RUNNINGMAN/index.html?title=兄弟在奔跑,潮流在有货&share_id=944' | ||
226 | - }, { | ||
227 | - img: 'https://img11.static.yhbimg.com/yhb-img01/2016/09/01/10/017b5ce31285f9062469303ba9ca197660.jpg?imageView2/2/w/830/h/327', | ||
228 | - url: 'http://feature.yoho.cn/0418RUNNINGMAN/index.html?title=兄弟在奔跑,潮流在有货&share_id=944' | ||
229 | - }] | 207 | + navs: [], |
208 | + swiper: true | ||
230 | } | 209 | } |
231 | }; | 210 | }; |
211 | + | ||
212 | + if (result[0] && result[0].data) { | ||
213 | + | ||
214 | + let nav = []; | ||
215 | + | ||
216 | + let navList = result[0].data; | ||
217 | + | ||
218 | + navList.forEach(na => { | ||
219 | + nav.push({ | ||
220 | + typeId: na.id, | ||
221 | + type: na.name, | ||
222 | + focus: (na.id == type) | ||
223 | + }); | ||
224 | + }); | ||
225 | + | ||
226 | + resu.guang.navs = nav; | ||
227 | + | ||
228 | + // Object.assign(resu, [resu.guang.navs]); | ||
229 | + } | ||
230 | + | ||
231 | + if (result[1] && result[1].data) { | ||
232 | + | ||
233 | + let swp = []; | ||
234 | + | ||
235 | + let swiperList = result[1].data.list.adlist; | ||
236 | + | ||
237 | + | ||
238 | + swiperList.forEach(sw => { | ||
239 | + swp.push({ | ||
240 | + img: sw.src, | ||
241 | + url: sw.url | ||
242 | + }); | ||
243 | + }); | ||
244 | + | ||
245 | + resu.guang.infos.swiper = swp; | ||
246 | + | ||
247 | + console.log(resu.guang.infos.swiper); | ||
248 | + } | ||
249 | + | ||
232 | return resu; | 250 | return resu; |
233 | }); | 251 | }); |
234 | 252 |
-
Please register or login to post a comment