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

@@ -0,0 +1,63 @@
<template>
<div class="bobo-lottery-count">
<button
class="count-button"
v-for="(item, index) in ticketRuleList"
:key="`count-button-${index}`"
:class="index === active ? 'count-button-active' : ''"
@click="clcikButton(index)"
>
{{ item.label }}
</button>
</div>
</template>
<script>
import { mapGetters, mapMutations, mapActions } from "vuex";
export default {
name: "BoboLotteryCount",
data() {
return {
active: 0
};
},
computed: {
...mapGetters(["ticketRuleList", "ticketRuleConfig"])
},
created() {
this.getqueryTicketRule("turntable1");
},
methods: {
...mapMutations(["SetRuleType"]),
...mapActions(["getqueryTicketRule"]),
clcikButton(index) {
this.active = index;
this.SetRuleType(this.ticketRuleConfig[this.active].ruleType);
}
}
};
</script>
<style lang="less" scoped>
.bobo-lottery-count {
margin-top: 30px;
margin-bottom: 40px;
}
.count-button {
width: 140px;
height: 64px;
background-repeat: no-repeat;
background-size: cover;
border: none;
background-color: transparent;
background-image: url(../../assets/images/bobo/but_unchecked.png);
font-size: 24px;
color: #ffffff;
margin: 0 20px;
&-active {
font-size: 26px;
font-weight: bold;
background-image: url(../../assets/images/bobo/but_select.png);
}
}
</style>
+34 -3
View File
@@ -1,6 +1,9 @@
<template>
<div class="bobo-yq-view">
<div class="bobo-yq-view-text"></div>
<div class="bobo-yq-view-text">
<label>次数:</label>
<span>{{ remainTicketNum }}</span>
</div>
<div class="bobo-yq-view-btn">
<button></button>
</div>
@@ -8,8 +11,24 @@
</template>
<script>
import { mapGetters, mapActions } from "vuex";
export default {
name: "BoboYqView"
name: "BoboYqView",
props: {
uid: {
type: [String, Number],
default: ""
}
},
computed: {
...mapGetters(["remainTicketNum"])
},
methods: {
...mapActions(["getQueryTicketNum"])
},
created() {
this.getQueryTicketNum({ uid: this.uid });
}
};
</script>
@@ -18,15 +37,27 @@ export default {
width: 346px;
height: 59px;
background-repeat: no-repeat;
background-size: cover;
background-size: 100% 100%;
background-image: url(../../assets/images/bobo/gmcx_bg.png);
display: flex;
// align-items: center;
&-text {
flex: 1;
font-size: 22px;
line-height: 59px;
& > label {
color: #ffffff;
padding-left: 20px;
}
& > span {
color: #ffe26c;
}
}
&-btn {
width: 46px;
height: 46px;
padding-right: 10px;
padding-top: 6px;
& > button {
width: 46px;
height: 46px;
+7
View File
@@ -0,0 +1,7 @@
import BoboLottery from "./main";
BoboLottery.install = function(Vue) {
Vue.component(BoboLottery.name, BoboLottery);
};
export default BoboLottery;
+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>