|
@@ -172,79 +172,85 @@ const getArticle = (param) => { |
|
@@ -172,79 +172,85 @@ const getArticle = (param) => { |
172
|
|
172
|
|
173
|
let resu = {
|
173
|
let resu = {
|
174
|
guang: {
|
174
|
guang: {
|
175
|
- infos: [{
|
|
|
176
|
- show: true,
|
|
|
177
|
- swiper: [],
|
|
|
178
|
- info: [{
|
|
|
179
|
- 'article_type': '1',
|
|
|
180
|
- author: {
|
|
|
181
|
- author_id: '8168296',
|
|
|
182
|
- avatar: 'http://img10.static.yhbimg.com/author/2016/05/07/15/01bb3ae789c573502830726c3297d0c80a.png',
|
|
|
183
|
- name: '雾萌萌',
|
|
|
184
|
- url: 'http://guang.m.yohobuy.com/author/index?id=8168296'
|
|
|
185
|
- },
|
|
|
186
|
- 'author_id': '8168296',
|
|
|
187
|
- 'category_id': '1',
|
|
|
188
|
- 'category_name': '话题',
|
|
|
189
|
- 'conver_image_type': '1',
|
|
|
190
|
- 'id': 34380,
|
|
|
191
|
- text: '验证逛文章图片压缩测试验证逛文章图片压缩测试验证逛文章图片压缩测试',
|
|
|
192
|
- 'isFavor': 'N',
|
|
|
193
|
- 'isPraise': 'N',
|
|
|
194
|
- 'is_recommended': '1',
|
|
|
195
|
- 'praiseStatus': 'true',
|
|
|
196
|
- 'praise_num': '0',
|
|
|
197
|
- publishTime: '09月02日 19:21',
|
|
|
198
|
- 'share': {
|
|
|
199
|
- 'url': 'http://guang.m.yohobuy.com/info/index?id=34380'
|
|
|
200
|
- },
|
|
|
201
|
- img: 'https://img13.static.yhbimg.com/article/2016/09/05/14/02d732942cdd9647465736cb79796b0ddd.jpg?imageView/2/w/640/h/640',
|
|
|
202
|
- title: '11验证逛文章图片压缩测试',
|
|
|
203
|
- 'url': 'http://guang.m.yohobuy.com/info/index?id=34380',
|
|
|
204
|
- pageView: '50'
|
|
|
205
|
- }]
|
|
|
206
|
- }],
|
|
|
207
|
- navs: [],
|
|
|
208
|
swiper: true
|
175
|
swiper: true
|
209
|
}
|
176
|
}
|
210
|
};
|
177
|
};
|
211
|
|
178
|
|
|
|
179
|
+
|
|
|
180
|
+ // 顶部的分类列表
|
|
|
181
|
+ let curIndex = 0;// 当前tab顺序
|
|
|
182
|
+
|
|
|
183
|
+ let indexTmp = 0;
|
|
|
184
|
+
|
212
|
if (result[0] && result[0].data) {
|
185
|
if (result[0] && result[0].data) {
|
213
|
|
186
|
|
214
|
- let nav = [];
|
187
|
+ indexTmp = 0;
|
|
|
188
|
+
|
|
|
189
|
+ let cateList = result[0].data;
|
|
|
190
|
+
|
|
|
191
|
+ let build = [];
|
215
|
|
192
|
|
216
|
- let navList = result[0].data;
|
193
|
+ let inf = [];
|
217
|
|
194
|
|
218
|
- navList.forEach(na => {
|
|
|
219
|
- nav.push({
|
|
|
220
|
- typeId: na.id,
|
|
|
221
|
- type: na.name,
|
|
|
222
|
- focus: (na.id == type)
|
195
|
+ cateList.forEach(val => {
|
|
|
196
|
+ build.push({
|
|
|
197
|
+ typeId: val.id,
|
|
|
198
|
+ type: val.name,
|
|
|
199
|
+ focus: (val.id == type)
|
223
|
});
|
200
|
});
|
|
|
201
|
+
|
|
|
202
|
+ inf.push({
|
|
|
203
|
+ show: (val.id == type),
|
|
|
204
|
+ typeId: type,
|
|
|
205
|
+ info: []
|
224
|
});
|
206
|
});
|
225
|
|
207
|
|
226
|
- resu.guang.navs = nav;
|
208
|
+ if ((val.id == type)) {
|
|
|
209
|
+ curIndex = indexTmp;
|
|
|
210
|
+ }
|
|
|
211
|
+
|
|
|
212
|
+ indexTmp++;
|
|
|
213
|
+
|
|
|
214
|
+ resu.guang.navs = build;
|
|
|
215
|
+
|
|
|
216
|
+ resu.guang.infos = inf;
|
|
|
217
|
+
|
|
|
218
|
+ });
|
227
|
|
219
|
|
228
|
- // Object.assign(resu, [resu.guang.navs]);
|
|
|
229
|
}
|
220
|
}
|
230
|
|
221
|
|
231
|
- if (result[1] && result[1].data) {
|
222
|
+ if (result[1].data.list.adlist) {
|
232
|
|
223
|
|
233
|
let swp = [];
|
224
|
let swp = [];
|
234
|
|
225
|
|
235
|
let swiperList = result[1].data.list.adlist;
|
226
|
let swiperList = result[1].data.list.adlist;
|
236
|
|
227
|
|
237
|
|
228
|
|
238
|
- swiperList.forEach(sw => {
|
229
|
+ swiperList.forEach(val => {
|
239
|
swp.push({
|
230
|
swp.push({
|
240
|
- img: sw.src,
|
|
|
241
|
- url: sw.url
|
231
|
+ url: guangProcess.getFilterUrl(val.url),
|
|
|
232
|
+ img: helpers.image(val.src, 640, 275)
|
|
|
233
|
+ });
|
242
|
});
|
234
|
});
|
|
|
235
|
+
|
|
|
236
|
+ resu.guang.swiper = swp;
|
|
|
237
|
+
|
|
|
238
|
+ // console.log(resu);
|
|
|
239
|
+
|
|
|
240
|
+ }
|
|
|
241
|
+
|
|
|
242
|
+ if (result[1].data.list.artList) {
|
|
|
243
|
+
|
|
|
244
|
+ let inf = [];
|
|
|
245
|
+
|
|
|
246
|
+ let infoList = result[1].data.list.artList;
|
|
|
247
|
+
|
|
|
248
|
+ infoList.forEach(val => {
|
|
|
249
|
+ inf.push(guangProcess.formatArticle(val, true, false, true));
|
243
|
});
|
250
|
});
|
244
|
|
251
|
|
245
|
- resu.guang.infos.swiper = swp;
|
252
|
+ resu.guang.infos[curIndex].info = inf;
|
246
|
|
253
|
|
247
|
- console.log(resu.guang.infos.swiper);
|
|
|
248
|
}
|
254
|
}
|
249
|
|
255
|
|
250
|
return resu;
|
256
|
return resu;
|
|
@@ -252,9 +258,108 @@ const getArticle = (param) => { |
|
@@ -252,9 +258,108 @@ const getArticle = (param) => { |
252
|
|
258
|
|
253
|
};
|
259
|
};
|
254
|
|
260
|
|
|
|
261
|
+/**
|
|
|
262
|
+ * 逛
|
|
|
263
|
+ * @param params
|
|
|
264
|
+ */
|
|
|
265
|
+const getArticleGroup = (param) => {
|
|
|
266
|
+
|
|
|
267
|
+ let page = param.page ? param.page : 1;
|
|
|
268
|
+
|
|
|
269
|
+ Object.assign(param, { page: page });
|
|
|
270
|
+
|
|
|
271
|
+ return api.all([
|
|
|
272
|
+ _category(),
|
|
|
273
|
+ _article(param)
|
|
|
274
|
+ ]).then(result => {
|
|
|
275
|
+
|
|
|
276
|
+ let type = param.type;
|
|
|
277
|
+
|
|
|
278
|
+ let resu = {
|
|
|
279
|
+ guang: {
|
|
|
280
|
+ swiper: true
|
|
|
281
|
+ }
|
|
|
282
|
+ };
|
|
|
283
|
+
|
|
|
284
|
+ if (result[0] && result[0].data) {
|
|
|
285
|
+
|
|
|
286
|
+ let cateList = result[0].data;
|
|
|
287
|
+
|
|
|
288
|
+ let build = [];
|
|
|
289
|
+
|
|
|
290
|
+ let inf = [];
|
|
|
291
|
+
|
|
|
292
|
+ cateList.forEach(val => {
|
|
|
293
|
+ build.push({
|
|
|
294
|
+ typeId: val.id,
|
|
|
295
|
+ type: val.name,
|
|
|
296
|
+ focus: (val.id == type)
|
|
|
297
|
+ });
|
|
|
298
|
+
|
|
|
299
|
+ inf.push({
|
|
|
300
|
+ show: (val.id == type),
|
|
|
301
|
+ typeId: type,
|
|
|
302
|
+ info: []
|
|
|
303
|
+ });
|
|
|
304
|
+
|
|
|
305
|
+ if ((val.id == type)) {
|
|
|
306
|
+ curIndex = indexTmp;
|
|
|
307
|
+ }
|
|
|
308
|
+
|
|
|
309
|
+ indexTmp++;
|
|
|
310
|
+
|
|
|
311
|
+ resu.guang.navs = build;
|
|
|
312
|
+
|
|
|
313
|
+ resu.guang.infos = inf;
|
|
|
314
|
+
|
|
|
315
|
+ });
|
|
|
316
|
+
|
|
|
317
|
+ }
|
|
|
318
|
+
|
|
|
319
|
+ if (result[1].data.list.adlist) {
|
|
|
320
|
+
|
|
|
321
|
+ let swp = [];
|
|
|
322
|
+
|
|
|
323
|
+ let swiperList = result[1].data.list.adlist;
|
|
|
324
|
+
|
|
|
325
|
+
|
|
|
326
|
+ swiperList.forEach(val => {
|
|
|
327
|
+ swp.push({
|
|
|
328
|
+ url: guangProcess.getFilterUrl(val.url),
|
|
|
329
|
+ img: helpers.image(val.src, 640, 275)
|
|
|
330
|
+ });
|
|
|
331
|
+ });
|
|
|
332
|
+
|
|
|
333
|
+ resu.guang.swiper = swp;
|
|
|
334
|
+
|
|
|
335
|
+ // console.log(resu);
|
|
|
336
|
+
|
|
|
337
|
+ }
|
|
|
338
|
+
|
|
|
339
|
+ if (result[1].data.list.artList) {
|
|
|
340
|
+
|
|
|
341
|
+ let inf = [];
|
|
|
342
|
+
|
|
|
343
|
+ let infoList = result[1].data.list.artList;
|
|
|
344
|
+
|
|
|
345
|
+ infoList.forEach(val => {
|
|
|
346
|
+ inf.push(guangProcess.formatArticle(val, true, false, true));
|
|
|
347
|
+ });
|
|
|
348
|
+
|
|
|
349
|
+ resu.guang.infos[curIndex].info = inf;
|
|
|
350
|
+
|
|
|
351
|
+ }
|
|
|
352
|
+
|
|
|
353
|
+ return resu;
|
|
|
354
|
+ });
|
|
|
355
|
+
|
|
|
356
|
+};
|
|
|
357
|
+
|
|
|
358
|
+
|
255
|
module.exports = {
|
359
|
module.exports = {
|
256
|
getAuthor: _getAuthor,
|
360
|
getAuthor: _getAuthor,
|
257
|
getArticleList: _getArticleList,
|
361
|
getArticleList: _getArticleList,
|
258
|
getPageData: _getPageData,
|
362
|
getPageData: _getPageData,
|
259
|
- getArticle
|
363
|
+ getArticle,
|
|
|
364
|
+ getArticleGroup
|
260
|
}; |
365
|
}; |