|
|
@@ -438,22 +438,24 @@
|
|
|
// 处理数据逻辑
|
|
|
that.totalDetail.splice(idx, 0, this.prizeJson);
|
|
|
that.saveData.index = idx;
|
|
|
-
|
|
|
- for (let i = 0; i < that.totalDetail.length; i++) {
|
|
|
- that.saveData['card' + i] = that.totalDetail[i];
|
|
|
-
|
|
|
- that.cards[i].prizeType = that.totalDetail[i].prize_type == undefined ?
|
|
|
- that.totalDetail[i].prizeType :
|
|
|
- that.totalDetail[i].prize_type;
|
|
|
- that.cards[i].img = that.totalDetail[i].img;
|
|
|
-
|
|
|
- that.cards[i].price = that.totalDetail[i].price;
|
|
|
- that.cards[i].money = that.totalDetail[i].money;
|
|
|
- that.cards[i].point = that.totalDetail[i].point;
|
|
|
- that.cards[i].prizeName = that.totalDetail[i].prizeName == undefined ?
|
|
|
- that.totalDetail[i].prize_name :
|
|
|
- that.totalDetail[i].prizeName;
|
|
|
- }
|
|
|
+// 修改这段代码,添加数组长度检查
|
|
|
+ for (let i = 0; i < that.totalDetail.length; i++) {
|
|
|
+ // 确保 cards 数组在索引 i 处有元素
|
|
|
+ if (that.cards[i]) {
|
|
|
+ that.saveData['card' + i] = that.totalDetail[i];
|
|
|
+
|
|
|
+ that.cards[i].prizeType = that.totalDetail[i].prize_type == undefined ?
|
|
|
+ that.totalDetail[i].prizeType :
|
|
|
+ that.totalDetail[i].prize_type;
|
|
|
+ that.cards[i].img = that.totalDetail[i].img;
|
|
|
+ that.cards[i].price = that.totalDetail[i].price;
|
|
|
+ that.cards[i].money = that.totalDetail[i].money;
|
|
|
+ that.cards[i].point = that.totalDetail[i].point;
|
|
|
+ that.cards[i].prizeName = that.totalDetail[i].prizeName == undefined ?
|
|
|
+ that.totalDetail[i].prize_name :
|
|
|
+ that.totalDetail[i].prizeName;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
that.saveAllCardData();
|
|
|
}, 100);
|