Compare commits

..
11 Commits
Author SHA1 Message Date
dengtongyu 93082df000 feat: 更新 2023-04-28 19:39:14 +08:00
dengtongyu c3bfb65096 feat: 更新 2023-04-23 01:13:23 +08:00
dengtongyu 125a656002 feat: 更新 2023-04-19 23:52:43 +08:00
dengtongyu 4376017d12 feat: 更新 2023-04-19 22:24:01 +08:00
dengtongyu 851c940895 feat: 更新 2023-04-17 09:11:07 +08:00
dengtongyu 145fbcf834 feat: 更新 2023-04-16 14:46:02 +08:00
dengtongyu f717386d54 feat; 更新 2023-04-11 22:50:42 +08:00
dengtongyu 2419fca977 feat:update 2023-04-11 15:34:19 +08:00
dengtongyu a348a79259 feat:update 2023-04-11 08:37:53 +08:00
dengtongyu d297e6b825 feat: 更新 2023-04-06 00:28:00 +08:00
dengtongyu 5f63979f9f feat; 更新业务 2023-04-06 00:22:33 +08:00
55 changed files with 1652 additions and 343 deletions

No files matched your search

+2 -1
View File
@@ -5,7 +5,8 @@
"scripts": { "scripts": {
"serve:test": "cross-env VUE_APP_PROXY=1 vue-cli-service serve", "serve:test": "cross-env VUE_APP_PROXY=1 vue-cli-service serve",
"serve:prod": "cross-env VUE_APP_PROXY=2 vue-cli-service serve", "serve:prod": "cross-env VUE_APP_PROXY=2 vue-cli-service serve",
"build": "vue-cli-service build", "build:test": "cross-env VUE_APP_PROXY=1 vue-cli-service build",
"build:prod": "cross-env VUE_APP_PROXY=2 vue-cli-service build",
"lint": "vue-cli-service lint --fix" "lint": "vue-cli-service lint --fix"
}, },
"dependencies": { "dependencies": {
+3 -3
View File
@@ -7,13 +7,13 @@ let target = "";
switch (VUE_APP_PROXY) { switch (VUE_APP_PROXY) {
case 1: case 1:
target = "http://im.haloapp.vip"; target = "http://apibeta.haloapp.vip";
break; break;
case 2: case 2:
target = "http://haloapp.vip"; target = "https://api.xingyuwenhua.com.cn";
break; break;
default: default:
target = "http://test.haloapp.vip"; target = "https://api.xingyuwenhua.com.cn";
} }
let proxyTable = { let proxyTable = {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+14 -4
View File
@@ -1,18 +1,20 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="zh">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"> <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.jpg">
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
<style> <style>
.yf-loading {display:inline-block;width:80px;height:80px;background-image:url("data:image/png;base64,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 truncated body {background-color: #18012d;}
.yf-loading:after {content:" ";display:block;width:80px;height:80px;box-sizing:border-box;border-radius:50%;border:4px solid #9E98FF;border-color:#9E98FF transparent #9E98FF transparent;animation:xtbg-loading 1.3s linear infinite;} .yf-loading {display:inline-block;width:40px;height:40px;position:fixed;margin-left:-20px;margin-top:-20px;left:50%;top:50%;border-radius: 50%; overflow: hidden;}
.yf-loading:after {content:" ";display:block;width:40px;height:40px;box-sizing:border-box;border-radius:50%;border:3px solid #9E98FF;border-color:#9E98FF transparent #9E98FF transparent;animation:xtbg-loading 1.3s linear infinite;}
@keyframes xtbg-loading {0% {transform:rotate(0deg);} @keyframes xtbg-loading {0% {transform:rotate(0deg);}
100% {transform:rotate(360deg);} 100% {transform:rotate(360deg);}
} }
</style> </style>
<script>window.info = {};window.getMessage = function(key, value) {window.info[key] = value;};</script>
</head> </head>
<body> <body>
<noscript> <noscript>
@@ -20,5 +22,13 @@
</noscript> </noscript>
<div id="app"><div class="yf-loading"></div></div> <div id="app"><div class="yf-loading"></div></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
<script>
;(function () {
if (!/vconsole=true/.test(window.location)) return;
var src = 'https://unpkg.com/vconsole@latest/dist/vconsole.min.js';
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
document.write('<scr' + 'ipt>var vConsole = new window.VConsole();</scr' + 'ipt>');
})();
</script>
</body> </body>
</html> </html>
+28 -14
View File
@@ -1,53 +1,64 @@
import ajax from "@/lib/ajax"; import ajax from "@/lib/ajax";
import config from "@/config";
import { stringify } from "qs"; import { stringify } from "qs";
// host // host
const HOST = config.host("/api", "/act"); const HOST = "/api/act/lottery";
// 获取奖品信息 // 获取奖品信息
const queryPrizeInfo = param => { const queryPrizeInfo = param => {
return ajax.get(`${HOST}/queryPrizeInfo`, param); return ajax.get(`${HOST}/queryPrizeList`, { params: param });
}; };
// 获取余额 // 获取余额
const queryTicketNum = param => { const queryTicketNum = param => {
return ajax.get(`${HOST}/queryTicketNum`, param); return ajax.get(`${HOST}/queryTicketNum`, { params: param });
}; };
// 获取抽奖规则次数 // 获取抽奖规则次数
const queryTicketRule = param => { const queryTicketRule = param => {
return ajax.get(`${HOST}/queryTicketRule`, param); return ajax.get(`${HOST}/queryTicketRule`, { params: param });
}; };
// 抽奖 // 抽奖
const doLottery = param => { const doLottery = param => {
return ajax.post(`${HOST}/doLottery`, stringify(param), "form"); return ajax.post(`${HOST}/doLottery`, stringify(param));
}; };
// 保存抽奖结果 // 保存抽奖结果
const saveLog = param => { const saveLog = param => {
return ajax.post(`${HOST}/saveLog`, stringify(param), "form"); return ajax.post(`${HOST}/saveLog`, stringify(param));
}; };
// 抽奖中奖信息 // 抽奖中奖信息
const queryPrizeMsg = param => { const queryPrizeMsg = param => {
return ajax.get(`${HOST}/queryPrizeMsg`, param); return ajax.get(`${HOST}/queryPrizeMsgList`, { params: param });
}; };
// 规则 // 规则
const getRuleTip = param => { const getRulePic = param => {
return ajax.get(`${HOST}/getRuleTip`, param); return ajax.get(`${HOST}/getRulePic`, { params: param });
}; };
// 抽奖记录 // 抽奖记录
const drawRecord = param => { const drawRecord = param => {
return ajax.get(`${HOST}/drawRecord`, param); return ajax.get(`${HOST}/queryLotteryRecordList`, { params: param });
}; };
// 数据查询 // 数据查询
const rateList = param => { const rateList = param => {
return ajax.post(`${HOST}/rateList`, stringify(param), "form"); return ajax.post(`${HOST}/rateList`, { data: param });
};
const queryPackList = param => {
return ajax.get(`${HOST}/queryPackList`, { params: param });
};
const buyPack = param => {
return ajax.post(`${HOST}/buyPack`, stringify(param));
};
const buyAndLottery = param => {
return ajax.post(`${HOST}/lottery`, stringify(param));
}; };
export { export {
@@ -57,7 +68,10 @@ export {
doLottery, doLottery,
saveLog, saveLog,
queryPrizeMsg, queryPrizeMsg,
getRuleTip,
drawRecord, drawRecord,
rateList rateList,
getRulePic,
queryPackList,
buyPack,
buyAndLottery
}; };
Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 51 KiB

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: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 12 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"; return "notice-hh";
}, },
modeName() { modeName() {
if (this.drawType === "turntable1") return "幸运扭扭蛋"; if (this.drawType === "turntable1") return "幸运扭蛋";
return "豪华扭扭蛋"; return "至尊扭蛋";
}, },
text() { text() {
return `在${this.modeName}获得了`; return `在${this.modeName}获得了`;
+5 -5
View File
@@ -15,10 +15,10 @@ import { mapGetters, mapActions } from "vuex";
export default { export default {
name: "BoboYqView", name: "BoboYqView",
props: { props: {
uid: { // actId: {
type: [String, Number], // type: [String, Number],
default: "" // default: ""
} // }
}, },
computed: { computed: {
...mapGetters(["remainTicketNum"]) ...mapGetters(["remainTicketNum"])
@@ -27,7 +27,7 @@ export default {
...mapActions(["getQueryTicketNum"]) ...mapActions(["getQueryTicketNum"])
}, },
created() { created() {
this.getQueryTicketNum({ uid: this.uid }); this.getQueryTicketNum();
} }
}; };
</script> </script>
+5 -13
View File
@@ -1,9 +1,9 @@
<template> <template>
<div> <div>
<div class="bobo-lottery"> <div class="bobo-lottery">
<bobo-yq-view :uid="uid"></bobo-yq-view> <bobo-yq-view></bobo-yq-view>
<bobo-lottery-count></bobo-lottery-count> <bobo-lottery-count></bobo-lottery-count>
<button class="bobo-lottery-button" @touchend="clickLottery"></button> <button class="bobo-lottery-button" @click="clickLottery"></button>
</div> </div>
<lottery-prizes-dialog <lottery-prizes-dialog
v-model="show" v-model="show"
@@ -35,13 +35,7 @@ export default {
"remainTicketNum", "remainTicketNum",
"curTicketRuleValue", "curTicketRuleValue",
"lotteryPrizeItemList" "lotteryPrizeItemList"
]), ])
uid() {
return this.$route.query.uid;
},
roomUid() {
return this.$route.query.roomUid;
}
}, },
methods: { methods: {
...mapMutations(["SetCanLottery"]), ...mapMutations(["SetCanLottery"]),
@@ -60,13 +54,11 @@ export default {
this.remainTicketNum < this.curTicketRuleValue this.remainTicketNum < this.curTicketRuleValue
) { ) {
this.$toast.fail("余额不足!"); this.$toast.fail("余额不足!");
this.SetCanLottery(true);
return; return;
} }
this.runLottery({ this.runLottery()
uid: this.uid,
roomUid: this.roomUid
})
.then(res => { .then(res => {
this.SetCanLottery(true); this.SetCanLottery(true);
const { code } = res; const { code } = res;
+45 -6
View File
@@ -1,14 +1,22 @@
<template> <template>
<div class="balance-view" :class="modeClass"> <div class="balance-view" :class="modeClass">
<div class="balance-view-text"> <div class="balance-view-text">
<label>鱼券:</label> <p>
<span>{{ value }}</span> <label>{{ unitStr }}</label>
<span>{{ value }}</span>
</p>
<p>
<label>{{ moneyStr }}</label>
<span>{{ goldNum }}</span>
</p>
</div> </div>
<div class="balance-view-btn" @touchstart="() => {}"></div> <div class="balance-view-btn" @click="clickHandler"></div>
</div> </div>
</template> </template>
<script> <script>
import { unit, money } from "@/config";
import eventBus from "@/lib/eventBus";
export default { export default {
name: "BalanceView", name: "BalanceView",
props: { props: {
@@ -19,12 +27,33 @@ export default {
value: { value: {
type: Number, type: Number,
default: 0 default: 0
},
goldNum: {
type: Number,
default: 0
} }
}, },
data() {
return {
unit,
money
};
},
computed: { computed: {
modeClass() { modeClass() {
if (this.drawType === "turntable1") return "balance-view-xy"; if (this.drawType === "turntable1") return "balance-view-xy";
return "balance-view-hh"; return "balance-view-hh";
},
unitStr() {
return `${unit}:`;
},
moneyStr() {
return `${money}:`;
}
},
methods: {
clickHandler() {
eventBus.$emit("rechargeView");
} }
} }
}; };
@@ -38,20 +67,27 @@ export default {
background-size: cover; background-size: cover;
display: flex; display: flex;
align-items: center; align-items: center;
&-text { &-text {
flex: 1; flex: 1;
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; flex-direction: column;
// align-items: center;
justify-content: center;
padding-left: 30px; padding-left: 30px;
font-size: 24px; font-size: 24px;
& > label { line-height: 30px;
label {
color: #fff; color: #fff;
} }
& > span {
span {
color: #ffe26c; color: #ffe26c;
} }
} }
&-btn { &-btn {
width: 100px; width: 100px;
height: 100px; height: 100px;
@@ -60,14 +96,17 @@ export default {
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
background-image: url(../../assets/images/cz_bth.png); background-image: url(../../assets/images/cz_bth.png);
&:active { &:active {
background-image: url(../../assets/images/cz_bth_a.png); background-image: url(../../assets/images/cz_bth_a.png);
} }
} }
} }
.balance-view-xy { .balance-view-xy {
background-image: url(../../assets/images/yue_bg.png); background-image: url(../../assets/images/yue_bg.png);
} }
.balance-view-hh { .balance-view-hh {
background-image: url(../../assets/images/yue_bg_g.png); background-image: url(../../assets/images/yue_bg_g.png);
} }
+1 -1
View File
@@ -1,5 +1,5 @@
<template> <template>
<div class="lottery-btn" :class="modeClass" @touchend="clickLottery"></div> <div class="lottery-btn" :class="modeClass" @click="clickLottery"></div>
</template> </template>
<script> <script>
+3 -1
View File
@@ -4,6 +4,7 @@
<balance-view <balance-view
:drawType="drawType" :drawType="drawType"
:value="remainTicketNum" :value="remainTicketNum"
:goldNum="goldNum"
></balance-view> ></balance-view>
<lottery-btn :drawType="drawType"></lottery-btn> <lottery-btn :drawType="drawType"></lottery-btn>
</div> </div>
@@ -47,6 +48,7 @@ export default {
computed: { computed: {
...mapGetters([ ...mapGetters([
"remainTicketNum", "remainTicketNum",
"goldNum",
"ticketRule", "ticketRule",
"ticketRuleList", "ticketRuleList",
"ticketRuleConfig" "ticketRuleConfig"
@@ -72,7 +74,7 @@ export default {
} }
}, },
created() { created() {
this.getQueryTicketNum({ uid: this.uid }); this.getQueryTicketNum();
this.getqueryTicketRule(this.drawType); this.getqueryTicketRule(this.drawType);
}, },
methods: { methods: {
+7
View File
@@ -0,0 +1,7 @@
import BuyGiftPop from "./main";
BuyGiftPop.install = function(Vue) {
Vue.component(BuyGiftPop.name, BuyGiftPop);
};
export default BuyGiftPop;
+168
View File
@@ -0,0 +1,168 @@
<template>
<div class="buy-Gift-pop">
<h3>购买限定装扮</h3>
<div class="buy-Gift-pop-main">
<div class="buy-Gift-pop-main-gift">
<div class="buy-Gift-pop-main-gift-image">
<img :src="giftUrl" />
</div>
<div class="buy-Gift-pop-main-gift-info">
<p>{{ giftName }}</p>
<p>{{ giftPrize }}</p>
<p>赠送{{ needNumber }}门票</p>
</div>
</div>
<div class="buy-Gift-pop-main-checkbox">
<van-checkbox
class="never-notice-checkbox"
v-model="neverNotice"
checked-color="#FFEF30"
>以后不再提示</van-checkbox
>
</div>
<div class="buy-Gift-pop-main-btn">
<van-button
class="buy-Gift-pop-main-btn-buy"
type="default"
color="#FFEF30"
round
block
@click="buyHandler"
>立即购买</van-button
>
</div>
</div>
</div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import { money } from "@/config";
import eventBus from "@/lib/eventBus";
export default {
name: "BuyGiftPop",
components: {},
props: {
needNumber: {
type: Number,
default: 0
}
},
data() {
return {
defaultShowImg: require("@/assets/images/logo.jpg"),
neverNotice: false
};
},
computed: {
...mapGetters([
"happyGiftList",
"curHappyGift",
"curHappyGiftSellingPrice",
"curHappyGiftUrl"
]),
giftUrl() {
if (this.curHappyGiftUrl) return this.curHappyGiftUrl;
return this.defaultShowImg;
},
giftName() {
if (this.curHappyGift && this.curHappyGift.name)
return this.curHappyGift.name;
return "";
},
giftPrize() {
if (this.curHappyGift && this.curHappyGiftSellingPrice)
return `${this.curHappyGiftSellingPrice * this.needNumber}${money}/${
this.needNumber
}天`;
return "";
}
},
watch: {},
created() {
if (this.happyGiftList.length === 0) this.loadPackList();
},
mounted() {},
methods: {
...mapActions(["loadPackList", "buyAndLottery"]),
buyHandler() {
if (this.neverNotice)
localStorage.setItem("_toupaipaidui_never_notice_", true);
// this.buyAndLottery({ packNum: this.needNumber });
eventBus.$emit("buyAndLotteryEvent", this.needNumber);
}
}
};
</script>
<style lang="less" scoped>
.buy-Gift-pop {
padding: 30px 60px;
& > h3 {
font-size: 36px;
font-family: PingFang SC;
font-weight: 800;
color: #222222;
line-height: 72px;
text-align: center;
}
&-main {
margin-top: 36px;
&-gift {
// height: 188px;
width: 100%;
display: flex;
background: linear-gradient(90deg, #d782ff 0%, #a457f4 100%);
border-radius: 30px;
padding: 24px 20px;
box-sizing: border-box;
align-items: center;
&-image {
width: 140px;
height: 140px;
background: rgba(121, 30, 188, 0.2);
border-radius: 24px;
padding: 10px;
box-sizing: border-box;
& > img {
width: 100%;
height: 100%;
border-radius: 20px;
}
}
&-info {
padding-left: 36px;
font-size: 24px;
font-family: PingFang SC;
font-weight: 500;
color: #ffffff;
line-height: 36px;
& > :first-child {
font-size: 30px;
line-height: 46px;
}
}
}
&-checkbox {
display: flex;
justify-content: center;
margin-top: 60px;
}
&-btn {
width: 320px;
height: 10px;
margin: 50px auto 0;
&-buy {
color: #222 !important;
}
}
}
}
.never-notice-checkbox {
:deep(.van-checkbox__icon--checked .van-icon) {
color: #222 !important;
}
}
</style>
+2 -2
View File
@@ -42,11 +42,11 @@ export default {
}); });
}, },
todoData(res) { todoData(res) {
const { code, data, msg } = res; const { code, data, message } = res;
if (code === 200) { if (code === 200) {
this.list = data || []; this.list = data || [];
} else { } else {
this.$toast.fail(msg); this.$toast.fail(message);
} }
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
<template> <template>
<div class="btn-view" :class="modeClass" @touchend="clickEntryBtn"> <div class="btn-view" :class="modeClass" @click="clickEntryBtn">
<div class="btn-view-touch">{{ text }}</div> <div class="btn-view-touch">{{ text }}</div>
</div> </div>
</template> </template>
+1 -1
View File
@@ -33,7 +33,7 @@ export default {
}, },
data() { data() {
return { return {
btnList: ["规则", "奖品", "排行", "记录"] btnList: ["反馈", "规则", "奖品", "记录"]
}; };
}, },
methods: { methods: {
+84 -42
View File
@@ -21,9 +21,10 @@
</template> </template>
<script> <script>
import { LuckyGrid } from "vue-luck-draw";
import lotteryPrizesDialog from "@/components/lotteryPrizesDialog";
import { mapMutations, mapGetters, mapActions } from "vuex"; import { mapMutations, mapGetters, mapActions } from "vuex";
import { LuckyGrid } from "vue-luck-draw";
import { Dialog } from "vant";
import lotteryPrizesDialog from "@/components/lotteryPrizesDialog";
import eventBus from "@/lib/eventBus"; import eventBus from "@/lib/eventBus";
export default { export default {
name: "LuckyGridView", name: "LuckyGridView",
@@ -74,7 +75,9 @@ export default {
defaultImage: require("@/assets/images/logo_tm.png"), defaultImage: require("@/assets/images/logo_tm.png"),
showDialog: false, showDialog: false,
timeout: false, timeout: false,
request: false request: false,
LotteryError: false,
LotteryErrorMsg: ""
}; };
}, },
computed: { computed: {
@@ -84,19 +87,13 @@ export default {
"remainTicketNum", "remainTicketNum",
"drawType", "drawType",
"maxVauePrizeIndex", "maxVauePrizeIndex",
"curTicketRuleValue", "lotteryPrizeItemList",
"lotteryPrizeItemList" "curLotteryTimesPrize"
]), ]),
prizesImages() { prizesImages() {
if (this.drawType === "turntable1") return this.blueImages; if (this.drawType === "turntable1") return this.blueImages;
return this.goldImages; return this.goldImages;
}, },
uid() {
return this.$route.query.uid;
},
roomUid() {
return this.$route.query.roomUid;
},
runTime() { runTime() {
if (this.ruleType === "one") return 1000; if (this.ruleType === "one") return 1000;
if (this.ruleType === "ten") return 2000; if (this.ruleType === "ten") return 2000;
@@ -136,13 +133,15 @@ export default {
} }
}, },
created() { created() {
eventBus.$on("eventLottery", this.startLottery);
},
mounted() {
this.queryPrizeInfo(); this.queryPrizeInfo();
}, },
destroyed() { mounted() {
eventBus.$on("eventLottery", this.startLottery);
eventBus.$on("buyAndLotteryEvent", this.buyAndLottery);
},
beforeDestroy() {
eventBus.$off("eventLottery", this.startLottery); eventBus.$off("eventLottery", this.startLottery);
eventBus.$off("buyAndLotteryEvent", this.buyAndLottery);
}, },
methods: { methods: {
...mapMutations([ ...mapMutations([
@@ -150,44 +149,48 @@ export default {
"SetCanLottery" "SetCanLottery"
// "SetPrizeItemList" // "SetPrizeItemList"
]), ]),
...mapActions(["getQueryPrizeInfo", "runLottery"]), ...mapActions([
"getQueryPrizeInfo",
"runLottery",
"postBuyPack",
"getQueryTicketNum"
]),
queryPrizeInfo() { queryPrizeInfo() {
this.getQueryPrizeInfo().then(res => { this.getQueryPrizeInfo().then(list => {
const { code, data } = res; this.prizes = this.configPrizes(list);
if (code === 200) {
this.prizes = this.configPrizes(data);
}
}); });
}, },
postDoLottery() { postDoLottery() {
if (
this.remainTicketNum === 0 ||
this.remainTicketNum < this.curTicketRuleValue
) {
this.$toast.fail("余额不足!");
return;
}
this.timeout = false; this.timeout = false;
this.request = false; this.request = false;
this.$refs.LuckDraw.play(); this.$refs.LuckDraw.play();
this.runLottery({ this.runLottery()
uid: this.uid, .then(res => {
roomUid: this.roomUid
}).then(res => {
const { code } = res;
if (code === 200) {
this.request = true; this.request = true;
if (this.timeout && this.request) const { code, message } = res;
this.stopLuckDraw(this.maxVauePrizeIndex); if (code === 200) {
} this.LotteryError = false;
}); if (this.timeout && this.request)
this.stopLuckDraw(this.maxVauePrizeIndex);
} else {
this.LotteryError = true;
this.LotteryErrorMsg = message;
}
this.getQueryTicketNum();
})
.catch(() => {
this.request = true;
this.LotteryError = true;
this.LotteryErrorMsg = "抽奖发生意外错误!";
});
setTimeout(() => { setTimeout(() => {
this.timeout = true; this.timeout = true;
if (this.timeout && this.request) if (this.timeout && this.request) {
this.stopLuckDraw(this.maxVauePrizeIndex); const stopIndex = this.LotteryError ? 0 : this.maxVauePrizeIndex;
this.stopLuckDraw(stopIndex);
}
}, this.runTime); }, this.runTime);
}, },
configPrizes(prizeInfo) { configPrizes(prizeInfo) {
@@ -220,8 +223,36 @@ export default {
return prizes; return prizes;
}, },
startLottery() { startLottery() {
const localNoticeStatus = localStorage.getItem(
"_toupaipaidui_never_notice_"
);
if (
this.remainTicketNum === 0 ||
this.remainTicketNum < this.curLotteryTimesPrize
) {
// this.$toast.fail("余额不足!");
const dValue = this.curLotteryTimesPrize - this.remainTicketNum;
if (localNoticeStatus) {
this.buyAndLottery(dValue);
return;
} else {
eventBus.$emit("noTickets", dValue);
this.SetCanLottery(true);
return;
}
}
this.postDoLottery(); this.postDoLottery();
}, },
buyAndLottery(dValue) {
this.postBuyPack({ packNum: dValue })
.then(() => {
this.postDoLottery();
})
.catch(() => {
this.SetCanLottery(true);
});
},
stopLuckDraw(index) { stopLuckDraw(index) {
this.$refs.LuckDraw.stop(index); this.$refs.LuckDraw.stop(index);
}, },
@@ -237,8 +268,19 @@ export default {
return num; return num;
}, },
endCallBack() { endCallBack() {
this.showDialog = true;
this.SetCanLottery(true); this.SetCanLottery(true);
if (this.LotteryError) {
Dialog.alert({
message: this.LotteryErrorMsg,
confirmButtonColor: "#9E98FF"
}).then(() => {
// on close
this.LotteryError = false;
this.LotteryErrorMsg = "";
});
} else {
this.showDialog = true;
}
// this.SetPrizeItemList(this.prizeItemList); // this.SetPrizeItemList(this.prizeItemList);
} }
} }
+2 -2
View File
@@ -109,7 +109,7 @@ export default {
}); });
}, },
todoData(res) { todoData(res) {
const { code, data, msg } = res; const { code, data, message } = res;
if (code === 200) { if (code === 200) {
const { myRank, rankVoList, yesterdayRank } = data; const { myRank, rankVoList, yesterdayRank } = data;
this.list = rankVoList || []; this.list = rankVoList || [];
@@ -238,7 +238,7 @@ export default {
this.yesterdayRank = yesterdayRank || []; this.yesterdayRank = yesterdayRank || [];
this.myRank = myRank; this.myRank = myRank;
} else { } else {
this.$toast.fail(msg); this.$toast.fail(message);
} }
} }
} }
+54 -30
View File
@@ -1,32 +1,34 @@
<template> <template>
<div class="record-list"> <div class="record-list">
<van-list <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
v-model="loading" <van-list
:finished="finished" v-model="loading"
finished-text="没有更多了" :finished="finished"
:error.sync="error" finished-text="没有更多了"
error-text="请求失败,点击重新加载" :error.sync="error"
@load="getDrawRecord" error-text="请求失败,点击重新加载"
> @load="getDrawRecord"
<div
class="record-list-item"
v-for="(item, index) in recordList"
:key="`${item.prizeId}_${index}`"
> >
<record-item <div
:img="item.prizeImgUrl" class="record-list-item"
:name="item.prizeName" v-for="(item, index) in recordList"
:dateTime="dateFormat(item.createTime)" :key="`${item.prizeId}_${index}`"
></record-item> >
</div> <record-item
</van-list> :img="item.prizeImgUrl"
:name="item.prizeName"
:dateTime="dateFormat(item.createTime)"
></record-item>
</div>
</van-list>
</van-pull-refresh>
</div> </div>
</template> </template>
<script> <script>
import { mapMutations, mapGetters } from "vuex";
import { drawRecord } from "@/api"; import { drawRecord } from "@/api";
import recordItem from "./recordItem.vue"; import recordItem from "./recordItem.vue";
import { mapMutations } from "vuex";
export default { export default {
name: "RecordItem", name: "RecordItem",
components: { components: {
@@ -47,6 +49,7 @@ export default {
return { return {
loading: false, loading: false,
finished: false, finished: false,
refreshing: false,
recordList: [], recordList: [],
pageSize: 10, pageSize: 10,
page: 1, page: 1,
@@ -54,41 +57,57 @@ export default {
}; };
}, },
computed: { computed: {
uid() { ...mapGetters(["drawType"]),
return this.$route.query.uid; actId() {
return this.$route.query.actId;
} }
}, },
created() { created() {
// this.getDrawRecord(); // this.getDrawRecord();
// console.log("created"); // console.log("created");
}, },
mounted() {
this.page = 1;
},
methods: { methods: {
...mapMutations(["SetLotteryRecordRateVo"]), ...mapMutations(["SetLotteryRecordRateVo"]),
// loadData() {},
getDrawRecord() { getDrawRecord() {
console.log("getDrawRecord");
this.loading = true; this.loading = true;
drawRecord({ drawRecord({
uid: this.uid, actId: this.actId,
drawType: this.drawType,
sortType: this.sortType, sortType: this.sortType,
page: this.page, page: this.page,
pageSize: this.pageSize pageSize: this.pageSize
}) })
.then(res => { .then(res => {
this.loading = false; this.loading = false;
const { code, data, msg } = res; const { code, data, message } = res;
if (code === 200) { if (code === 200) {
const { drawPrizeItemVos, lotteryRecordRateVo } = data; if (this.page === 1 && (!data || data.length === 0)) {
this.recordList = this.recordList.concat(drawPrizeItemVos); this.$toast.fail("您还没有抽奖记录哦,赶紧去参与抽奖吧!");
this.SetLotteryRecordRateVo(lotteryRecordRateVo); this.finished = true;
if (drawPrizeItemVos.length < this.pageSize) 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 { } else {
this.$toast.fail(msg); this.$toast.fail(message);
} }
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;
this.$toast.fail("获取抽奖记录失败!"); this.$toast.fail("获取抽奖记录失败!");
}); });
this.page++;
}, },
dateFormat(datetime, fmt = "YYYY-mm-dd HH:MM") { dateFormat(datetime, fmt = "YYYY-mm-dd HH:MM") {
let ret; let ret;
@@ -112,6 +131,11 @@ export default {
} }
} }
return fmt; return fmt;
},
onRefresh() {
this.finished = false;
this.page = 1;
this.getDrawRecord();
} }
} }
}; };
+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>
+25 -10
View File
@@ -4,12 +4,12 @@
<swiper-slide <swiper-slide
class="notice-swiper-slide" class="notice-swiper-slide"
v-for="(item, index) in recordList" v-for="(item, index) in recordList"
:key="`notice-swiper-slide-${item.id}-${index}`" :key="`notice-swiper-slide-${item.erbanNo}-${index}`"
> >
<div class="notice-swiper-slide-content"> <div class="notice-swiper-slide-content">
<label>{{ item.nick }}</label> <label>{{ item.nick }}</label>
<span>{{ text }}</span> <span>{{ text }}</span>
<label>{{ item.prizeName }}x{{ item.num }}</label> <label>{{ item.prizeName }}×{{ item.num || 1 }}</label>
</div> </div>
</swiper-slide> </swiper-slide>
</swiper> </swiper>
@@ -17,6 +17,7 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex";
import { queryPrizeMsg } from "@/api"; import { queryPrizeMsg } from "@/api";
import { Swiper, SwiperSlide } from "vue-awesome-swiper"; import { Swiper, SwiperSlide } from "vue-awesome-swiper";
export default { export default {
@@ -45,7 +46,19 @@ export default {
interval: 0 interval: 0
}; };
}, },
computed: {
...mapGetters(["drawType"]),
actId() {
return this.$route.query.actId;
}
},
watch: {
drawType() {
clearInterval(this.interval);
this.getQueryPrizeMsg();
this.interval = setInterval(this.getQueryPrizeMsg, 120 * 1000);
}
},
created() { created() {
this.getQueryPrizeMsg(); this.getQueryPrizeMsg();
}, },
@@ -57,14 +70,16 @@ export default {
}, },
methods: { methods: {
getQueryPrizeMsg() { getQueryPrizeMsg() {
queryPrizeMsg().then(res => { queryPrizeMsg({ actId: this.actId, drawType: this.drawType }).then(
const { code, data, msg } = res; res => {
if (code === 200) { const { code, data, message } = res;
this.recordList = data; if (code === 200) {
} else { this.recordList = data;
this.$toast.fail(msg); } else {
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>
+6 -1
View File
@@ -16,9 +16,14 @@ const host = (PASSID, GATEWAY) => {
return HOST; return HOST;
}; };
const money = "金币";
const unit = "门票";
module.exports = { module.exports = {
appName, appName,
YApi, YApi,
VUE_APP_PROXY, VUE_APP_PROXY,
host host,
money,
unit
}; };
+77 -50
View File
@@ -1,55 +1,82 @@
import axios from "axios"; import axios from "axios";
import { getMsgFromDevice } from "@/lib/tool";
// 添加公共请求头 const info = getMsgFromDevice();
const getHeader = function(options) {
if (options === "form") {
return Object.assign({
"content-type": "application/x-www-form-urlencoded"
});
} else if (options === "file") {
return Object.assign({ "content-type": "multipart/form-data" });
}
};
const request = function(method, url, params, options) { axios.interceptors.request.use(
return new Promise(function(resolve, reject) { function(config) {
axios config.headers.pub_ticket = info.ticket;
.request({ config.headers.pub_uid = info.uid;
headers: getHeader(options), return config;
url: url,
method: method,
withCredentials: true,
data: method === "post" ? params : {},
params: method === "get" ? params : {},
timeout: 120000,
responseType: "json"
})
.then(function(response) {
let data = response.data || JSON.parse(response.request.responseText);
resolve(data);
})
.catch(function(error) {
if (typeof error.response === "undefined") {
if (
location.hostname == "127.0.0.1" ||
location.hostname == "localhost"
) {
reject(error);
} else {
location.reload();
}
} else {
reject(error);
}
});
});
};
export default {
get: function(url, params, options) {
return request("get", url, params, options);
}, },
post: function(url, params, options) { function(error) {
return request("post", url, params, options); return Promise.reject(error);
} }
}; );
// 添加响应拦截器
axios.interceptors.response.use(
function(response) {
let data = response.data || JSON.parse(response.request.responseText);
return data;
},
function(error) {
return Promise.reject(error);
}
);
export default axios;
// // 添加公共请求头
// const getHeader = function(options) {
// if (options === "form") {
// return Object.assign({
// "content-type": "application/x-www-form-urlencoded"
// });
// } else if (options === "file") {
// return Object.assign({ "content-type": "multipart/form-data" });
// }
// };
// const request = function(method, url, params, options) {
// return new Promise(function(resolve, reject) {
// axios
// .request({
// headers: getHeader(options),
// url: url,
// method: method,
// withCredentials: true,
// data: method === "post" ? params : {},
// params: method === "get" ? params : {},
// timeout: 120000,
// responseType: "json"
// })
// .then(function(response) {
// let data = response.data || JSON.parse(response.request.responseText);
// resolve(data);
// })
// .catch(function(error) {
// if (typeof error.response === "undefined") {
// if (
// location.hostname == "127.0.0.1" ||
// location.hostname == "localhost"
// ) {
// reject(error);
// } else {
// location.reload();
// }
// } else {
// reject(error);
// }
// });
// });
// };
// export default {
// get: function(url, params, options) {
// return request("get", url, params, options);
// },
// post: function(url, params, options) {
// return request("post", url, params, options);
// }
// };
+211 -93
View File
@@ -1,121 +1,239 @@
import { CookieStorage } from "cookie-storage";
import config from "@/config";
const cookieStorage = new CookieStorage();
const systemCode = config.systemCode;
// 随机长度字符串 // 随机长度字符串
const randomString = len => { const randomString = len => {
len = len || 10; len = len || 10;
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; let chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var maxPos = chars.length; let maxPos = chars.length;
var str = ""; let str = "";
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
str += chars.charAt(Math.floor(Math.random() * maxPos)); str += chars.charAt(Math.floor(Math.random() * maxPos));
} }
return str; return str;
}; };
// 设置localStorage const checkVersion = function() {
const _setItem = (key, data) => { let u = navigator.userAgent;
localStorage.setItem(key, JSON.stringify(data)); return {
}; trident: u.indexOf("Trident") > -1, // IE内核
presto: u.indexOf("Presto") > -1, // opera内核
// 获取localStorage webKit: u.indexOf("AppleWebKit") > -1, // 苹果、谷歌内核
const _getItem = key => { gecko: u.indexOf("Gecko") > -1 && u.indexOf("KHTML") === -1, // 火狐内核
let data = localStorage.getItem(key); mobile: !!u.match(/AppleWebKit.*Mobile.*/), // 是否为移动终端
if (data) data = JSON.parse(data); ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), // ios终端
return data; android: u.indexOf("Android") > -1 || u.indexOf("Adr") > -1, // android终端
}; iPhone: u.indexOf("iPhone") > -1, // 是否为iPhone或者QQHD浏览器
iPad: u.indexOf("iPad") > -1, // 是否iPad
// 删除localStorage webApp: u.indexOf("Safari") > -1, // 是否web应该程序,没有头部与底部
const _removeItem = key => { weixin: u.indexOf("MicroMessenger") > -1, // 是否微信
localStorage.removeItem(key); qq: u.match(/\sQQ/i) === " qq", // 是否QQ
}; tutuApp: u.match("toupaiApp"),
app: u.match("toupaiApp") // 是否在app内
// 缓存用户信息
const setUserInfoCache = info => {
let data = {
account: info.account,
avatar: info.avatar,
userId: info.userId,
userName: info.userName
}; };
_setItem("__UserInfo__", data);
}; };
// 获取缓存的用户信息 // 获取当前链接参数
const getUserInfoCache = () => { const getQueryString = function() {
let data = _getItem("__UserInfo__"); const url = window.location.href;
return data; const paramArr = url.slice(url.indexOf("?") + 1).split("&");
}; const params = {};
paramArr.map(param => {
// 删除用户信息 const [key, val] = param.split("=");
const removeUserInfoCache = () => { params[key] = decodeURIComponent(val);
_removeItem("__UserInfo__");
};
// 缓存token
const setToken = value => {
let curDate = new Date();
let nextDate = new Date(curDate.getTime() + 24 * 60 * 60 * 1000);
cookieStorage.setItem("Authorization", value, {
domain: document.domain,
expires: nextDate
}); });
return params;
}; };
// 获取token const routeTypeConstant = {
const getToken = () => { ROOM_PAGE: 1, //跳转房间页 传参(routerType): uid
return cookieStorage.getItem("Authorization"); H5_PAGE: 2, // 跳转h5
PURSE_PAGE: 3, //跳转钱包页
RED_PAGE: 4, //xcRedColor
RECHARGE_PAGE: 5, //跳转充值页
PERSON_PAGE: 6, //跳转个人页 传参(routerType) : uid
CAR_PAGE: 7, //跳转座驾 传参(routerType) : 0 (装扮商城) 或者 1 (车库) // 1是跳到我的座驾
HEADWEAR_PAGE: 8, //跳转到头饰 传参(routerType) : 0 (装扮商城) 或者 1 (头饰库) // 1是跳到我的头饰
SYSTEMMESSAGE_PAGE: 9, //系统消息
FAMILY_PAGE: 10, //跳转到家族页面
GROUP_PAGE: 11, //跳转到群组
BACKGROUND_PAGE: 12, //跳转到背景设置 传参(routerType): 0 (装扮商城) 或者 1 (背景库)
NEW_USER_PAGE: 13, //新秀玩友
INVITE_FRIEND_PAGE: 14, //邀请好友
PUBLICCHAT_PAGE: 15, //公聊大厅
XCZ_ACCOUNT_PAGE: 16, //绑定 xcz 账号
PHONE_NUM_PAGE: 17, //绑定手机号
PAY_PWD_PAGE: 18, //设置支付密码
WITHDRAW_RECORD_PAGE: 19, //提现记录页面
RECOMMEND_CARD_PAGE: 20, //跳转到推荐卡仓库
TASK_CENTER_PAGE: 27, // 跳转到任务中心就是萝卜不足也是跳那里
TEACHER_PUPIL_PAGE: 28, //跳转到师徒页面入口
SQUARE_PUBLISH: 51, // 发布动态
FEEDPACK_PAGE: 52 //跳转反馈页面入口
}; };
// 删除token // 客户端方法
const removeToken = () => { const tools = {
cookieStorage.removeItem("Authorization"); cookieUtils: {
}; set: function(key, val, time) {
let date = new Date();
let expiresDays = time;
date.setTime(date.getTime() + expiresDays * 24 * 3600 * 1000);
document.cookie = key + "=" + val + ";expires=" + date.toGMTString();
},
// 缓存用户权限 get: function(key) {
const setUserPowerCache = arr => { let getCookie = document.cookie.replace(/[ ]/g, "");
let map = {}; let arrCookie = getCookie.split(";");
for (let i = 0; i < arr.length; i++) { let val;
let k = arr[i].powerCode; for (let i = 0; i < arrCookie.length; i++) {
map[k] = arr[i]; let arr = arrCookie[i].split("=");
if (key === arr[0]) {
val = arr[1];
break;
}
}
return val;
},
delete: function(key) {
let date = new Date();
date.setTime(date.getTime() - 10000);
document.cookie = key + "+v; expires =" + date.toGMTString();
}
},
nativeUtils: {
jumpAppointPage: function(type, val) {
// routerType 跳转名称
// routerVal 跳转需要传的参数
let browser = checkVersion();
let jumpObj = {};
jumpObj.routerType = routeTypeConstant[type];
if (val) jumpObj.routerVal = val;
if (browser.app) {
if (browser.ios) {
if (type.indexOf("_") > -1) {
window.webkit.messageHandlers.jumpAppointPage.postMessage(jumpObj);
} else {
if (val) {
window.webkit.messageHandlers.type.postMessage(val);
} else {
window.webkit.messageHandlers.type.postMessage(null);
}
}
} else if (browser.android) {
// eslint-disable-next-line no-undef
if (androidJsObj && typeof androidJsObj === "object") {
if (type.indexOf("_") > -1) {
window.androidJsObj.jumpAppointPage(JSON.stringify(jumpObj));
} else {
window.androidJsObj.jumpAppointPage(type);
}
}
}
}
},
getUid: function() {
let browser = checkVersion();
let val;
if (browser.app) {
if (browser.ios) {
val = tools.cookieUtils.get("uid");
} else if (browser.android) {
// eslint-disable-next-line no-undef
if (androidJsObj && typeof androidJsObj === "object") {
val = parseInt(window.androidJsObj.getUid());
}
}
} else {
let locate = getQueryString();
if (!locate.uid && !locate.shareUid) {
val = 901189;
} else {
if (locate.shareUid) {
val = locate.shareUid;
} else {
val = locate.uid;
}
}
}
return val;
},
getTicket: function() {
let browser = checkVersion();
let val;
if (browser.app) {
if (browser.ios) {
val = window.webkit.messageHandlers.getTicket.postMessage(null);
} else if (browser.android) {
// eslint-disable-next-line no-undef
if (androidJsObj && typeof androidJsObj === "object") {
val = window.androidJsObj.getTicket();
}
}
} else {
val = "app外";
}
return val;
},
getAppVersion: function() {
let browser = checkVersion();
let val;
if (browser.app) {
if (browser.ios) {
val = window.webkit.messageHandlers.getAppVersion.postMessage(null);
} else {
val = window.androidJsObj.getAppVersion();
}
}
return val;
}
} }
_setItem(`__UserPower_${systemCode}__`, map);
}; };
// 获取缓存的用户权限 const getMsgFromDevice = function() {
const getUserPowerCache = () => { let browser = checkVersion();
let data = _getItem(`__UserPower_${systemCode}__`); let info = {};
return data; if (browser.app) {
}; if (browser.ios) {
window.webkit.messageHandlers.getDeviceId.postMessage(null);
window.webkit.messageHandlers.getRoomUid.postMessage(null);
} else if (browser.android) {
// eslint-disable-next-line no-undef
if (androidJsObj && typeof androidJsObj === "object") {
window.info.deviceId = window.androidJsObj.getDeviceId();
window.info.roomUid = window.androidJsObj.getRoomUid();
}
// 获取指定的用户权限 window.info.appVersion = tools.nativeUtils.getAppVersion();
const getUserSomeonePowerCache = code => { }
let data = getUserPowerCache();
let item = null;
if (data) item = data[code];
return item;
};
// 删除用户权限 window.info.uid = tools.nativeUtils.getUid();
const removeUserPowerCache = () => { window.info.ticket = tools.nativeUtils.getTicket();
_removeItem(`__UserPower_${systemCode}__`); window.info.appVersion = tools.nativeUtils.getAppVersion();
} else {
const params = getQueryString();
if (
params.debug === true ||
params.debug === "true" ||
location.hostname === "localhost"
) {
window.info.roomUid = 90022;
window.info.uid = 90107;
window.info.deviceId = "afhksafhksajhfs1kjahsfkjsf0000aaaaaaaacaa";
window.info.ticket =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0aWNrZXRfdHlwZSI6bnVsbCwidWlkIjo5MDEwNywidGlja2V0X2lkIjoiMmYxYWEyNjgtYjFjYS00ZDM1LTkxMTYtODg5NWI1NDFlMDE3IiwiZXhwIjozNjAwLCJjbGllbnRfaWQiOiJlcmJhbi1jbGllbnQifQ.Z0gZSGQyCHMX6OR_g_sH6JiCRZ8ete7S76ed4QIR2CU";
}
}
info = window.info;
return info;
}; };
export { export {
randomString, randomString,
setUserInfoCache, checkVersion,
getUserInfoCache, tools,
removeUserInfoCache, getQueryString,
setToken, getMsgFromDevice,
getToken, routeTypeConstant
removeToken,
setUserPowerCache,
getUserPowerCache,
removeUserPowerCache,
getUserSomeonePowerCache
}; };
+9 -1
View File
@@ -11,7 +11,11 @@ import {
Image as VanImage, Image as VanImage,
List, List,
Empty, Empty,
Icon Icon,
PullRefresh,
Button,
Checkbox,
CheckboxGroup
} from "vant"; } from "vant";
Vue.config.productionTip = false; Vue.config.productionTip = false;
@@ -25,6 +29,10 @@ Vue.use(VanImage);
Vue.use(List); Vue.use(List);
Vue.use(Empty); Vue.use(Empty);
Vue.use(Icon); Vue.use(Icon);
Vue.use(PullRefresh);
Vue.use(Button);
Vue.use(Checkbox);
Vue.use(CheckboxGroup);
new Vue({ new Vue({
router, router,
+16 -3
View File
@@ -9,10 +9,23 @@ const routes = [
name: "Home", name: "Home",
component: () => import(/* webpackChunkName: "Home" */ "../views/Home.vue") component: () => import(/* webpackChunkName: "Home" */ "../views/Home.vue")
}, },
// {
// path: "/bobo",
// name: "Bobo",
// component: () => import(/* webpackChunkName: "Bobo" */ "../views/bobo.vue")
// },
// {
// path: "/wheel",
// name: "Wheel",
// component: () =>
// import(/* webpackChunkName: "Wheel" */ "../views/wheel.vue")
// }
{ {
path: "/bobo", path: "/rank",
name: "Bobo", name: "rank",
component: () => import(/* webpackChunkName: "Bobo" */ "../views/bobo.vue") component: () =>
import(/* webpackChunkName: "rank" */ "../views/rankView.vue")
} }
]; ];
+171 -28
View File
@@ -6,8 +6,15 @@ import {
queryTicketRule, queryTicketRule,
doLottery, doLottery,
saveLog, saveLog,
queryTicketNum queryTicketNum,
queryPackList,
buyPack
} from "@/api"; } from "@/api";
import { getMsgFromDevice, getQueryString } from "@/lib/tool";
import { unit } from "@/config";
const info = getMsgFromDevice();
const locateObj = getQueryString();
Vue.use(Vuex); Vue.use(Vuex);
@@ -21,6 +28,9 @@ export default new Vuex.Store({
// prizeItemList: [], // prizeItemList: [],
ruleType: "one", ruleType: "one",
remainTicketNum: 0, remainTicketNum: 0,
goldNum: 0,
turntable: {},
happyGiftList: [],
ticketRule: null, ticketRule: null,
canLottery: true, canLottery: true,
lotteryRecordRateVo: {}, lotteryRecordRateVo: {},
@@ -71,12 +81,34 @@ export default new Vuex.Store({
remainTicketNum: state => { remainTicketNum: state => {
return state.remainTicketNum; return state.remainTicketNum;
}, },
goldNum: state => {
return state.goldNum;
},
turntable: state => {
return state.turntable;
},
happyGiftList: state => {
return state.happyGiftList;
},
curHappyGift: (state, getters) => {
return getters.happyGiftList[0] || null;
},
curHappyGiftSellingPrice: (state, getters) => {
if (getters.curHappyGift && getters.curHappyGift.sellingPrice)
return getters.curHappyGift.sellingPrice;
return 0;
},
curHappyGiftUrl: (state, getters) => {
if (getters.curHappyGift && getters.curHappyGift.imgUrl)
return getters.curHappyGift.imgUrl;
return "";
},
ticketRule: state => { ticketRule: state => {
return state.ticketRule; return state.ticketRule;
}, },
curTicketRuleValue: state => { curTicketRuleValue: state => {
if (!state.ticketRule) return 0; if (!state.ticketRule) return 0;
return state.ticketRule[state.ruleType]; return state.ticketRule[state.ruleType].times;
}, },
canLottery: state => { canLottery: state => {
return state.canLottery; return state.canLottery;
@@ -87,16 +119,23 @@ export default new Vuex.Store({
ticketRuleConfig: state => { ticketRuleConfig: state => {
return state.ticketRuleConfig; return state.ticketRuleConfig;
}, },
curLotteryPrize: (state, getters) => {
return getters.turntable[state.drawType];
},
curLotteryTimesPrize: (state, getters) => {
return getters.curLotteryPrize * getters.curTicketRuleValue;
},
ticketRuleList: (state, getters) => { ticketRuleList: (state, getters) => {
const list = []; const list = [];
if (!getters.ticketRule) return list; if (!getters.ticketRule) return list;
for (let index = 0; index < getters.ticketRuleConfig.length; index++) { for (let index = 0; index < getters.ticketRuleConfig.length; index++) {
const element = getters.ticketRuleConfig[index]; const element = getters.ticketRuleConfig[index];
const val = getters.ticketRule[element.ruleType]; const val = getters.ticketRule[element.ruleType];
const { times } = val;
list.push({ list.push({
label: element.name, label: element.name,
desc: `${val}张鱼券`, desc: `${times * getters.curLotteryPrize}${unit}`,
value: val, value: times,
ruleType: element.ruleType ruleType: element.ruleType
}); });
} }
@@ -170,6 +209,15 @@ export default new Vuex.Store({
SetRemainTicketNum(state, payload) { SetRemainTicketNum(state, payload) {
state.remainTicketNum = payload; state.remainTicketNum = payload;
}, },
SetGoldNum(state, payload) {
state.goldNum = payload;
},
SetTurntable(state, payload) {
state.turntable = payload;
},
SetHappyGiftList(state, payload) {
state.happyGiftList = payload;
},
SetTicketRule(state, payload) { SetTicketRule(state, payload) {
state.ticketRule = payload; state.ticketRule = payload;
}, },
@@ -186,15 +234,21 @@ export default new Vuex.Store({
actions: { actions: {
getQueryPrizeInfo({ state, commit }, drawType) { getQueryPrizeInfo({ state, commit }, drawType) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
queryPrizeInfo({ drawType: drawType || state.drawType }) const drawTypes = drawType || state.drawType;
queryPrizeInfo({
drawTypes,
actId: locateObj.actId
})
.then(res => { .then(res => {
const { code, data, msg } = res; const { code, data, message } = res;
if (code === 200) { if (code === 200) {
commit("SetDrawTypePrizeInfo", { drawType, list: data }); const list = data[drawTypes];
commit("SetDrawTypePrizeInfo", { drawType: drawTypes, list });
resolve(list);
} else { } else {
Toast.fail(msg); Toast.fail(message);
reject(res);
} }
resolve(res);
}) })
.catch(err => { .catch(err => {
Toast.fail("获取抽奖奖品信息失败!"); Toast.fail("获取抽奖奖品信息失败!");
@@ -203,42 +257,63 @@ export default new Vuex.Store({
}); });
}, },
getqueryTicketRule({ commit }, drawType) { getqueryTicketRule({ commit }, drawType) {
queryTicketRule({ drawType: drawType }) queryTicketRule({ drawType: drawType, actId: locateObj.actId })
.then(res => { .then(res => {
const { code, data, msg } = res; const { code, data, message } = res;
if (code === 200) { if (code === 200) {
commit("SetTicketRule", data || null); const { timesRule } = data;
if (!timesRule) return;
if (timesRule.length === 0) return;
const json = {};
for (let index = 0; index < timesRule.length; index++) {
const element = timesRule[index];
json[element.type] = element;
}
commit("SetTicketRule", json || null);
} else { } else {
Toast.fail(msg); Toast.fail(message);
} }
}) })
.catch(() => { .catch(() => {
Toast.fail("获取规则次数失败!"); Toast.fail("获取规则次数失败!");
}); });
}, },
runLottery({ state, commit, dispatch }, option) { runLottery({ state, commit, dispatch }) {
if (!locateObj.actId) {
Toast.fail("获取活动信息失败!");
return;
}
if (!info.roomUid) {
Toast.fail("获取房间信息失败!");
return;
}
if (!info.deviceId) {
Toast.fail("获取设备id失败!");
return;
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
doLottery({ doLottery({
uid: option.uid, actId: locateObj.actId,
roomUid: option.roomUid,
drawType: state.drawType,
sendMessage: true, sendMessage: true,
deviceId: "abc", drawType: state.drawType,
ruleType: state.ruleType ruleType: state.ruleType,
roomId: info.roomUid,
deviceId: info.deviceId
}) })
.then(res => { .then(res => {
const { code, data, msg } = res; const { code, data } = res;
if (code === 200) { if (code === 200) {
commit("SetRemainTicketNum", data.remainTicketNum || 0); // commit("SetRemainTicketNum", data.remainTicketNum || 0);
commit("SetLotteryData", data); commit("SetLotteryData", data);
dispatch("postSaveLog", option); // dispatch("postSaveLog", option);
dispatch("getQueryTicketNum");
} else { } else {
Toast.fail(msg); // Toast.fail(message);
} }
resolve(res); resolve(res);
}) })
.catch(err => { .catch(err => {
Toast.fail("抽奖发生意外错误!"); // Toast.fail("抽奖发生意外错误!");
reject(err); reject(err);
}); });
}); });
@@ -252,19 +327,87 @@ export default new Vuex.Store({
prizeIdList: JSON.stringify(getters.prizeIdList) prizeIdList: JSON.stringify(getters.prizeIdList)
}); });
}, },
getQueryTicketNum({ commit }, option) { getQueryTicketNum({ commit }) {
queryTicketNum({ uid: option.uid }) queryTicketNum({ deviceId: info.deviceId, actId: locateObj.actId })
.then(res => { .then(res => {
const { code, data, msg } = res; const { code, data, message } = res;
if (code === 200) { if (code === 200) {
commit("SetRemainTicketNum", data.num || 0); commit("SetRemainTicketNum", data.num || 0);
commit("SetGoldNum", data.goldNum || 0);
commit("SetTurntable", data.ticketForOneTime);
} else { } else {
Toast.fail(msg); Toast.fail(message);
} }
}) })
.catch(() => { .catch(() => {
Toast.fail("获取余额失败!"); Toast.fail("获取余额失败!");
}); });
},
loadPackList({ commit }) {
queryPackList({ actId: locateObj.actId })
.then(res => {
const { code, data, message } = res;
if (code === 200 && data && data.length) {
// this.getHappyGiftObj = data[0];
commit("SetHappyGiftList", data);
} else {
Toast.fail(message || "获取礼包失败!");
}
})
.catch(() => {
Toast.fail("获取礼包出现意外!");
});
},
postBuyPack({ commit, getters }, option) {
return new Promise((resolve, reject) => {
if (!getters.curHappyGift) {
Toast.fail("未获取到礼包信息!");
reject("未获取到礼包信息!");
return;
}
if (!getters.curHappyGift.id) {
Toast.fail("未获取到礼包信息!");
reject("未获取到礼包信息!");
return;
}
Toast.loading({
message: "加载中...",
forbidClick: true,
duration: 0
});
buyPack({
packId: getters.curHappyGift.id,
packNum: option.packNum
})
.then(res => {
Toast.clear();
const { code, message, data } = res;
if (code === 200) {
// console.log(this.goldNum, data, this.goldNum + data);
let prize = getters.curHappyGiftSellingPrice * option.packNum;
commit("SetRemainTicketNum", getters.remainTicketNum + data);
commit("SetGoldNum", getters.goldNum - prize);
const localNoticeStatus = localStorage.getItem(
"_toupaipaidui_never_notice_"
);
if (!localNoticeStatus) Toast.success("购买成功");
resolve(res);
} else {
Toast.fail(message || "购买礼包失败!");
reject(res);
}
})
.catch(err => {
Toast.clear();
Toast.fail("购买礼包出现意外错误!");
reject(err);
});
});
},
buyAndLottery({ dispatch }, option) {
dispatch("postBuyPack", option).then(() => {
dispatch("runLottery");
});
} }
}, },
modules: {} modules: {}
+3 -1
View File
@@ -5,4 +5,6 @@
@empty-description-color: #AFAAFF; @empty-description-color: #AFAAFF;
@list-text-color: #AFAAFF; @list-text-color: #AFAAFF;
// @button-plain-background-color: rgba(0, 0, 0, 0);
+69 -15
View File
@@ -21,9 +21,9 @@
<bottom-view :drawType="drawType"></bottom-view> <bottom-view :drawType="drawType"></bottom-view>
</div> </div>
<div class="left-top-button" @click="clickLeftTopButton"> <!-- <div class="left-top-button" @click="clickLeftTopButton">
<van-icon name="bars" /> <van-icon name="bars" />
</div> </div> -->
<van-popup <van-popup
v-model="show" v-model="show"
@@ -38,6 +38,17 @@
<!-- <prizes-view></prizes-view> --> <!-- <prizes-view></prizes-view> -->
<component :is="curComponentsName"></component> <component :is="curComponentsName"></component>
</van-popup> </van-popup>
<van-popup
v-model="buyGiftVisible"
:style="{ width: '80%', height: '82vw' }"
:close-on-click-overlay="false"
closeable
round
get-container="#app"
>
<buyGiftPop :needNumber="needNumber" />
</van-popup>
</div> </div>
</template> </template>
@@ -46,8 +57,10 @@ 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 buyGiftPop from "@/components/buyGiftPop";
import { mapMutations, mapGetters } from "vuex"; import { mapMutations, mapGetters, mapActions } from "vuex";
import { tools } from "@/lib/tool";
import eventBus from "@/lib/eventBus";
export default { export default {
name: "Home", name: "Home",
@@ -56,28 +69,33 @@ export default {
ballContent, ballContent,
enterView, enterView,
bottomView, bottomView,
// prizesView buyGiftPop,
prizesView: resolve => require(["./prizesView.vue"], resolve), prizesView: resolve => require(["./prizesView.vue"], resolve),
ruleView: resolve => require(["./ruleView.vue"], resolve), ruleView: resolve => require(["./ruleView.vue"], resolve),
recordView: resolve => require(["./recordView.vue"], resolve), recordView: resolve => require(["./recordView.vue"], resolve),
rankView: resolve => require(["./rankView.vue"], resolve), rankView: resolve => require(["./rankView.vue"], resolve),
dataView: resolve => require(["./dataView.vue"], resolve) dataView: resolve => require(["./dataView.vue"], resolve),
rechargeView: resolve => require(["./recharge.vue"], resolve)
}, },
data() { data() {
return { return {
show: false, show: false,
buyGiftVisible: false,
curBtnText: "", curBtnText: "",
componentsName: { componentsName: {
排行: "rank-view",
规则: "rule-view", 规则: "rule-view",
奖品: "prizes-view", 奖品: "prizes-view",
排行: "rank-view",
记录: "record-view", 记录: "record-view",
数据: "data-view" 数据: "data-view",
} 充值: "recharge-view"
},
localNoticeStatus: false,
needNumber: 0
}; };
}, },
computed: { computed: {
...mapGetters(["drawType"]), ...mapGetters(["drawType", "happyGiftList"]),
curComponentsName() { curComponentsName() {
return this.componentsName[this.curBtnText]; return this.componentsName[this.curBtnText];
}, },
@@ -85,26 +103,62 @@ export default {
return this.show && this.curBtnText && this.curComponentsName; return this.show && this.curBtnText && this.curComponentsName;
} }
}, },
watch: { // watch: {
show() { // show() {
console.log("this.show", this.show); // console.log("this.show", this.show);
} // }
// },
created() {
this.localNoticeStatus = localStorage.getItem(
"_toupaipaidui_never_notice_"
);
if (this.happyGiftList.length === 0) this.loadPackList();
},
mounted() {
eventBus.$on("rechargeView", this.showRechargeView);
eventBus.$on("noTickets", this.noTicketsHander);
eventBus.$on("buyAndLotteryEvent", this.closeBuyAndLotteryPopHandler);
},
beforeDestroy() {
eventBus.$off("rechargeView", this.showRechargeView);
eventBus.$off("noTickets", this.noTicketsHander);
eventBus.$off("buyAndLotteryEvent", this.closeBuyAndLotteryPopHandler);
}, },
mounted() {},
methods: { methods: {
...mapMutations(["SetDrawType"]), ...mapMutations(["SetDrawType"]),
...mapActions(["loadPackList"]),
clickTopButton(index) { clickTopButton(index) {
this.SetDrawType(index); this.SetDrawType(index);
// console.log("active", index); // console.log("active", index);
}, },
clickEntryBtn(val) { clickEntryBtn(val) {
// console.log("clickEntryBtn", val); // console.log("clickEntryBtn", val);
if (val === "反馈") {
tools.nativeUtils.jumpAppointPage("FEEDPACK_PAGE", "LUCKY");
return;
}
this.curBtnText = val; this.curBtnText = val;
this.show = true; this.show = true;
}, },
clickLeftTopButton() { clickLeftTopButton() {
this.curBtnText = "数据"; this.curBtnText = "数据";
this.show = true; this.show = true;
},
showRechargeView() {
this.curBtnText = "充值";
this.show = true;
},
noTicketsHander(dValue) {
this.needNumber = dValue;
this.localNoticeStatus = localStorage.getItem(
"_toupaipaidui_never_notice_"
);
if (!this.localNoticeStatus) {
this.buyGiftVisible = true;
}
},
closeBuyAndLotteryPopHandler() {
this.buyGiftVisible = false;
} }
} }
}; };
+2 -2
View File
@@ -3,7 +3,7 @@
<div class="prizes-view-content"> <div class="prizes-view-content">
<van-tabs v-model="active" animated> <van-tabs v-model="active" animated>
<van-tab <van-tab
title="幸运扭扭蛋" title="幸运扭蛋"
name="turntable1" name="turntable1"
title-class="prizes-view-content-tableft" title-class="prizes-view-content-tableft"
> >
@@ -12,7 +12,7 @@
</div> </div>
</van-tab> </van-tab>
<van-tab <van-tab
title="豪华扭扭蛋" title="至尊扭蛋"
name="turntable2" name="turntable2"
title-class="prizes-view-content-tabright" title-class="prizes-view-content-tabright"
> >
+231
View File
@@ -0,0 +1,231 @@
<template>
<div class="recharge-view">
<div class="recharge-view-padding">
<div class="recharge-view-header">
<h3 class="recharge-view-title">获取{{ unit }}</h3>
<p>购买头饰免费赠送{{ unit }}</p>
</div>
<div class="recharge-view-content">
<div class="recharge-view-content-pic">
<img :src="showImg" />
</div>
<div class="recharge-view-content-select">
<div
class="list-item"
v-for="(item, index) in selectOption"
:key="`list-item_${index}`"
:class="curClass(item)"
@click="selectHandler(item)"
>
<p class="list-day-item">{{ item.packNum }}天</p>
<p>{{ item.prize }}{{ money }}</p>
</div>
</div>
<div class="recharge-view-content-button">
<van-button
round
block
color="linear-gradient(135deg,#f57cff,#878bff 100%,#6e6eff 0)"
@click="openDialog"
>
确定
</van-button>
</div>
</div>
<div class="recharge-view-footer">
<div class="surplus-itme">
<span>剩余{{ unit }}:</span
><span class="light">{{ this.remainTicketNum }}</span>
</div>
<div class="surplus-itme">
<span>剩余{{ money }}:</span
><span class="light">{{ this.goldNum }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import { money, unit } from "@/config";
export default {
name: "rechargeView",
components: {},
data() {
return {
money,
unit,
defaultShowImg: require("@/assets/images/logo.jpg"),
curSelect: null
};
},
computed: {
...mapGetters([
"goldNum",
"remainTicketNum",
"happyGiftList",
"curHappyGift",
"curHappyGiftSellingPrice",
"curHappyGiftUrl",
"curTicketRuleValue"
]),
actId() {
return this.$route.query.actId;
},
showImg() {
if (this.curHappyGiftUrl) return this.curHappyGiftUrl;
return this.defaultShowImg;
},
dialogText() {
return `确定花费${this.curSelect.prize}${this.money}购买${this.curSelect.packNum}天${this.curHappyGift.name}吗?`;
},
selectOption() {
const arr = [1, 10, 100, 1000];
const list = [];
for (let index = 0; index < arr.length; index++) {
const element = arr[index];
list.push({
packNum: element,
prize: this.curHappyGiftSellingPrice * element
});
}
return list;
}
},
created() {
this.curSelect = this.selectOption[0];
if (this.happyGiftList.length === 0) this.loadPackList();
},
methods: {
...mapActions(["loadPackList", "postBuyPack"]),
selectHandler(item) {
this.curSelect = item;
},
curClass(item) {
const { packNum } = item;
if (this.curSelect.packNum === packNum) return "active";
return "";
},
openDialog() {
if (!this.curHappyGift) return;
if (!this.curHappyGift.id) return;
this.$dialog
.confirm({
title: "提示",
confirmButtonColor: "#9E98FF",
message: this.dialogText
})
.then(() => {
// on confirm
this.postBuyPack({ packNum: this.curSelect.packNum });
})
.catch(() => {
// on cancel
});
}
}
};
</script>
<style lang="less" scoped>
.recharge-view {
height: 100%;
background-color: #150832;
color: #dbcfff;
&-padding {
height: 100%;
display: flex;
flex-direction: column;
}
&-header {
text-align: center;
height: 128px;
}
&-title {
text-align: center;
color: #dbcfff;
font-weight: bold;
font-size: 32px;
line-height: 72px;
padding-top: 20px;
}
&-content {
flex: 1;
margin-top: 50px;
line-height: 54px;
font-size: 26px;
font-weight: 400;
padding: 0 30px;
// height: calc(100vh - 72px - 20px - 50px);
overflow-x: hidden;
overflow-y: auto;
&-pic {
margin: 0 auto;
width: 200px;
height: 200px;
box-sizing: border-box;
background: hsla(0, 0%, 100%, 0.5);
padding: 30px;
border-radius: 10px;
& > img {
width: 100%;
height: 100%;
display: block;
border-radius: 8px;
}
}
&-select {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 50px;
.list-item {
width: 320px;
height: 120px;
border: 2px solid #fff;
opacity: 0.3;
border-radius: 10px;
box-sizing: border-box;
transition: all 0.1s linear;
margin-bottom: 30px;
text-align: center;
& > p {
line-height: 30px;
font-size: 24px;
}
.list-day-item {
font-size: 40px;
line-height: 50px;
height: 50px;
margin-top: 20px;
}
}
.active {
opacity: 1;
color: #ffdb3c;
border-color: #ffdb3c;
}
}
&-button {
width: 500px;
margin: 20px auto 0;
}
}
&-footer {
height: 100px;
padding: 0 30px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
background: rgba(81, 0, 154, 0.5);
align-items: center;
.surplus-itme {
font-size: 32px;
.light {
color: #ffdb3c;
}
}
}
}
</style>
+4 -3
View File
@@ -1,12 +1,12 @@
<template> <template>
<div class="record-view"> <div class="record-view">
<div class="record-view-title"> <!-- <div class="record-view-title">
<h3>抽奖记录</h3> <h3>抽奖记录</h3>
<p>今日投入产出比:{{ rate }}</p> <p>今日投入产出比:{{ rate }}</p>
<p> <p>
今日投入{{ userTotalPay }}金币,今日产出{{ totalPlatformValue }}金币 今日投入{{ userTotalPay }}金币,今日产出{{ totalPlatformValue }}金币
</p> </p>
</div> </div> -->
<div class="record-view-content"> <div class="record-view-content">
<van-tabs v-model="active" animated> <van-tabs v-model="active" animated>
<van-tab title="时间" name="time"> <van-tab title="时间" name="time">
@@ -77,7 +77,8 @@ export default {
} }
&-content { &-content {
&-pane { &-pane {
height: calc(100vh - 20px - 72px - 50px - 50px - 11.734vw); // height: calc(100vh - 20px - 72px - 50px - 50px - 11.734vw);
height: calc(100vh - 50px - 11.734vw);
overflow-y: auto; overflow-y: auto;
} }
} }
+21 -8
View File
@@ -3,35 +3,45 @@
<div class="rule-view-padding"> <div class="rule-view-padding">
<h3 class="rule-view-title">活动规则</h3> <h3 class="rule-view-title">活动规则</h3>
<div class="rule-view-content"> <div class="rule-view-content">
<p v-for="(text, index) in ruleContent" :key="`rule_text_${index}`"> <img :src="ruleContent" v-if="ruleContent" />
<p v-else>{{ defaultText }}</p>
<!-- <p v-for="(text, index) in ruleContent" :key="`rule_text_${index}`">
{{ text }} {{ text }}
</p> </p> -->
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getRuleTip } from "@/api"; import { mapGetters } from "vuex";
import { getRulePic } from "@/api";
export default { export default {
name: "RuleView", name: "RuleView",
data() { data() {
return { return {
ruleContent: [] ruleContent: "http://img.haloapp.vip/rule.png",
defaultText: "正在努力加载····"
}; };
}, },
computed: {
...mapGetters(["drawType"]),
actId() {
return this.$route.query.actId;
}
},
created() { created() {
this.ruleTip(); // this.ruleTip();
}, },
methods: { methods: {
ruleTip() { ruleTip() {
getRuleTip() getRulePic({ drawType: this.drawType, actId: this.actId })
.then(res => { .then(res => {
const { code, data, msg } = res; const { code, data, message } = res;
if (code === 200) { if (code === 200) {
this.ruleContent = data; this.ruleContent = data;
} else { } else {
this.$toast.fail(msg); this.$toast.fail(message);
} }
}) })
.catch(() => { .catch(() => {
@@ -73,6 +83,9 @@ export default {
&:last-child { &:last-child {
padding-bottom: 0; padding-bottom: 0;
} }
& > img {
width: 100%;
}
} }
} }
</style> </style>
+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>