Commit 6d6058f9 by Lays-lzq

feat: 修复大转盘问题

parent 3a9069c7
......@@ -222,7 +222,8 @@ export default {
name: '谢谢参与' // 中奖等级
}, // 中奖信息
randomType: Math.floor(Math.random() * (2 - 1 + 1)) + 1, // 部分抽奖类型随机进1或2
isShowBanner: true
isShowBanner: true,
formattedPrizeList: []
}
},
computed: {
......@@ -235,13 +236,8 @@ export default {
prizeList() {
return this.lotteryInfo.prizeConfigs
},
formattedPrizeList() {
const prizeLen = this.lotteryInfo?.prizeConfigs?.length || 0
if (prizeLen >= 6 && prizeLen % 2 === 0) {
const freePrizes = new Array(2).fill({ id: 0, name: '谢谢参与' })
return [...this.lotteryInfo.prizeConfigs, ...freePrizes]
}
return this.lotteryInfo.prizeConfigs
prizeLen() {
return this.prizeList.length
},
isNotStart() {
// 抽奖不在活动日期内
......@@ -258,7 +254,25 @@ export default {
return ''
}
},
watch: {
prizeLen(nVal, oVal) {
if (nVal === oVal) {
return
}
if (this.nVal >= 6 && this.nVal % 2 === 0) {
const freePrizes = new Array(2).fill({ id: 0, name: '谢谢参与' })
this.formattedPrizeList = [...this.lotteryInfo.prizeConfigs, ...freePrizes]
}
this.formattedPrizeList = this.lotteryInfo.prizeConfigs
}
},
mounted() {
if (this.prizeLen >= 6 && this.prizeLen % 2 === 0) {
const freePrizes = new Array(2).fill({ id: 0, name: '谢谢参与' })
this.formattedPrizeList = [...this.lotteryInfo.prizeConfigs, ...freePrizes]
}else {
this.formattedPrizeList = this.lotteryInfo.prizeConfigs
}
Bus.$on('updateMain', data => {
for (const [key, value] of Object.entries(data)) {
if (key === 'func') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment