Authored by lijing

合并名称相同奖品

... ... @@ -35,6 +35,18 @@ const activity = (params) => {
let bgUrl = '';
let prizesList = result[0].data.prizes;
let newPrizes = [];
let same = false;
let i = 0;
let x = 0;
let y = 0;
if (result) {
if (result[0] && result[0].data) {
resu = result[0].data;
... ... @@ -42,7 +54,39 @@ const activity = (params) => {
Object.assign(resu, {
bgUrl: bgUrl
});
}
// 合并名称相同奖项
prizesList.forEach((val, index) => {
if (newPrizes == '') {
newPrizes[0] = {
name: prizesList[0].name,
remark: prizesList[0].remark,
}
} else {
newPrizes.forEach((item, po) => {
if (prizesList[index].name == newPrizes[po].name) {
same = true;
x = index;
y = po;
}
});
if (same) {
newPrizes[y].remark = newPrizes[y].remark + '、' + prizesList[x].remark;
same = false;
} else {
i ++;
newPrizes[i] = {
name: prizesList[index].name,
remark: prizesList[index].remark,
};
same = false;
}
}
});
resu.prizes = newPrizes;
}
if (result[1] && result[1].data) {
mobile = result[1].data.mobile;
Object.assign(resu, {
... ...