修改礼物名称返回问题

This commit is contained in:
liaozetao
2024-04-19 11:25:11 +08:00
parent 69dc83b72b
commit c0e6eb60a2
8 changed files with 51 additions and 9 deletions

View File

@@ -627,9 +627,14 @@ export default {
if (res.code == 200) { if (res.code == 200) {
//console.log(res); //console.log(res);
for (var i = 0; i < res.data.length; i++) { for (var i = 0; i < res.data.length; i++) {
let item = res.data[i];
let giftName = item.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
item.giftName = JSON.parse(giftName).zh;
}
// id对象存储 // id对象存储
var id = '' + res.data[i].giftId; var id = '' + item.giftId;
giftMap[id] = res.data[i]; giftMap[id] = item;
} }
renderAwardOption() renderAwardOption()
} }

View File

@@ -124,7 +124,13 @@ export default {
var arr = []; var arr = [];
arr = res.data; arr = res.data;
arr.unshift({ giftId: null, giftName: "全部" }); arr.unshift({ giftId: null, giftName: "全部" });
this.inquire.gifts = arr; this.inquire.gifts = arr.map(v => {
let giftName = v.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
v.giftName = JSON.parse(giftName).zh;
}
return v;
});
this.inquire.giftId = arr[0].giftId; this.inquire.giftId = arr[0].giftId;
}); });
this.getData(); this.getData();

View File

@@ -310,6 +310,10 @@ export default {
"#giftId", "#giftId",
data[0].giftId, data[0].giftId,
data.map((v) => { data.map((v) => {
let giftName = v.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
v.giftName = JSON.parse(giftName).zh;
}
return { return {
value: v.giftId, value: v.giftId,
text: v.giftName, text: v.giftName,

View File

@@ -336,7 +336,13 @@ export default {
type: "warning", type: "warning",
}); });
getAll({ giftType: 2 }).then((res) => { getAll({ giftType: 2 }).then((res) => {
this.dialog.gifts2 = res.data; this.dialog.gifts2 = res.data.map(v => {
let giftName = v.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
v.giftName = JSON.parse(giftName).zh;
}
return v;
});
ElMessage({ ElMessage({
showClose: true, showClose: true,
message: "加载完成", message: "加载完成",

View File

@@ -590,9 +590,14 @@ export default {
if (res.code == 200) { if (res.code == 200) {
//console.log(res); //console.log(res);
for (var i = 0; i < res.data.length; i++) { for (var i = 0; i < res.data.length; i++) {
let item = res.data[i];
let giftName = item.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
item.giftName = JSON.parse(giftName).zh;
}
// id对象存储 // id对象存储
var id = '' + res.data[i].giftId; var id = '' + item.giftId;
giftMap[id] = res.data[i]; giftMap[id] = item;
} }
renderAwardOption() renderAwardOption()
} }

View File

@@ -1081,7 +1081,11 @@ export default {
$("#modal_defaultGift").val(''); $("#modal_defaultGift").val('');
$('#addLuckyBagPoolModal').find('input').val(''); $('#addLuckyBagPoolModal').find('input').val('');
$('#addLuckyBagPoolModal').find('textarea').val(''); $('#addLuckyBagPoolModal').find('textarea').val('');
$('#modal_giftName').val(luckyBag.giftName); let giftName = luckyBag.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
giftName = JSON.parse(giftName).zh;
}
$('#modal_giftName').val(giftName);
$('#addLuckyBagPoolModal').modal('show'); $('#addLuckyBagPoolModal').modal('show');
}); });

View File

@@ -113,7 +113,13 @@ function setSelectOption() {
success: function (res) { success: function (res) {
if (res.code == 200) { if (res.code == 200) {
var data = res.data; var data = res.data;
makeOption(data); makeOption(data.map(v => {
let giftName = v.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
v.giftName = JSON.parse(giftName).zh;
}
return v;
}));
} }
} }
}) })

View File

@@ -409,7 +409,13 @@ export default {
giftType: 2, giftType: 2,
// @ts-ignore // @ts-ignore
}).then((res) => { }).then((res) => {
this.giftOptions = res.data; this.giftOptions = res.data.map(v => {
let giftName = v.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
v.giftName = JSON.parse(giftName).zh;
}
return v;
});
}); });
}, },
methods: { methods: {