feat:更新泡泡抽奖

This commit is contained in:
dengtongyu committed 2021-09-19 16:48:54 +08:00
1 parent e5e2ccc95b
commit 7ae7ad5029
17 files changed
+715 -297

No files matched your search

+97 -3
View File
@@ -1,11 +1,105 @@
<template>
<div></div>
<div>
<div class="bobo-lottery">
<bobo-yq-view :uid="uid"></bobo-yq-view>
<bobo-lottery-count></bobo-lottery-count>
<button class="bobo-lottery-button" @touchend="clickLottery"></button>
</div>
<lottery-prizes-dialog
v-model="show"
:list="lotteryPrizeItemList"
></lottery-prizes-dialog>
</div>
</template>
<script>
import boboYqView from "./boboYqView.vue";
import boboLotteryCount from "./boboLotteryCount.vue";
import lotteryPrizesDialog from "@/components/lotteryPrizesDialog";
import { mapGetters, mapMutations, mapActions } from "vuex";
export default {
name: "BoboLottery"
name: "BoboLottery",
components: {
boboYqView,
boboLotteryCount,
lotteryPrizesDialog
},
data() {
return {
show: false
};
},
computed: {
...mapGetters([
"canLottery",
"remainTicketNum",
"curTicketRuleValue",
"lotteryPrizeItemList"
]),
uid() {
return this.$route.query.uid;
},
roomUid() {
return this.$route.query.roomUid;
}
},
methods: {
...mapMutations(["SetCanLottery"]),
...mapActions(["runLottery"]),
clickLottery() {
if (this.canLottery) {
this.SetCanLottery(false);
this.Lottery();
} else {
this.$toast.fail("您点太快了,本次抽奖还没结束哦!");
}
},
Lottery() {
if (
this.remainTicketNum === 0 ||
this.remainTicketNum < this.curTicketRuleValue
) {
this.$toast.fail("余额不足!");
return;
}
this.runLottery({
uid: this.uid,
roomUid: this.roomUid
})
.then(res => {
this.SetCanLottery(true);
const { code } = res;
if (code === 200) {
this.show = true;
}
})
.catch(() => {
this.SetCanLottery(true);
});
}
}
};
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
.bobo-lottery {
margin-top: 212px;
display: flex;
// justify-content: center;
align-items: center;
flex-direction: column;
&-button {
width: 320px;
height: 100px;
background-repeat: no-repeat;
background-size: cover;
border: none;
background-color: transparent;
background-image: url(../../assets/images/bobo/but_cpp.png);
&:active {
background-image: url(../../assets/images/bobo/but_cpp_press.png);
}
}
}
</style>