-
+
-
-
-
-
-
-
+
-
+
@@ -8,8 +11,24 @@
@@ -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;
diff --git a/src/components/boboLottery/index.js b/src/components/boboLottery/index.js
index e69de29..8df940f 100644
--- a/src/components/boboLottery/index.js
+++ b/src/components/boboLottery/index.js
@@ -0,0 +1,7 @@
+import BoboLottery from "./main";
+
+BoboLottery.install = function(Vue) {
+ Vue.component(BoboLottery.name, BoboLottery);
+};
+
+export default BoboLottery;
diff --git a/src/components/boboLottery/main.vue b/src/components/boboLottery/main.vue
index d0976da..9985e3e 100644
--- a/src/components/boboLottery/main.vue
+++ b/src/components/boboLottery/main.vue
@@ -1,11 +1,105 @@
-
+
+
+
+
+
+
+
diff --git a/src/components/luckyGridView/main.vue b/src/components/luckyGridView/main.vue
index 295a41b..f467bd3 100644
--- a/src/components/luckyGridView/main.vue
+++ b/src/components/luckyGridView/main.vue
@@ -13,38 +13,23 @@
@end="endCallBack"
/>
-
-
+ :list="lotteryPrizeItemList"
+ >
+
+
diff --git a/src/store/index.js b/src/store/index.js
index aa2d2ce..9736bdd 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,7 +1,13 @@
import Vue from "vue";
import Vuex from "vuex";
import { Toast } from "vant";
-import { queryPrizeInfo } from "@/api";
+import {
+ queryPrizeInfo,
+ queryTicketRule,
+ doLottery,
+ saveLog,
+ queryTicketNum
+} from "@/api";
Vue.use(Vuex);
@@ -12,12 +18,30 @@ export default new Vuex.Store({
turntable1: [],
turntable2: []
},
- prizeItemList: [],
+ // prizeItemList: [],
ruleType: "one",
remainTicketNum: 0,
ticketRule: null,
canLottery: true,
- lotteryRecordRateVo: {}
+ lotteryRecordRateVo: {},
+ ticketRuleConfig: [
+ {
+ ruleType: "one",
+ name: "1次",
+ index: 0
+ },
+ {
+ ruleType: "ten",
+ name: "10次",
+ index: 1
+ },
+ {
+ ruleType: "hundred",
+ name: "100次",
+ index: 2
+ }
+ ],
+ lotteryData: null
},
getters: {
drawType: state => {
@@ -29,9 +53,9 @@ export default new Vuex.Store({
curDrawTypePrizeInfo: state => {
return state.prizeInfo[state.drawType];
},
- prizeItemList: state => {
- return state.prizeItemList;
- },
+ // prizeItemList: state => {
+ // return state.prizeItemList;
+ // },
prizeIdList: (state, getters) => {
const { curDrawTypePrizeInfo } = getters;
const list = [];
@@ -59,6 +83,74 @@ export default new Vuex.Store({
},
lotteryRecordRateVo: state => {
return state.lotteryRecordRateVo;
+ },
+ ticketRuleConfig: state => {
+ return state.ticketRuleConfig;
+ },
+ ticketRuleList: (state, getters) => {
+ const list = [];
+ if (!getters.ticketRule) return list;
+ for (let index = 0; index < getters.ticketRuleConfig.length; index++) {
+ const element = getters.ticketRuleConfig[index];
+ const val = getters.ticketRule[element.ruleType];
+ list.push({
+ label: element.name,
+ desc: `${val}张鱼券`,
+ value: val,
+ ruleType: element.ruleType
+ });
+ }
+ return list;
+ },
+ lotteryData: state => {
+ return state.lotteryData;
+ },
+ lotteryPrizeItemList: (state, getters) => {
+ if (!getters.lotteryData) return null;
+ return getters.lotteryData.prizeItemList;
+ },
+ prizeids: (state, getters) => {
+ if (!getters.lotteryData) return null;
+ return getters.lotteryData.prizeIdList;
+ },
+ maxPrizeVaue: (state, getters) => {
+ let list = [];
+ for (
+ let index = 0;
+ index < getters.lotteryPrizeItemList.length;
+ index++
+ ) {
+ const element = getters.lotteryPrizeItemList[index];
+ list.push(element.platformValue);
+ }
+ let max = Math.max(...list);
+ return max;
+ },
+ maxVauePrizeId: (state, getters) => {
+ let id = 0;
+ for (
+ let index = 0;
+ index < getters.lotteryPrizeItemList.length;
+ index++
+ ) {
+ const element = getters.lotteryPrizeItemList[index];
+ if (getters.maxPrizeVaue === element.platformValue) {
+ id = element.prizeId;
+ break;
+ }
+ }
+ return id;
+ },
+ maxVauePrizeIndex: (state, getters) => {
+ let num = null;
+ for (let index = 0; index < getters.prizeIdList.length; index++) {
+ const element = getters.prizeIdList[index];
+ if (element === getters.maxVauePrizeId) {
+ num = index;
+ break;
+ }
+ }
+ return num;
}
},
mutations: {
@@ -69,9 +161,9 @@ export default new Vuex.Store({
const { drawType, list } = payload;
state.prizeInfo[drawType || state.drawType] = list;
},
- SetPrizeItemList(state, payload) {
- state.prizeItemList = payload;
- },
+ // SetPrizeItemList(state, payload) {
+ // state.prizeItemList = payload;
+ // },
SetRuleType(state, payload) {
state.ruleType = payload;
},
@@ -86,6 +178,9 @@ export default new Vuex.Store({
},
SetLotteryRecordRateVo(state, payload) {
state.lotteryRecordRateVo = payload;
+ },
+ SetLotteryData(state, payload) {
+ state.lotteryData = payload;
}
},
actions: {
@@ -106,6 +201,70 @@ export default new Vuex.Store({
reject(err);
});
});
+ },
+ getqueryTicketRule({ commit }, drawType) {
+ queryTicketRule({ drawType: drawType })
+ .then(res => {
+ const { code, data, msg } = res;
+ if (code === 200) {
+ commit("SetTicketRule", data || null);
+ } else {
+ Toast.fail(msg);
+ }
+ })
+ .catch(() => {
+ Toast.fail("获取规则次数失败!");
+ });
+ },
+ runLottery({ state, commit, dispatch }, option) {
+ return new Promise((resolve, reject) => {
+ doLottery({
+ uid: option.uid,
+ roomUid: option.roomUid,
+ drawType: state.drawType,
+ sendMessage: true,
+ deviceId: "abc",
+ ruleType: state.ruleType
+ })
+ .then(res => {
+ const { code, data, msg } = res;
+ if (code === 200) {
+ commit("SetRemainTicketNum", data.remainTicketNum || 0);
+ commit("SetLotteryData", data);
+ dispatch("postSaveLog", option);
+ } else {
+ Toast.fail(msg);
+ }
+ resolve(res);
+ })
+ .catch(err => {
+ Toast.fail("抽奖发生意外错误!");
+ reject(err);
+ });
+ });
+ },
+ postSaveLog({ getters }, option) {
+ saveLog({
+ uid: option.uid,
+ prizeids: JSON.stringify(getters.prizeids),
+ prizeIndex: getters.maxVauePrizeIndex,
+ createdTime: getters.lotteryPrizeItemList[0].createTime,
+ prizeIdList: JSON.stringify(getters.prizeIdList)
+ });
+ },
+ getQueryTicketNum({ commit }, option) {
+ queryTicketNum({ uid: option.uid })
+ .then(res => {
+ const { code, data, msg } = res;
+ if (code === 200) {
+ commit("SetRemainTicketNum", data.num || 0);
+ } else {
+ Toast.fail(msg);
+ }
+ })
+ .catch(() => {
+ Toast.fail("获取余额失败!");
+ });
}
},
modules: {}
diff --git a/src/views/bobo.vue b/src/views/bobo.vue
index a3cbb01..f015c6f 100644
--- a/src/views/bobo.vue
+++ b/src/views/bobo.vue
@@ -1,17 +1,75 @@
+
+ {{ remainTicketNum }}
+
+
+
-
+
diff --git a/src/components/bottomView/main.vue b/src/components/bottomView/main.vue
index 779094c..2f993b3 100644
--- a/src/components/bottomView/main.vue
+++ b/src/components/bottomView/main.vue
@@ -25,8 +25,7 @@
import balanceView from "./balanceView.vue";
import lotteryBtn from "./lotteryBtn.vue";
import ticketView from "./ticketView.vue";
-import { queryTicketNum, queryTicketRule } from "@/api";
-import { mapMutations, mapGetters } from "vuex";
+import { mapMutations, mapGetters, mapActions } from "vuex";
export default {
name: "BottomView",
components: {
@@ -40,8 +39,18 @@ export default {
default: "turntable1"
}
},
+ data() {
+ return {
+ active: 0
+ };
+ },
computed: {
- ...mapGetters(["remainTicketNum", "ticketRule"]),
+ ...mapGetters([
+ "remainTicketNum",
+ "ticketRule",
+ "ticketRuleList",
+ "ticketRuleConfig"
+ ]),
modeClass() {
if (this.drawType === "turntable1") return "bottom-view-xy";
return "bottom-view-hh";
@@ -51,92 +60,26 @@ export default {
},
roomUid() {
return this.$route.query.roomUid;
- },
- ticketRuleList() {
- const list = [];
- if (!this.ticketRule) return list;
- for (let index = 0; index < this.ticketRuleConfig.length; index++) {
- const element = this.ticketRuleConfig[index];
- const val = this.ticketRule[element.ruleType];
- list.push({
- label: element.name,
- desc: `${val}张鱼券`,
- value: val,
- ruleType: element.ruleType
- });
- }
- return list;
}
},
watch: {
drawType() {
this.active = 0;
- this.getqueryTicketRule();
+ this.getqueryTicketRule(this.drawType);
},
active() {
this.SetRuleType(this.ticketRuleConfig[this.active].ruleType);
}
},
- data() {
- return {
- active: 0,
- ticketRuleConfig: [
- {
- ruleType: "one",
- name: "1次",
- index: 0
- },
- {
- ruleType: "ten",
- name: "10次",
- index: 1
- },
- {
- ruleType: "hundred",
- name: "100次",
- index: 2
- }
- ]
- };
- },
created() {
- this.getQueryTicketNum();
- this.getqueryTicketRule();
+ this.getQueryTicketNum({ uid: this.uid });
+ this.getqueryTicketRule(this.drawType);
},
methods: {
- ...mapMutations(["SetRuleType", "SetRemainTicketNum", "SetTicketRule"]),
- getQueryTicketNum() {
- queryTicketNum({ uid: this.uid })
- .then(res => {
- const { code, data, msg } = res;
- if (code === 200) {
- this.SetRemainTicketNum(data.num || 0);
- } else {
- this.$toast.fail(msg);
- }
- })
- .catch(() => {
- this.$toast.fail("获取余额失败!");
- });
- },
- getqueryTicketRule() {
- queryTicketRule({ drawType: this.drawType })
- .then(res => {
- const { code, data, msg } = res;
- if (code === 200) {
- // this.ticketRule = data || null;
- this.SetTicketRule(data || null);
- } else {
- this.$toast.fail(msg);
- }
- })
- .catch(() => {
- this.$toast.fail("获取规则次数失败!");
- });
- },
+ ...mapMutations(["SetRuleType"]),
+ ...mapActions(["getqueryTicketRule", "getQueryTicketNum"]),
clickTicketView(item, index) {
this.active = index;
- // this.SetRuleType(item.ruleType);
}
}
};
diff --git a/src/components/lotteryPrizesDialog/index.js b/src/components/lotteryPrizesDialog/index.js
new file mode 100644
index 0000000..f67d63f
--- /dev/null
+++ b/src/components/lotteryPrizesDialog/index.js
@@ -0,0 +1,7 @@
+import LotteryPrizesDialog from "./main";
+
+LotteryPrizesDialog.install = function(Vue) {
+ Vue.component(LotteryPrizesDialog.name, LotteryPrizesDialog);
+};
+
+export default LotteryPrizesDialog;
diff --git a/src/components/lotteryPrizesDialog/main.vue b/src/components/lotteryPrizesDialog/main.vue
new file mode 100644
index 0000000..118e1c4
--- /dev/null
+++ b/src/components/lotteryPrizesDialog/main.vue
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.prizeName }}x{{ item.prizeNum }}
+
+
-
-
-
-
-
-
-
- {{ item.prizeName }}x{{ item.prizeNum }}
-
-
-
+
+
+
+
+
+
+
+
+
@@ -25,8 +83,12 @@ export default {
background-image: url(../assets/images/bobo/bobo_bg.png);
background-repeat: no-repeat;
background-size: 100%;
+ overflow: hidden;
+ &-notice {
+ margin-top: 100px;
+ }
&-enter {
- padding-top: 180px;
+ padding-top: 20px;
}
&-gz-button {
width: 78px;