Commit d8c4e85f by Lays-lzq

Merge branch 'feature/wheel'

parents fc9e537e 6d6058f9
...@@ -222,7 +222,8 @@ export default { ...@@ -222,7 +222,8 @@ export default {
name: '谢谢参与' // 中奖等级 name: '谢谢参与' // 中奖等级
}, // 中奖信息 }, // 中奖信息
randomType: Math.floor(Math.random() * (2 - 1 + 1)) + 1, // 部分抽奖类型随机进1或2 randomType: Math.floor(Math.random() * (2 - 1 + 1)) + 1, // 部分抽奖类型随机进1或2
isShowBanner: true isShowBanner: true,
formattedPrizeList: []
} }
}, },
computed: { computed: {
...@@ -235,13 +236,8 @@ export default { ...@@ -235,13 +236,8 @@ export default {
prizeList() { prizeList() {
return this.lotteryInfo.prizeConfigs return this.lotteryInfo.prizeConfigs
}, },
formattedPrizeList() { prizeLen() {
const prizeLen = this.lotteryInfo?.prizeConfigs?.length || 0 return this.prizeList.length
if (prizeLen >= 6 && prizeLen % 2 === 0) {
const freePrizes = new Array(2).fill({ id: 0, name: '谢谢参与' })
return [...this.lotteryInfo.prizeConfigs, ...freePrizes]
}
return this.lotteryInfo.prizeConfigs
}, },
isNotStart() { isNotStart() {
// 抽奖不在活动日期内 // 抽奖不在活动日期内
...@@ -258,7 +254,25 @@ export default { ...@@ -258,7 +254,25 @@ export default {
return '' 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() { 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 => { Bus.$on('updateMain', data => {
for (const [key, value] of Object.entries(data)) { for (const [key, value] of Object.entries(data)) {
if (key === 'func') { 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