...
|
...
|
@@ -144,30 +144,55 @@ exports.handleSaleBannerData = (origin) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 处理首页 banner 小图 只取前三张
|
|
|
* 处理首页 banner 小图 threePicture楼层和small_pic楼层都去一遍,产品确认只会有一个接口有数据
|
|
|
* @param origin 要处理的原始数据
|
|
|
* @returns {Array}
|
|
|
*/
|
|
|
exports.handleSaleBannerSmallData = (origin) => {
|
|
|
let dest = [];
|
|
|
let count = 0;
|
|
|
let hasThreePic = false;
|
|
|
|
|
|
_.forEach(origin, function(value) {
|
|
|
if (value.template_name === 'threePicture') {
|
|
|
_.forEach(value.data, function(picList) {
|
|
|
if (count++ < 3) {
|
|
|
let smallPic = {
|
|
|
link: picList.url,
|
|
|
icon: picList.src,
|
|
|
title: picList.title,
|
|
|
desc: picList.alt
|
|
|
};
|
|
|
|
|
|
dest.push(smallPic);
|
|
|
}
|
|
|
});
|
|
|
hasThreePic = true;
|
|
|
}
|
|
|
});
|
|
|
_.forEach(origin, function(value) {
|
|
|
|
|
|
if (hasThreePic) {
|
|
|
if (value.template_name === 'threePicture') {
|
|
|
_.forEach(value.data, function(picList) {
|
|
|
if (count++ < 3) {
|
|
|
let smallPic = {
|
|
|
link: picList.url,
|
|
|
icon: picList.src,
|
|
|
title: picList.title,
|
|
|
desc: picList.alt
|
|
|
};
|
|
|
|
|
|
dest.push(smallPic);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
if (value.template_name === 'small_pic') {
|
|
|
_.forEach(value.data, function(picList) {
|
|
|
if (count++ < 4) {
|
|
|
let smallPic = {
|
|
|
link: picList.url,
|
|
|
icon: picList.src,
|
|
|
title: picList.title,
|
|
|
desc: picList.alt
|
|
|
};
|
|
|
|
|
|
dest.push(smallPic);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
return dest;
|
|
|
};
|
...
|
...
|
|