feat:暂存

This commit is contained in:
dengtongyu committed 2021-09-05 00:40:55 +08:00
1 parent f078ecf551
commit 75a45dab67
35 files changed
+757 -176

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ module.exports = {
{ {
libraryName: "vant", libraryName: "vant",
libraryDirectory: "es", libraryDirectory: "es",
style: true style: name => `${name}/style/less`
}, },
"vant" "vant"
] ]
+3 -2
View File
@@ -34,12 +34,13 @@
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.1", "eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"less": "^4.1.1",
"less-loader": "^7.3.0",
"postcss-design-convert": "^1.1.3", "postcss-design-convert": "^1.1.3",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport": "^1.1.1",
"postcss-write-svg": "^3.0.1", "postcss-write-svg": "^3.0.1",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"sass": "^1.26.3", "sass-loader": "^10.2.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
} }
} }
+1 -1
View File
@@ -4,7 +4,7 @@
</div> </div>
</template> </template>
<style lang="scss"> <style lang="less">
@import "@/styles"; @import "@/styles";
#app { #app {
+12 -1
View File
@@ -35,11 +35,22 @@ const queryPrizeMsg = param => {
return ajax.get(`${HOST}/queryPrizeMsg`, param); return ajax.get(`${HOST}/queryPrizeMsg`, param);
}; };
// 规则
const getRuleTip = param => {
return ajax.get(`${HOST}/getRuleTip`, param);
};
// 抽奖记录
const drawRecord = param => {
return ajax.get(`${HOST}/drawRecord`, param);
};
export { export {
queryPrizeInfo, queryPrizeInfo,
queryTicketNum, queryTicketNum,
queryTicketRule, queryTicketRule,
doLottery, doLottery,
saveLog, saveLog,
queryPrizeMsg queryPrizeMsg,
getRuleTip,
drawRecord
}; };
+6 -11
View File
@@ -2,10 +2,10 @@
<div class="ball-content" :class="modeClass"> <div class="ball-content" :class="modeClass">
<div class="ball-content-main"> <div class="ball-content-main">
<div class="ball-content-main-notice"> <div class="ball-content-main-notice">
<notice :mode="mode" :gifts="prizeItemList"></notice> <notice :drawType="drawType" :gifts="prizeItemList"></notice>
</div> </div>
<div class="ball-content-main-grid"> <div class="ball-content-main-grid">
<lucky-grid-view :mode="mode"></lucky-grid-view> <lucky-grid-view></lucky-grid-view>
</div> </div>
</div> </div>
</div> </div>
@@ -21,23 +21,18 @@ export default {
notice, notice,
luckyGridView luckyGridView
}, },
props: { props: {},
mode: {
type: String,
default: "blue"
}
},
computed: { computed: {
...mapGetters(["prizeItemList"]), ...mapGetters(["prizeItemList", "drawType"]),
modeClass() { modeClass() {
if (this.mode === "blue") return "ball-xy"; if (this.drawType === "turntable1") return "ball-xy";
return "ball-hh"; return "ball-hh";
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.ball-content { .ball-content {
width: 676px; width: 676px;
height: 430px; height: 430px;
+7 -6
View File
@@ -27,9 +27,9 @@ export default {
SwiperSlide SwiperSlide
}, },
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
}, },
name: { name: {
type: String, type: String,
@@ -52,11 +52,11 @@ export default {
}, },
computed: { computed: {
modeClass() { modeClass() {
if (this.mode === "blue") return "notice-xy"; if (this.drawType === "turntable1") return "notice-xy";
return "notice-hh"; return "notice-hh";
}, },
modeName() { modeName() {
if (this.mode === "blue") return "幸运扭扭蛋"; if (this.drawType === "turntable1") return "幸运扭扭蛋";
return "豪华扭扭蛋"; return "豪华扭扭蛋";
} }
}, },
@@ -84,7 +84,7 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
@import "~swiper/css/swiper.css"; @import "~swiper/css/swiper.css";
.notice { .notice {
width: 618px; width: 618px;
@@ -92,10 +92,10 @@ export default {
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
margin: 0 auto; margin: 0 auto;
overflow: hidden;
&-swiper { &-swiper {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden;
&-slide { &-slide {
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -106,6 +106,7 @@ export default {
white-space: nowrap; white-space: nowrap;
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
font-size: 14px;
& > label { & > label {
color: #ffe26c; color: #ffe26c;
} }
+4 -4
View File
@@ -12,9 +12,9 @@
export default { export default {
name: "BalanceView", name: "BalanceView",
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
}, },
value: { value: {
type: Number, type: Number,
@@ -23,14 +23,14 @@ export default {
}, },
computed: { computed: {
modeClass() { modeClass() {
if (this.mode === "blue") return "balance-view-xy"; if (this.drawType === "turntable1") return "balance-view-xy";
return "balance-view-hh"; return "balance-view-hh";
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.balance-view { .balance-view {
width: 345px; width: 345px;
height: 84px; height: 84px;
+4 -4
View File
@@ -8,15 +8,15 @@ import { mapMutations, mapGetters } from "vuex";
export default { export default {
name: "LotteryBtn", name: "LotteryBtn",
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
} }
}, },
computed: { computed: {
...mapGetters(["canLottery"]), ...mapGetters(["canLottery"]),
modeClass() { modeClass() {
if (this.mode === "blue") return "lottery-btn-xy"; if (this.drawType === "turntable1") return "lottery-btn-xy";
return "lottery-btn-hh"; return "lottery-btn-hh";
} }
}, },
@@ -34,7 +34,7 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.lottery-btn { .lottery-btn {
width: 262px; width: 262px;
height: 115px; height: 115px;
+11 -13
View File
@@ -1,8 +1,11 @@
<template> <template>
<div class="bottom-view" :class="modeClass"> <div class="bottom-view" :class="modeClass">
<div class="bottom-view-top"> <div class="bottom-view-top">
<balance-view :mode="mode" :value="remainTicketNum"></balance-view> <balance-view
<lottery-btn :mode="mode"></lottery-btn> :drawType="drawType"
:value="remainTicketNum"
></balance-view>
<lottery-btn :drawType="drawType"></lottery-btn>
</div> </div>
<div class="bottom-view-bottom"> <div class="bottom-view-bottom">
<ticket-view <ticket-view
@@ -11,7 +14,7 @@
:label="item.label" :label="item.label"
:desc="item.desc" :desc="item.desc"
:active="active === key" :active="active === key"
:mode="mode" :drawType="drawType"
@click.native="clickTicketView(item, key)" @click.native="clickTicketView(item, key)"
></ticket-view> ></ticket-view>
</div> </div>
@@ -32,15 +35,15 @@ export default {
ticketView ticketView
}, },
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
} }
}, },
computed: { computed: {
...mapGetters(["remainTicketNum", "ticketRule"]), ...mapGetters(["remainTicketNum", "ticketRule"]),
modeClass() { modeClass() {
if (this.mode === "blue") return "bottom-view-xy"; if (this.drawType === "turntable1") return "bottom-view-xy";
return "bottom-view-hh"; return "bottom-view-hh";
}, },
uid() { uid() {
@@ -49,10 +52,6 @@ export default {
roomUid() { roomUid() {
return this.$route.query.roomUid; return this.$route.query.roomUid;
}, },
drawType() {
if (this.mode === "blue") return "turntable1";
return "turntable2";
},
ticketRuleList() { ticketRuleList() {
const list = []; const list = [];
if (!this.ticketRule) return list; if (!this.ticketRule) return list;
@@ -70,7 +69,7 @@ export default {
} }
}, },
watch: { watch: {
mode() { drawType() {
this.active = 0; this.active = 0;
this.getqueryTicketRule(); this.getqueryTicketRule();
}, },
@@ -136,7 +135,6 @@ export default {
}); });
}, },
clickTicketView(item, index) { clickTicketView(item, index) {
console.log(item, index);
this.active = index; this.active = index;
// this.SetRuleType(item.ruleType); // this.SetRuleType(item.ruleType);
} }
@@ -144,7 +142,7 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.bottom-view { .bottom-view {
width: 694px; width: 694px;
height: 300px; height: 300px;
+4 -4
View File
@@ -11,9 +11,9 @@
export default { export default {
name: "TicketView", name: "TicketView",
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
}, },
active: { active: {
type: Boolean, type: Boolean,
@@ -31,7 +31,7 @@ export default {
computed: { computed: {
modeClass() { modeClass() {
let str = ""; let str = "";
if (this.mode === "blue") { if (this.drawType === "turntable1") {
str = "ticket-view-xy"; str = "ticket-view-xy";
} else { } else {
str = "ticket-view-hh"; str = "ticket-view-hh";
@@ -46,7 +46,7 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.ticket-view { .ticket-view {
width: 130px; width: 130px;
height: 110px; height: 110px;
+7 -5
View File
@@ -8,9 +8,9 @@
export default { export default {
name: "BtnView", name: "BtnView",
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
}, },
text: { text: {
type: String, type: String,
@@ -19,17 +19,19 @@ export default {
}, },
computed: { computed: {
modeClass() { modeClass() {
if (this.mode === "blue") return "btn-view-xy"; if (this.drawType === "turntable1") return "btn-view-xy";
return "btn-view-hh"; return "btn-view-hh";
} }
}, },
methods: { methods: {
clickEntryBtn() {} clickEntryBtn() {
this.$emit("clickEntryBtn", this.text);
}
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.btn-view { .btn-view {
width: 107px; width: 107px;
height: 61px; height: 61px;
+11 -5
View File
@@ -5,7 +5,8 @@
v-for="(item, key) in btnList" v-for="(item, key) in btnList"
:key="`enter_view_list_${key}`" :key="`enter_view_list_${key}`"
:text="item" :text="item"
:mode="mode" :drawType="drawType"
@clickEntryBtn="clickEntryBtn"
></btn-view> ></btn-view>
</div> </div>
</div> </div>
@@ -19,14 +20,14 @@ export default {
btnView btnView
}, },
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
} }
}, },
computed: { computed: {
modeClass() { modeClass() {
if (this.mode === "blue") return "enter-view-xy"; if (this.drawType === "turntable1") return "enter-view-xy";
return "enter-view-hh"; return "enter-view-hh";
} }
}, },
@@ -34,11 +35,16 @@ export default {
return { return {
btnList: ["规则", "奖品", "排行", "记录"] btnList: ["规则", "奖品", "排行", "记录"]
}; };
},
methods: {
clickEntryBtn(text) {
this.$emit("clickEntryBtn", text);
}
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.enter-view { .enter-view {
width: 676px; width: 676px;
height: 79px; height: 79px;
+19 -31
View File
@@ -13,7 +13,11 @@
@end="endCallBack" @end="endCallBack"
/> />
<van-dialog v-model="showDialog" title="恭喜您获得奖品"> <van-dialog
v-model="showDialog"
confirmButtonColor="#9E98FF"
title="恭喜您获得奖品"
>
<div class="lucky-grid-prize"> <div class="lucky-grid-prize">
<div <div
class="lucky-grid-prize-item" class="lucky-grid-prize-item"
@@ -34,20 +38,15 @@
<script> <script>
import { LuckyGrid } from "vue-luck-draw"; import { LuckyGrid } from "vue-luck-draw";
import { queryPrizeInfo, doLottery, saveLog } from "@/api"; import { doLottery, saveLog } from "@/api";
import { mapMutations, mapGetters } from "vuex"; import { mapMutations, mapGetters, mapActions } from "vuex";
import eventBus from "@/lib/eventBus"; import eventBus from "@/lib/eventBus";
export default { export default {
name: "LuckyGridView", name: "LuckyGridView",
components: { components: {
LuckyGrid LuckyGrid
}, },
props: { props: {},
mode: {
type: String,
default: "blue"
}
},
data() { data() {
return { return {
luckyNum: 0, luckyNum: 0,
@@ -94,13 +93,9 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters(["ruleType", "prizeIdList", "remainTicketNum"]), ...mapGetters(["ruleType", "prizeIdList", "remainTicketNum", "drawType"]),
drawType() {
if (this.mode === "blue") return "turntable1";
return "turntable2";
},
prizesImages() { prizesImages() {
if (this.mode === "blue") return this.blueImages; if (this.drawType === "turntable1") return this.blueImages;
return this.goldImages; return this.goldImages;
}, },
uid() { uid() {
@@ -174,39 +169,32 @@ export default {
} }
}, },
watch: { watch: {
mode() { drawType() {
this.getQueryPrizeInfo(); this.queryPrizeInfo();
} }
}, },
created() { created() {
eventBus.$on("eventLottery", this.startLottery); eventBus.$on("eventLottery", this.startLottery);
}, },
mounted() { mounted() {
this.getQueryPrizeInfo(); this.queryPrizeInfo();
}, },
destroyed() { destroyed() {
eventBus.$off("eventLottery", this.startLottery); eventBus.$off("eventLottery", this.startLottery);
}, },
methods: { methods: {
...mapMutations([ ...mapMutations([
"SetPrizeInfo",
"SetRemainTicketNum", "SetRemainTicketNum",
"SetCanLottery", "SetCanLottery",
"SetPrizeItemList" "SetPrizeItemList"
]), ]),
getQueryPrizeInfo() { ...mapActions(["getQueryPrizeInfo"]),
queryPrizeInfo({ drawType: this.drawType }) queryPrizeInfo() {
.then(res => { this.getQueryPrizeInfo().then(res => {
const { code, data, msg } = res; const { code, data } = res;
if (code === 200) { if (code === 200) {
this.SetPrizeInfo(data);
this.prizes = this.configPrizes(data); this.prizes = this.configPrizes(data);
} else {
this.$toast.fail(msg);
} }
})
.catch(() => {
this.$toast.fail("获取抽奖奖品信息失败!");
}); });
}, },
postDoLottery() { postDoLottery() {
@@ -242,7 +230,7 @@ export default {
} }
}); });
console.log("runTime", this.runTime); // console.log("runTime", this.runTime);
setTimeout(() => { setTimeout(() => {
this.timeout = true; this.timeout = true;
@@ -310,7 +298,7 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.lucky-grid-view { .lucky-grid-view {
width: 100%; width: 100%;
height: 330px; height: 330px;
+7
View File
@@ -0,0 +1,7 @@
import PrizesList from "./main";
PrizesList.install = function(Vue) {
Vue.component(PrizesList.name, PrizesList);
};
export default PrizesList;
+63
View File
@@ -0,0 +1,63 @@
<template>
<div class="prizes-list">
<div class="prizes-list-item" v-for="item in curList" :key="item.prizeId">
<div class="prizes-list-item-image">
<van-image width="100%" height="100%" :src="item.prizeImgUrl" />
</div>
<div class="prizes-list-item-name">
<span>{{ item.prizeName }}</span>
</div>
</div>
</div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
export default {
name: "PrizesList",
props: {
drawType: {
type: String,
default: "turntable1"
}
},
computed: {
...mapGetters(["prizeInfo"]),
curList() {
return this.prizeInfo[this.drawType];
}
},
created() {
if (this.curList.length === 0) this.getQueryPrizeInfo(this.drawType);
},
mounted() {},
methods: {
...mapActions(["getQueryPrizeInfo"])
}
};
</script>
<style lang="less" scoped>
.prizes-list {
display: flex;
flex-wrap: wrap;
&-item {
width: 170px;
margin: 20px 33px;
&-image {
width: 170px;
height: 170px;
background: #26144d;
border-radius: 24px;
}
&-name {
text-align: center;
font-size: 28px;
font-weight: 500;
color: #dbcfff;
line-height: 48px;
margin-top: 20px;
}
}
}
</style>
+7
View File
@@ -0,0 +1,7 @@
import RecordList from "./main";
RecordList.install = function(Vue) {
Vue.component(RecordList.name, RecordList);
};
export default RecordList;
+130
View File
@@ -0,0 +1,130 @@
<template>
<div class="record-list">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
:error.sync="error"
error-text="请求失败,点击重新加载"
@load="getDrawRecord"
>
<div
class="record-list-item"
v-for="(item, index) in recordList"
:key="`${item.prizeId}_${index}`"
>
<record-item
:img="item.prizeImgUrl"
:name="item.prizeName"
:dateTime="dateFormat(item.createTime)"
></record-item>
</div>
</van-list>
</div>
</template>
<script>
import { drawRecord } from "@/api";
import recordItem from "./recordItem.vue";
import { mapMutations } from "vuex";
export default {
name: "RecordItem",
components: {
recordItem
},
props: {
sortType: {
type: String,
default: "time"
}
},
// filters: {
// dateTimeFormat(value) {
// return this.dateFormat(value);
// }
// },
data() {
return {
loading: false,
finished: false,
recordList: [],
pageSize: 10,
page: 1,
error: false
};
},
computed: {
uid() {
return this.$route.query.uid;
}
},
created() {
// this.getDrawRecord();
// console.log("created");
},
methods: {
...mapMutations(["SetLotteryRecordRateVo"]),
getDrawRecord() {
console.log("getDrawRecord");
this.loading = true;
drawRecord({
uid: this.uid,
sortType: this.sortType,
page: this.page,
pageSize: this.pageSize
})
.then(res => {
this.loading = false;
const { code, data, msg } = res;
if (code === 200) {
const { drawPrizeItemVos, lotteryRecordRateVo } = data;
this.recordList = this.recordList.concat(drawPrizeItemVos);
this.SetLotteryRecordRateVo(lotteryRecordRateVo);
if (drawPrizeItemVos.length < this.pageSize) this.finished = true;
} else {
this.$toast.fail(msg);
}
})
.catch(() => {
this.loading = false;
this.$toast.fail("获取抽奖记录失败!");
});
},
dateFormat(datetime, fmt = "YYYY-mm-dd HH:MM") {
let ret;
const date = new Date(datetime);
const opt = {
"Y+": date.getFullYear().toString(), // 年
"m+": (date.getMonth() + 1).toString(), // 月
"d+": date.getDate().toString(), // 日
"H+": date.getHours().toString(), // 时
"M+": date.getMinutes().toString(), // 分
"S+": date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(
ret[1],
ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")
);
}
}
return fmt;
}
}
};
</script>
<style lang="less" scoped>
.record-list {
padding: 20px 30px;
&-item {
margin-top: 40px;
}
&:first-child {
margin-top: 0;
}
}
</style>
+71
View File
@@ -0,0 +1,71 @@
<template>
<div class="record-item">
<div class="record-item-left">
<div class="record-item-left-image">
<van-image width="100%" height="100%" :src="img" />
</div>
<div class="record-item-left-text">
<span>{{ name }}</span>
</div>
</div>
<div class="record-item-right">
<span>{{ dateTime }}</span>
</div>
</div>
</template>
<script>
export default {
name: "RecordItem",
props: {
img: {
type: String,
default: ""
},
name: {
type: String,
default: ""
},
dateTime: {
type: String,
default: ""
}
}
};
</script>
<style lang="less" scoped>
.record-item {
display: flex;
justify-content: space-between;
align-items: center;
&-left {
display: flex;
align-items: center;
flex: 1;
&-image {
width: 100px;
height: 100px;
background: #26144d;
border-radius: 24px;
flex-shrink: 0;
}
&-text {
margin-left: 40px;
font-size: 32px;
font-weight: 500;
color: #dbcfff;
}
}
&-right {
width: 210px;
text-align: right;
& > span {
font-size: 24px;
font-weight: 500;
color: #dbcfff;
opacity: 0.8;
}
}
}
</style>
+4 -4
View File
@@ -8,21 +8,21 @@
export default { export default {
name: "LargeTopButton", name: "LargeTopButton",
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
} }
}, },
computed: { computed: {
buttonClass() { buttonClass() {
if (this.mode === "blue") return "top-button-xy"; if (this.drawType === "turntable1") return "top-button-xy";
return "top-button-hh"; return "top-button-hh";
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.top-button-large { .top-button-large {
width: 276px; width: 276px;
height: 107px; height: 107px;
+13 -19
View File
@@ -1,14 +1,14 @@
<template> <template>
<div class="top-button"> <div class="top-button">
<top-btn-view <top-btn-view
:mode="mode" :drawType="drawType"
:active="active === 0" :active="drawType === 'turntable1'"
@click.native="clickBtnView(0)" @click.native="clickBtnView('turntable1')"
></top-btn-view> ></top-btn-view>
<top-btn-view <top-btn-view
:mode="mode" :drawType="drawType"
:active="active === 1" :active="drawType === 'turntable2'"
@click.native="clickBtnView(1)" @click.native="clickBtnView('turntable2')"
></top-btn-view> ></top-btn-view>
</div> </div>
</template> </template>
@@ -21,30 +21,24 @@ export default {
topBtnView topBtnView
}, },
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
}
},
computed: {
active() {
if (this.mode === "blue") return 0;
if (this.mode === "gold") return 1;
return 0;
} }
}, },
computed: {},
methods: { methods: {
clickBtnView(index) { clickBtnView(drawType) {
this.$emit("clickTopButton", index); this.$emit("clickTopButton", drawType);
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.top-button { .top-button {
display: flex; display: flex;
width: 560px; width: 540px;
justify-content: space-between; justify-content: space-between;
align-items: flex-end; align-items: flex-end;
margin: 0 auto; margin: 0 auto;
+4 -4
View File
@@ -8,21 +8,21 @@
export default { export default {
name: "SmallTopButton", name: "SmallTopButton",
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
} }
}, },
computed: { computed: {
buttonClass() { buttonClass() {
if (this.mode === "blue") return "top-button-hh"; if (this.drawType === "turntable1") return "top-button-hh";
return "top-button-xy"; return "top-button-xy";
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.top-button-small { .top-button-small {
width: 244px; width: 244px;
height: 78px; height: 78px;
+8 -8
View File
@@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<large-top-button :mode="mode" v-if="active"></large-top-button> <large-top-button :drawType="drawType" v-if="active"></large-top-button>
<small-top-button :mode="mode" v-else></small-top-button> <small-top-button :drawType="drawType" v-else></small-top-button>
</div> </div>
</template> </template>
@@ -15,9 +15,9 @@ export default {
smallTopButton smallTopButton
}, },
props: { props: {
mode: { drawType: {
type: String, type: String,
default: "blue" default: "turntable1"
}, },
active: { active: {
type: Boolean, type: Boolean,
@@ -25,11 +25,11 @@ export default {
} }
}, },
watch: { watch: {
active(val) { // active(val) {
console.log("watch", val); // console.log("watch", val);
} // }
} }
}; };
</script> </script>
<style lang="scss" scoped></style> <style lang="less" scoped></style>
+6 -1
View File
@@ -2,12 +2,17 @@ import Vue from "vue";
import App from "./App.vue"; import App from "./App.vue";
import router from "./router"; import router from "./router";
import store from "./store"; import store from "./store";
import { Toast, Dialog } from "vant"; import { Toast, Dialog, Tab, Tabs, Popup, Image as VanImage, List } from "vant";
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(Toast); Vue.use(Toast);
Vue.use(Dialog); Vue.use(Dialog);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(Popup);
Vue.use(VanImage);
Vue.use(List);
new Vue({ new Vue({
router, router,
+6 -9
View File
@@ -9,16 +9,13 @@ const routes = [
path: "/", path: "/",
name: "Home", name: "Home",
component: Home component: Home
},
{
path: "/about",
name: "About",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/* webpackChunkName: "about" */ "../views/About.vue")
} }
// {
// path: "/about",
// name: "About",
// component: () =>
// import(/* webpackChunkName: "about" */ "../views/About.vue")
// }
]; ];
const router = new VueRouter({ const router = new VueRouter({
+51 -9
View File
@@ -1,29 +1,42 @@
import Vue from "vue"; import Vue from "vue";
import Vuex from "vuex"; import Vuex from "vuex";
import { Toast } from "vant";
import { queryPrizeInfo } from "@/api";
Vue.use(Vuex); Vue.use(Vuex);
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
prizeInfo: [], drawType: "turntable1",
prizeInfo: {
turntable1: [],
turntable2: []
},
prizeItemList: [], prizeItemList: [],
ruleType: "one", ruleType: "one",
remainTicketNum: 0, remainTicketNum: 0,
ticketRule: null, ticketRule: null,
canLottery: true canLottery: true,
lotteryRecordRateVo: {}
}, },
getters: { getters: {
drawType: state => {
return state.drawType;
},
prizeInfo: state => { prizeInfo: state => {
return state.prizeInfo; return state.prizeInfo;
}, },
curDrawTypePrizeInfo: state => {
return state.prizeInfo[state.drawType];
},
prizeItemList: state => { prizeItemList: state => {
return state.prizeItemList; return state.prizeItemList;
}, },
prizeIdList: state => { prizeIdList: (state, getters) => {
const { prizeInfo } = state; const { curDrawTypePrizeInfo } = getters;
const list = []; const list = [];
for (let index = 0; index < prizeInfo.length; index++) { for (let index = 0; index < curDrawTypePrizeInfo.length; index++) {
const element = prizeInfo[index]; const element = curDrawTypePrizeInfo[index];
list.push(element.prizeId); list.push(element.prizeId);
} }
return list; return list;
@@ -43,11 +56,18 @@ export default new Vuex.Store({
}, },
canLottery: state => { canLottery: state => {
return state.canLottery; return state.canLottery;
},
lotteryRecordRateVo: state => {
return state.lotteryRecordRateVo;
} }
}, },
mutations: { mutations: {
SetPrizeInfo(state, payload) { SetDrawType(state, payload) {
state.prizeInfo = payload; state.drawType = payload;
},
SetDrawTypePrizeInfo(state, payload) {
const { drawType, list } = payload;
state.prizeInfo[drawType || state.drawType] = list;
}, },
SetPrizeItemList(state, payload) { SetPrizeItemList(state, payload) {
state.prizeItemList = payload; state.prizeItemList = payload;
@@ -63,8 +83,30 @@ export default new Vuex.Store({
}, },
SetCanLottery(state, payload) { SetCanLottery(state, payload) {
state.canLottery = payload; state.canLottery = payload;
},
SetLotteryRecordRateVo(state, payload) {
state.lotteryRecordRateVo = payload;
}
},
actions: {
getQueryPrizeInfo({ state, commit }, drawType) {
return new Promise((resolve, reject) => {
queryPrizeInfo({ drawType: drawType || state.drawType })
.then(res => {
const { code, data, msg } = res;
if (code === 200) {
commit("SetDrawTypePrizeInfo", { drawType, list: data });
} else {
Toast.fail(msg);
}
resolve(res);
})
.catch(err => {
Toast.fail("获取抽奖奖品信息失败!");
reject(err);
});
});
} }
}, },
actions: {},
modules: {} modules: {}
}); });
+4
View File
@@ -0,0 +1,4 @@
@tab-text-color: #AFAAFF;
@tab-active-text-color: #DBCFFF;
@tabs-nav-background-color: none;
@tabs-bottom-bar-color: #DBCFFF;
@@ -29,22 +29,22 @@ body {
user-select: none; user-select: none;
} }
#app { #app {
font-family: "Helvetica", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif; font-family: "PingFang SC", "Helvetica", "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
color: #2c3e50; color: #2c3e50;
font-size: 14px; font-size: 14px;
} }
@svg 1px-border { // @svg 1px-border {
height: 2px; // height: 2px;
@rect { // @rect {
fill: var(--color, black); // fill: var(--color, black);
width: 100%; // width: 100%;
height: 50%; // height: 50%;
} // }
} // }
.border-1px { // .border-1px {
border: 1px solid transparent; // border: 1px solid transparent;
border-image: svg(1px-border param(--color #00b1ff)) 2 2 stretch; // border-image: svg(1px-border param(--color #00b1ff)) 2 2 stretch;
} // }
+11
View File
@@ -0,0 +1,11 @@
@import "./global.less";
.prizes-view-content-tableft {
margin-left: 130px;
font-size: 32px;
}
.prizes-view-content-tabright {
margin-right: 130px;
font-size: 32px;
}
-2
View File
@@ -1,2 +0,0 @@
@import "./global.scss";
-5
View File
@@ -1,5 +0,0 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
+59 -13
View File
@@ -2,18 +2,38 @@
<div class="home"> <div class="home">
<div class="top-btn-and-box"> <div class="top-btn-and-box">
<div class="top-btn-box"> <div class="top-btn-box">
<top-button :mode="mode" @clickTopButton="clickTopButton"></top-button> <top-button
:drawType="drawType"
@clickTopButton="clickTopButton"
></top-button>
</div> </div>
<div class="top-ball-box"> <div class="top-ball-box">
<ball-content :mode="mode"></ball-content> <ball-content></ball-content>
</div> </div>
</div> </div>
<div> <div>
<enter-view :mode="mode"></enter-view> <enter-view
:drawType="drawType"
@clickEntryBtn="clickEntryBtn"
></enter-view>
</div> </div>
<div> <div>
<bottom-view :mode="mode"></bottom-view> <bottom-view :drawType="drawType"></bottom-view>
</div> </div>
<van-popup
v-model="show"
position="left"
:style="{ height: '100%', width: '100%' }"
:close-on-click-overlay="false"
close-icon="arrow-left"
closeable
close-icon-position="top-left"
get-container="#app"
>
<!-- <prizes-view></prizes-view> -->
<component :is="curComponentsName"></component>
</van-popup>
</div> </div>
</template> </template>
@@ -22,6 +42,8 @@ import topButton from "@/components/topButton";
import ballContent from "@/components/ballContent"; import ballContent from "@/components/ballContent";
import enterView from "@/components/enterView"; import enterView from "@/components/enterView";
import bottomView from "@/components/bottomView"; import bottomView from "@/components/bottomView";
// import prizesView from "./prizesView.vue";
import { mapMutations, mapGetters } from "vuex";
export default { export default {
name: "Home", name: "Home",
@@ -29,31 +51,55 @@ export default {
topButton, topButton,
ballContent, ballContent,
enterView, enterView,
bottomView bottomView,
// prizesView
prizesView: resolve => require(["./prizesView.vue"], resolve),
ruleView: resolve => require(["./ruleView.vue"], resolve),
recordView: resolve => require(["./recordView.vue"], resolve)
}, },
data() { data() {
return { return {
active: 0 show: false,
curBtnText: "",
componentsName: {
规则: "rule-view",
奖品: "prizes-view",
排行: "record-view",
记录: "record-view"
}
}; };
}, },
computed: { computed: {
mode() { ...mapGetters(["drawType"]),
if (this.active === 0) return "blue"; curComponentsName() {
if (this.active === 1) return "gold"; return this.componentsName[this.curBtnText];
return "blue"; },
showPopup() {
return this.show && this.curBtnText && this.curComponentsName;
}
},
watch: {
show() {
console.log("this.show", this.show);
} }
}, },
mounted() {}, mounted() {},
methods: { methods: {
...mapMutations(["SetDrawType"]),
clickTopButton(index) { clickTopButton(index) {
this.active = index; this.SetDrawType(index);
console.log("active", index); // console.log("active", index);
},
clickEntryBtn(val) {
// console.log("clickEntryBtn", val);
this.curBtnText = val;
this.show = true;
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.home { .home {
padding: 20px 25px; padding: 20px 25px;
height: 100%; height: 100%;
+56
View File
@@ -0,0 +1,56 @@
<template>
<div class="prizes-view">
<div class="prizes-view-content">
<van-tabs v-model="active" animated>
<van-tab
title="幸运扭扭蛋"
name="turntable1"
title-class="prizes-view-content-tableft"
>
<div class="prizes-view-content-pane">
<prizes-list drawType="turntable1"></prizes-list>
</div>
</van-tab>
<van-tab
title="豪华扭扭蛋"
name="turntable2"
title-class="prizes-view-content-tabright"
>
<div class="prizes-view-content-pane">
<prizes-list drawType="turntable2"></prizes-list>
</div>
</van-tab>
</van-tabs>
</div>
</div>
</template>
<script>
import prizesList from "@/components/prizesList";
export default {
name: "PrizesView",
components: {
prizesList
},
data() {
return {
active: "turntable1"
};
}
};
</script>
<style lang="less" scoped>
.prizes-view {
height: 100%;
background-color: #150832;
&-content {
padding-top: 10px;
&-pane {
margin: 20px;
overflow-x: hidden;
overflow-y: auto;
}
}
}
</style>
+78
View File
@@ -0,0 +1,78 @@
<template>
<div class="record-view">
<div class="record-view-title">
<h3>抽奖记录</h3>
<p>今日投入产出比:{{ rate }}</p>
</div>
<div class="record-view-content">
<van-tabs v-model="active" animated>
<van-tab title="时间" name="time">
<div class="record-view-content-pane">
<record-list sortType="time"></record-list>
</div>
</van-tab>
<van-tab title="价值" name="worth">
<div class="record-view-content-pane">
<record-list sortType="worth"></record-list>
</div>
</van-tab>
</van-tabs>
</div>
</div>
</template>
<script>
import recordList from "@/components/recordList";
import { mapGetters } from "vuex";
export default {
name: "RecordView",
components: {
recordList
},
data() {
return {
active: "time"
};
},
computed: {
...mapGetters(["lotteryRecordRateVo"]),
rate() {
return this.lotteryRecordRateVo.rate;
}
},
created() {},
methods: {}
};
</script>
<style lang="less" scoped>
.record-view {
height: 100%;
background-color: #150832;
color: #dbcfff;
padding-top: 20px;
box-sizing: border-box;
&-title {
text-align: center;
& > h3 {
font-size: 32px;
font-weight: bold;
color: #dbcfff;
line-height: 72px;
}
& > p {
font-size: 20px;
font-weight: bold;
color: #dbcfff;
line-height: 50px;
opacity: 0.4;
}
}
&-content {
&-pane {
height: calc(100vh - 20px - 72px - 50px - 11.734vw);
overflow-y: auto;
}
}
}
</style>
+67
View File
@@ -0,0 +1,67 @@
<template>
<div class="rule-view">
<div class="rule-view-padding">
<h3 class="rule-view-title">活动规则</h3>
<div class="rule-view-content">
<p v-for="(text, index) in ruleContent" :key="`rule_text_${index}`">
{{ text }}
</p>
</div>
</div>
</div>
</template>
<script>
import { getRuleTip } from "@/api";
export default {
name: "RuleView",
data() {
return {
ruleContent: []
};
},
created() {
this.ruleTip();
},
methods: {
ruleTip() {
getRuleTip()
.then(res => {
const { code, data, msg } = res;
if (code === 200) {
this.ruleContent = data;
} else {
this.$toast.fail(msg);
}
})
.catch(() => {
this.$toast.fail("获取抽奖规则失败!");
});
}
}
};
</script>
<style lang="less" scoped>
.rule-view {
height: 100%;
background-color: #150832;
color: #dbcfff;
&-padding {
padding: 20px 30px;
}
&-title {
text-align: center;
color: #dbcfff;
font-weight: bold;
font-size: 32px;
line-height: 72px;
}
&-content {
margin-top: 50px;
line-height: 54px;
font-size: 26px;
font-weight: 400;
}
}
</style>
+9 -1
View File
@@ -26,7 +26,15 @@ module.exports = {
}, },
css: { css: {
loaderOptions: { loaderOptions: {
postcss: {} postcss: {},
less: {
lessOptions: {
modifyVars: {
// 或者可以通过 less 文件覆盖(文件路径为绝对路径)
hack: `true; @import "@/styles/cover.less";`
}
}
}
} }
} }
}; };