diff --git a/src/views/wealth/goldenWheel.vue b/src/views/wealth/goldenWheel.vue index 4a3fc21..c32a1ac 100644 --- a/src/views/wealth/goldenWheel.vue +++ b/src/views/wealth/goldenWheel.vue @@ -462,10 +462,26 @@ async loadHistoryRecord() { } // 抽奖API执行完成后,查询最新的剩余次数 + await this.fetchWheelInfo(); + return true; + }else if(res.code === 400){ + const prize = res.msg; + // 解析API返回的字符串数据 + const SpaceIndex = prize.indexOf(','); + if (SpaceIndex !== -1) { + // 第一个空格前面的部分作为prizeMessage + this.prizeMessage = prize.substring(0, SpaceIndex); + // 第一个空格后面的部分作为prizeAmount + this.prizeAmount = prize.substring(SpaceIndex + 1); + } else { + // 如果没有空格,整个字符串作为prizeMessage,prizeAmount为空 + this.prizeMessage = prize; + this.prizeAmount = ''; + } + // 抽奖API执行完成后,查询最新的剩余次数 await this.fetchWheelInfo(); - return true; - } else { + }else { console.error('抽奖API返回错误:', res.msg); // 设置默认值 this.prizeMessage = '抽奖失败'; @@ -474,7 +490,7 @@ async loadHistoryRecord() { // 即使抽奖失败,也查询最新的剩余次数 await this.fetchWheelInfo(); - return false; + return true; } } catch (error) { console.error('抽奖API调用失败:', error); @@ -485,7 +501,7 @@ async loadHistoryRecord() { // 即使抽奖失败,也查询最新的剩余次数 await this.fetchWheelInfo(); - return false; + return true; } }, @@ -503,7 +519,7 @@ async loadHistoryRecord() { // 计算需要旋转的总角度(确保多转几圈) // 从当前位置旋转到目标位置,加上多转的圈数(3-5圈) - const extraRotations = 3 + Math.floor(Math.random() * 3); // 4-5圈 + const extraRotations = 5 + Math.floor(Math.random() * 3); // 4-5圈 const extraDegrees = extraRotations * 360; // 计算最终旋转角度