feat:update

This commit is contained in:
dengtongyu committed 2023-04-11 08:37:53 +08:00
1 parent d297e6b825
commit a348a79259
27 files changed
+453 -35

No files matched your search

+2 -2
View File
@@ -22,8 +22,8 @@ export default {
return "notice-hh";
},
modeName() {
if (this.drawType === "turntable1") return "幸运扭扭蛋";
return "豪华扭扭蛋";
if (this.drawType === "turntable1") return "幸运扭蛋";
return "至尊扭蛋";
},
text() {
return `在${this.modeName}获得了`;
+1
View File
@@ -54,6 +54,7 @@ export default {
this.remainTicketNum < this.curTicketRuleValue
) {
this.$toast.fail("余额不足!");
this.SetCanLottery(true);
return;
}
+2 -2
View File
@@ -42,11 +42,11 @@ export default {
});
},
todoData(res) {
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
this.list = data || [];
} else {
this.$toast.fail(msg);
this.$toast.fail(message);
}
}
}
+1
View File
@@ -156,6 +156,7 @@ export default {
this.remainTicketNum < this.curTicketRuleValue
) {
this.$toast.fail("余额不足!");
this.SetCanLottery(true);
return;
}
+2 -2
View File
@@ -109,7 +109,7 @@ export default {
});
},
todoData(res) {
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
const { myRank, rankVoList, yesterdayRank } = data;
this.list = rankVoList || [];
@@ -238,7 +238,7 @@ export default {
this.yesterdayRank = yesterdayRank || [];
this.myRank = myRank;
} else {
this.$toast.fail(msg);
this.$toast.fail(message);
}
}
}
+2 -2
View File
@@ -83,7 +83,7 @@ export default {
})
.then(res => {
this.loading = false;
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
if (this.page === 1 && (!data || data.length === 0)) {
this.$toast.fail("您还没有抽奖记录哦,赶紧去参与抽奖吧!");
@@ -100,7 +100,7 @@ export default {
// this.SetLotteryRecordRateVo(lotteryRecordRateVo);
if (data.length < this.pageSize) this.finished = true;
} else {
this.$toast.fail(msg);
this.$toast.fail(message);
}
})
.catch(() => {
+154
View File
@@ -0,0 +1,154 @@
<template>
<div class="record-list">
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<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>
</van-pull-refresh>
</div>
</template>
<script>
import { mapMutations, mapGetters } from "vuex";
import { drawRecord } from "@/api";
import recordItem from "./recordItem.vue";
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,
refreshing: false,
recordList: [],
pageSize: 10,
page: 1,
error: false
};
},
computed: {
...mapGetters(["drawType"]),
actId() {
return this.$route.query.actId;
}
},
created() {
// this.getDrawRecord();
// console.log("created");
},
mounted() {
this.page = 1;
},
methods: {
...mapMutations(["SetLotteryRecordRateVo"]),
// loadData() {},
getDrawRecord() {
this.loading = true;
drawRecord({
actId: this.actId,
drawType: this.drawType,
sortType: this.sortType,
page: this.page,
pageSize: this.pageSize
})
.then(res => {
this.loading = false;
const { code, data, message } = res;
if (code === 200) {
if (this.page === 1 && (!data || data.length === 0)) {
this.$toast.fail("您还没有抽奖记录哦,赶紧去参与抽奖吧!");
this.finished = true;
this.refreshing = false;
return;
}
if (this.refreshing) {
this.recordList = [];
this.refreshing = false;
}
// const { drawPrizeItemVos, lotteryRecordRateVo } = data;
this.recordList = this.recordList.concat(data);
// this.SetLotteryRecordRateVo(lotteryRecordRateVo);
if (data.length < this.pageSize) this.finished = true;
} else {
this.$toast.fail(message);
}
})
.catch(() => {
this.loading = false;
this.$toast.fail("获取抽奖记录失败!");
});
this.page++;
},
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;
},
onRefresh() {
this.finished = false;
this.page = 1;
this.getDrawRecord();
}
}
};
</script>
<style lang="less" scoped>
.record-list {
padding: 20px 30px;
&-item {
margin-top: 40px;
}
&:first-child {
margin-top: 0;
}
}
</style>
+2 -2
View File
@@ -72,11 +72,11 @@ export default {
getQueryPrizeMsg() {
queryPrizeMsg({ actId: this.actId, drawType: this.drawType }).then(
res => {
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
this.recordList = data;
} else {
this.$toast.fail(msg);
this.$toast.fail(message);
}
}
);
+7
View File
@@ -0,0 +1,7 @@
import BoboEnterBtn from "./main";
BoboEnterBtn.install = function(Vue) {
Vue.component(BoboEnterBtn.name, BoboEnterBtn);
};
export default BoboEnterBtn;
+44
View File
@@ -0,0 +1,44 @@
<template>
<button class="wheel-enter-btn" :class="positionClass">
<span>
<slot></slot>
</span>
</button>
</template>
<script>
export default {
name: "WheelEnterBtn",
props: {
position: {
type: String,
default: "right"
}
},
computed: {
positionClass() {
return `wheel-enter-btn-${this.position}`;
}
}
};
</script>
<style lang="less" scoped>
.wheel-enter-btn {
width: 119px;
height: 60px;
background-repeat: no-repeat;
background-size: cover;
border: none;
background-color: transparent;
line-height: 46px;
&-right {
background-image: url(../../assets/images/wheel/button_bg.png);
}
& > span {
color: #ffffff;
opacity: 0.8;
font-size: 20px;
}
}
</style>
+7
View File
@@ -0,0 +1,7 @@
import BoboEnterView from "./main";
BoboEnterView.install = function(Vue) {
Vue.component(BoboEnterView.name, BoboEnterView);
};
export default BoboEnterView;
+53
View File
@@ -0,0 +1,53 @@
<template>
<div class="wheel-enter-view">
<div class="wheel-enter-view-row">
<wheel-enter-Btn
class="wheel-enter-view-button"
position="right"
@click.native="clickEntryBtn('排行榜')"
>排行榜</wheel-enter-Btn
>
</div>
<div class="wheel-enter-view-row">
<wheel-enter-Btn
class="wheel-enter-view-button"
position="right"
@click.native="clickEntryBtn('记录')"
>抽奖记录</wheel-enter-Btn
>
</div>
</div>
</template>
<script>
import wheelEnterBtn from "../wheelEnterBtn";
export default {
name: "wheelEnterView",
components: {
wheelEnterBtn
},
methods: {
clickEntryBtn(text) {
// console.log("clickEntryBtn", text);
this.$emit("clickEntryBtn", text);
}
}
};
</script>
<style lang="less" scoped>
.wheel-enter-view {
width: 100%;
height: 172px;
&-row {
display: flex;
justify-content: end;
margin-top: 40px;
&:first-child {
margin-top: 0;
}
}
&-button {
}
}
</style>