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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

+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>
+14 -7
View File
@@ -25,8 +25,8 @@ const checkVersion = function() {
webApp: u.indexOf("Safari") > -1, // 是否web应该程序,没有头部与底部
weixin: u.indexOf("MicroMessenger") > -1, // 是否微信
qq: u.match(/\sQQ/i) === " qq", // 是否QQ
tutuApp: u.match("tutuApp"),
app: u.match("tutuApp") // 是否在app内
tutuApp: u.match("toupaiApp"),
app: u.match("toupaiApp") // 是否在app内
};
};
@@ -212,11 +212,18 @@ const getMsgFromDevice = function() {
info.ticket = tools.nativeUtils.getTicket();
info.appVersion = tools.nativeUtils.getAppVersion();
} else {
info.roomUid = 904860;
info.uid = 1000002;
info.deviceId = "afhksafhksajhfs1kjahsfkjsf0000aaaaaaaacaa";
info.ticket =
"eyJhbGciOiJIUzI1NiJ9.eyJ0aWNrZXRfdHlwZSI6bnVsbCwidWlkIjo5MTMzOSwidGlja2V0X2lkIjoiOGJmMTdlYmQtMTY4ZC00NTliLWI0NzUtMDU3M2Y1ZmM4MDQzIiwiZXhwIjozNjAwLCJjbGllbnRfaWQiOiJlcmJhbi1jbGllbnQifQ.MnKGEc6bSkyOkCbx26lib6J0koFDA2uiKnbwkhdk3MU";
const params = getQueryString();
if (
params.debug === true ||
params.debug === "true" ||
location.hostname === "localhost"
) {
info.roomUid = 904860;
info.uid = 1000002;
info.deviceId = "afhksafhksajhfs1kjahsfkjsf0000aaaaaaaacaa";
info.ticket =
"eyJhbGciOiJIUzI1NiJ9.eyJ0aWNrZXRfdHlwZSI6bnVsbCwidWlkIjo5MTMzOSwidGlja2V0X2lkIjoiOGJmMTdlYmQtMTY4ZC00NTliLWI0NzUtMDU3M2Y1ZmM4MDQzIiwiZXhwIjozNjAwLCJjbGllbnRfaWQiOiJlcmJhbi1jbGllbnQifQ.MnKGEc6bSkyOkCbx26lib6J0koFDA2uiKnbwkhdk3MU";
}
}
return info;
};
+11 -5
View File
@@ -8,12 +8,18 @@ const routes = [
path: "/",
name: "Home",
component: () => import(/* webpackChunkName: "Home" */ "../views/Home.vue")
},
{
path: "/bobo",
name: "Bobo",
component: () => import(/* webpackChunkName: "Bobo" */ "../views/bobo.vue")
}
// {
// path: "/bobo",
// name: "Bobo",
// component: () => import(/* webpackChunkName: "Bobo" */ "../views/bobo.vue")
// },
// {
// path: "/wheel",
// name: "Wheel",
// component: () =>
// import(/* webpackChunkName: "Wheel" */ "../views/wheel.vue")
// }
];
const router = new VueRouter({
+20 -8
View File
@@ -205,13 +205,13 @@ export default new Vuex.Store({
actId: locateObj.actId
})
.then(res => {
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
const list = data[drawTypes];
commit("SetDrawTypePrizeInfo", { drawType: drawTypes, list });
resolve(list);
} else {
Toast.fail(msg);
Toast.fail(message);
reject(res);
}
})
@@ -224,7 +224,7 @@ export default new Vuex.Store({
getqueryTicketRule({ commit }, drawType) {
queryTicketRule({ drawType: drawType, actId: locateObj.actId })
.then(res => {
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
const { timesRule } = data;
if (!timesRule) return;
@@ -236,7 +236,7 @@ export default new Vuex.Store({
}
commit("SetTicketRule", json || null);
} else {
Toast.fail(msg);
Toast.fail(message);
}
})
.catch(() => {
@@ -244,6 +244,18 @@ export default new Vuex.Store({
});
},
runLottery({ state, commit }) {
if (!locateObj.actId) {
Toast.fail("获取活动信息失败!");
return;
}
if (!info.roomUid) {
Toast.fail("获取房间信息失败!");
return;
}
if (!info.deviceId) {
Toast.fail("获取设备id失败!");
return;
}
return new Promise((resolve, reject) => {
doLottery({
actId: locateObj.actId,
@@ -254,13 +266,13 @@ export default new Vuex.Store({
deviceId: info.deviceId
})
.then(res => {
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
commit("SetRemainTicketNum", data.remainTicketNum || 0);
commit("SetLotteryData", data);
// dispatch("postSaveLog", option);
} else {
Toast.fail(msg);
Toast.fail(message);
}
resolve(res);
})
@@ -282,12 +294,12 @@ export default new Vuex.Store({
getQueryTicketNum({ commit }) {
queryTicketNum({ deviceId: info.deviceId, actId: locateObj.actId })
.then(res => {
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
commit("SetRemainTicketNum", data.num || 0);
commit("SetGoldNum", data.goldNum || 0);
} else {
Toast.fail(msg);
Toast.fail(message);
}
})
.catch(() => {
+3 -1
View File
@@ -5,4 +5,6 @@
@empty-description-color: #AFAAFF;
@list-text-color: #AFAAFF;
@list-text-color: #AFAAFF;
// @button-plain-background-color: rgba(0, 0, 0, 0);
+2 -2
View File
@@ -3,7 +3,7 @@
<div class="prizes-view-content">
<van-tabs v-model="active" animated>
<van-tab
title="幸运扭扭蛋"
title="幸运扭蛋"
name="turntable1"
title-class="prizes-view-content-tableft"
>
@@ -12,7 +12,7 @@
</div>
</van-tab>
<van-tab
title="豪华扭扭蛋"
title="至尊扭蛋"
name="turntable2"
title-class="prizes-view-content-tabright"
>
+2 -2
View File
@@ -37,11 +37,11 @@ export default {
ruleTip() {
getRulePic({ drawType: this.drawType, actId: this.actId })
.then(res => {
const { code, data, msg } = res;
const { code, data, message } = res;
if (code === 200) {
this.ruleContent = data;
} else {
this.$toast.fail(msg);
this.$toast.fail(message);
}
})
.catch(() => {
+115
View File
@@ -0,0 +1,115 @@
<template>
<div class="wheel">
<swiper-notice class="wheel-notice" :text="text"></swiper-notice>
<wheel-enter-view
class="wheel-enter"
@clickEntryBtn="clickEntryBtn"
></wheel-enter-view>
<van-button
class="wheel-gz-button"
plain
type="info"
size="small"
round
color="#fff"
@click="clickLeftTopButton"
>规 则</van-button
>
<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>
</template>
<script>
import wheelEnterView from "@/components/wheelEnterView";
import swiperNotice from "@/components/swiperNotice";
export default {
name: "Wheel",
components: {
wheelEnterView,
swiperNotice,
prizesView: resolve => require(["./prizesView.vue"], resolve),
ruleView: resolve => require(["./ruleView.vue"], resolve),
recordView: resolve => require(["./recordView.vue"], resolve),
rankView: resolve => require(["./rankView.vue"], resolve),
dataView: resolve => require(["./dataView.vue"], resolve)
},
data() {
return {
text: "戳中了",
show: false,
curBtnText: "",
componentsName: {
规则: "rule-view",
奖品: "prizes-view",
排行榜: "rank-view",
记录: "record-view",
数据: "data-view"
}
};
},
computed: {
curComponentsName() {
return this.componentsName[this.curBtnText];
}
},
methods: {
clickEntryBtn(val) {
this.curBtnText = val;
this.show = true;
},
clickLeftTopButton() {
this.curBtnText = "规则";
this.show = true;
}
}
};
</script>
<style lang="less" scoped>
.wheel {
height: 100%;
position: relative;
background-color: #50127e;
background-image: url(../assets/images/wheel/wheel_bg.png);
background-repeat: no-repeat;
background-size: 100%;
overflow: hidden;
&-notice {
margin-top: 130px;
}
&-enter {
// padding-top: 20px;
}
&-gz-button {
// width: 78px;
height: 50px;
// background-repeat: no-repeat;
// background-size: cover;
// border: none;
// background-color: transparent;
// background-image: url(../assets/images/bobo/but_rk_gz.png);
position: absolute;
top: 26px;
left: 25px;
opacity: 0.8;
color: #fff;
background-color: transparent;
}
}
</style>