Authored by 张丽霞

sale 二期优先展示三张图

... ... @@ -151,25 +151,33 @@ exports.handleSaleBannerData = (origin) => {
exports.handleSaleBannerSmallData = (origin) => {
let dest = [];
let count = 0;
let hasThreePic = false;
_.forEach(origin, function(value) {
if (value.template_name === 'threePicture'){
hasThreePic = true;
}
});
console.log(hasThreePic);
_.forEach(origin, function(value) {
if (value.template_name === 'threePicture') {
_.forEach(value.data, function(picList) {
if (count++ < 3) {
console.log(count);
let smallPic = {
link: picList.url,
icon: picList.src,
title: picList.title,
desc: picList.alt
};
dest.push(smallPic);
}
});
}
if (count === 0) {
if (hasThreePic) {
if (value.template_name === 'threePicture') {
_.forEach(value.data, function(picList) {
if (count++ < 3) {
console.log(count);
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) {
... ...