feat: 修改抽奖次数

This commit is contained in:
2025-09-12 09:07:03 +08:00
parent a5e32ead5a
commit 4593508e48
@@ -25,7 +25,7 @@
</template>
</view>
</view>
<view class="coiled-lottery" v-if="prizesObj.times > 10" @click="handleStartLottery(10)"> 连续抽奖10次 </view>
<view class="coiled-lottery" v-if="prizesObj.times > 9" @click="handleStartLottery(10)"> 连续抽奖10次 </view>
</template>
<script>
@@ -146,6 +146,7 @@ export default {
* 处理开始抽奖事件
*/
async handleStartLottery(num) {
if (this.prizesObj.times <= 0) {
uni.showToast({
title: `您当前未获取到抽奖次数,快去获取吧~`,
@@ -154,7 +155,7 @@ export default {
return;
}
if (this.prizesObj.times < num) {
if (this.prizesObj.times < num - 1) {
return;
}
@@ -192,11 +193,13 @@ export default {
}
// 标记为正在抽奖
this.isRotating = true
// 通知父组件开始抽奖
this.$emit('start', num, this.currentPrize)
// 开始抽奖动画(无论父组件做了什么处理)
this.startLotteryAnimation()
this.startLotteryAnimation(start)
},
/**
* 开始抽奖动画
@@ -205,8 +208,6 @@ export default {
// 重置动画参数
clearTimeout(this.animationTimer)
// 标记为正在抽奖
this.isRotating = true
// 开始动画
this.runAnimation({