...
|
...
|
@@ -172,79 +172,182 @@ const getArticle = (param) => { |
|
|
|
|
|
let resu = {
|
|
|
guang: {
|
|
|
infos: [{
|
|
|
show: true,
|
|
|
swiper: [],
|
|
|
info: [{
|
|
|
'article_type': '1',
|
|
|
author: {
|
|
|
author_id: '8168296',
|
|
|
avatar: 'http://img10.static.yhbimg.com/author/2016/05/07/15/01bb3ae789c573502830726c3297d0c80a.png',
|
|
|
name: '雾萌萌',
|
|
|
url: 'http://guang.m.yohobuy.com/author/index?id=8168296'
|
|
|
},
|
|
|
'author_id': '8168296',
|
|
|
'category_id': '1',
|
|
|
'category_name': '话题',
|
|
|
'conver_image_type': '1',
|
|
|
'id': 34380,
|
|
|
text: '验证逛文章图片压缩测试验证逛文章图片压缩测试验证逛文章图片压缩测试',
|
|
|
'isFavor': 'N',
|
|
|
'isPraise': 'N',
|
|
|
'is_recommended': '1',
|
|
|
'praiseStatus': 'true',
|
|
|
'praise_num': '0',
|
|
|
publishTime: '09月02日 19:21',
|
|
|
'share': {
|
|
|
'url': 'http://guang.m.yohobuy.com/info/index?id=34380'
|
|
|
},
|
|
|
img: 'https://img13.static.yhbimg.com/article/2016/09/05/14/02d732942cdd9647465736cb79796b0ddd.jpg?imageView/2/w/640/h/640',
|
|
|
title: '11验证逛文章图片压缩测试',
|
|
|
'url': 'http://guang.m.yohobuy.com/info/index?id=34380',
|
|
|
pageView: '50'
|
|
|
}]
|
|
|
}],
|
|
|
navs: [],
|
|
|
swiper: true
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
// 顶部的分类列表
|
|
|
let curIndex = 0;// 当前tab顺序
|
|
|
|
|
|
let indexTmp = 0;
|
|
|
|
|
|
if (result[0] && result[0].data) {
|
|
|
|
|
|
let nav = [];
|
|
|
indexTmp = 0;
|
|
|
|
|
|
let cateList = result[0].data;
|
|
|
|
|
|
let build = [];
|
|
|
|
|
|
let inf = [];
|
|
|
|
|
|
cateList.forEach(val => {
|
|
|
build.push({
|
|
|
typeId: val.id,
|
|
|
type: val.name,
|
|
|
focus: (val.id == type)
|
|
|
});
|
|
|
|
|
|
inf.push({
|
|
|
show: (val.id == type),
|
|
|
typeId: type,
|
|
|
info: []
|
|
|
});
|
|
|
|
|
|
if ((val.id == type)) {
|
|
|
curIndex = indexTmp;
|
|
|
}
|
|
|
|
|
|
indexTmp++;
|
|
|
|
|
|
resu.guang.navs = build;
|
|
|
|
|
|
resu.guang.infos = inf;
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result[1].data.list.adlist) {
|
|
|
|
|
|
let swp = [];
|
|
|
|
|
|
let swiperList = result[1].data.list.adlist;
|
|
|
|
|
|
let navList = result[0].data;
|
|
|
|
|
|
navList.forEach(na => {
|
|
|
nav.push({
|
|
|
typeId: na.id,
|
|
|
type: na.name,
|
|
|
focus: (na.id == type)
|
|
|
swiperList.forEach(val => {
|
|
|
swp.push({
|
|
|
url: guangProcess.getFilterUrl(val.url),
|
|
|
img: helpers.image(val.src, 640, 275)
|
|
|
});
|
|
|
});
|
|
|
|
|
|
resu.guang.navs = nav;
|
|
|
resu.guang.swiper = swp;
|
|
|
|
|
|
// console.log(resu);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result[1].data.list.artList) {
|
|
|
|
|
|
let inf = [];
|
|
|
|
|
|
let infoList = result[1].data.list.artList;
|
|
|
|
|
|
infoList.forEach(val => {
|
|
|
inf.push(guangProcess.formatArticle(val, true, false, true));
|
|
|
});
|
|
|
|
|
|
resu.guang.infos[curIndex].info = inf;
|
|
|
|
|
|
// Object.assign(resu, [resu.guang.navs]);
|
|
|
}
|
|
|
|
|
|
if (result[1] && result[1].data) {
|
|
|
return resu;
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 逛
|
|
|
* @param params
|
|
|
*/
|
|
|
const getArticleGroup = (param) => {
|
|
|
|
|
|
let page = param.page ? param.page : 1;
|
|
|
|
|
|
Object.assign(param, { page: page });
|
|
|
|
|
|
return api.all([
|
|
|
_category(),
|
|
|
_article(param)
|
|
|
]).then(result => {
|
|
|
|
|
|
let type = param.type;
|
|
|
|
|
|
let resu = {
|
|
|
guang: {
|
|
|
swiper: true
|
|
|
}
|
|
|
};
|
|
|
|
|
|
if (result[0] && result[0].data) {
|
|
|
|
|
|
let cateList = result[0].data;
|
|
|
|
|
|
let build = [];
|
|
|
|
|
|
let inf = [];
|
|
|
|
|
|
cateList.forEach(val => {
|
|
|
build.push({
|
|
|
typeId: val.id,
|
|
|
type: val.name,
|
|
|
focus: (val.id == type)
|
|
|
});
|
|
|
|
|
|
inf.push({
|
|
|
show: (val.id == type),
|
|
|
typeId: type,
|
|
|
info: []
|
|
|
});
|
|
|
|
|
|
if ((val.id == type)) {
|
|
|
curIndex = indexTmp;
|
|
|
}
|
|
|
|
|
|
indexTmp++;
|
|
|
|
|
|
resu.guang.navs = build;
|
|
|
|
|
|
resu.guang.infos = inf;
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result[1].data.list.adlist) {
|
|
|
|
|
|
let swp = [];
|
|
|
|
|
|
let swiperList = result[1].data.list.adlist;
|
|
|
|
|
|
|
|
|
swiperList.forEach(sw => {
|
|
|
swiperList.forEach(val => {
|
|
|
swp.push({
|
|
|
img: sw.src,
|
|
|
url: sw.url
|
|
|
url: guangProcess.getFilterUrl(val.url),
|
|
|
img: helpers.image(val.src, 640, 275)
|
|
|
});
|
|
|
});
|
|
|
|
|
|
resu.guang.infos.swiper = swp;
|
|
|
resu.guang.swiper = swp;
|
|
|
|
|
|
// console.log(resu);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result[1].data.list.artList) {
|
|
|
|
|
|
let inf = [];
|
|
|
|
|
|
let infoList = result[1].data.list.artList;
|
|
|
|
|
|
infoList.forEach(val => {
|
|
|
inf.push(guangProcess.formatArticle(val, true, false, true));
|
|
|
});
|
|
|
|
|
|
resu.guang.infos[curIndex].info = inf;
|
|
|
|
|
|
console.log(resu.guang.infos.swiper);
|
|
|
}
|
|
|
|
|
|
return resu;
|
...
|
...
|
@@ -252,9 +355,11 @@ const getArticle = (param) => { |
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
getAuthor: _getAuthor,
|
|
|
getArticleList: _getArticleList,
|
|
|
getPageData: _getPageData,
|
|
|
getArticle
|
|
|
getArticle,
|
|
|
getArticleGroup
|
|
|
}; |
...
|
...
|
|