fixbug:修改抽奖停留位置不对

This commit is contained in:
2025-08-15 20:52:56 +08:00
parent b5425c30e8
commit 0399791e8f
4 changed files with 61 additions and 62 deletions
+4 -23
View File
@@ -11,8 +11,8 @@
<!-- 九宫格抽奖组件 -->
<LotteryGrid :prizesObj="prizesObj" :is-disabled="isRotating" @start="handleStartLottery"
@complete="handleLotteryComplete" :targetIndex="targetIndex" />
<LotteryGrid :prizesObj="prizesObj" :remainCount="prizesObj.times" :is-disabled="isRotating"
@start="handleStartLottery" @complete="handleLotteryComplete" :targetIndex="targetIndex" />
<!-- 规则 -->
<view class="rule">
@@ -43,7 +43,6 @@ export default {
},
// 状态管理
remainCount: 3, // 剩余抽奖次数
isRotating: false, // 是否正在抽奖
showResult: false, // 是否显示结果弹窗
currentPrize: [],// 当前中奖奖品
@@ -79,29 +78,11 @@ export default {
/**
* 处理开始抽奖事件
*/
async handleStartLottery(num) {
if (this.prizesObj.times <= 0) {
uni.showToast({
title: `您当前未获取到抽奖次数,快去获取吧~`,
icon: 'none'
});
return;
}
if (this.prizesObj.times < num) {
return;
}
async handleStartLottery(num, currentPrize) {
const params = {
id: this.prizesObj.id,
times: num,
}
const { data } = await raffleExecute(params);
this.targetIndex = this.prizesObj.prizes.findIndex(ele => ele.id === data.idList[0]);
this.currentPrize = currentPrize;
this.currentPrize = data.prizeList;
console.log("0------", this.currentPrize)
// 减少抽奖次数并标记为正在抽奖