feat; 更新业务

This commit is contained in:
dengtongyu committed 2023-04-06 00:22:33 +08:00
1 parent aba3958d9d
commit 5f63979f9f
26 files changed
+790 -275

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@ switch (VUE_APP_PROXY) {
target = "http://im.haloapp.vip"; target = "http://im.haloapp.vip";
break; break;
case 2: case 2:
target = "http://haloapp.vip"; target = "http://apibeta.haloapp.vip";
break; break;
default: default:
target = "http://test.haloapp.vip"; target = "http://test.haloapp.vip";
Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+4 -4
View File
@@ -1,14 +1,14 @@
<!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,iVBORw0KGgoAAAANSUhEUgAAAJgAAACYCAMAAAAvHNATAAAABGdBTUEAALGPC/xhBQAAAwBQTFRF7bv+2qz/KeL6FeP6Vrn9bdH/hKP/cLn+/9LnoqX/hrn/lJz/raj//8nuQvT+Ycf9y8z/O9n7Tej+sa7/08//h67/npP//97h/8D1mZL/e6H/mYP/n/L++/f44Nz3l5X/S9z82dj+au39h/L9s/P/g83/6/btvvP/sOD6cnn//Oz1vN75+P//fN3/ffr/qfH5dYL/wfT1ZeD99dj4qJ7/8Pz3Vuv9xcb/vr3/6d315db56/7/mY7//rn88/T/i4j/yfX/29r4gYD/tbb/kIj/4vL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9vOoDaTxvLj2CVjlzC0KRM52TvvvPMEgX0JzZUMW7GAcY0YMeKuu0ZMGnKHu3v7DuEaV9wh4ooisHhaLDLRxcO9dIyX2339AGyOsZzIp82bBddYqdlLZi+ZgtvE50DIxR378gMGNo9xAVTncXe3bVNX5u/vH+7D6osPkQSWno5g8RJN8uXC6kNHz6A10dER/aBw5qhakkCgdZLine truncated .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: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: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);}
} }
+23 -14
View File
@@ -1,53 +1,60 @@
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));
}; };
export { export {
@@ -57,7 +64,9 @@ export {
doLottery, doLottery,
saveLog, saveLog,
queryPrizeMsg, queryPrizeMsg,
getRuleTip,
drawRecord, drawRecord,
rateList rateList,
getRulePic,
queryPackList,
buyPack
}; };
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

+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>
+4 -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"]),
@@ -63,10 +57,7 @@ export default {
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;
+17 -2
View File
@@ -1,14 +1,16 @@
<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> <label>{{ moneyStr }}</label>
<span>{{ value }}</span> <span>{{ value }}</span>
</div> </div>
<div class="balance-view-btn" @touchstart="() => {}"></div> <div class="balance-view-btn" @click="clickHandler"></div>
</div> </div>
</template> </template>
<script> <script>
import { money } from "@/config";
import eventBus from "@/lib/eventBus";
export default { export default {
name: "BalanceView", name: "BalanceView",
props: { props: {
@@ -21,10 +23,23 @@ export default {
default: 0 default: 0
} }
}, },
data() {
return {
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";
},
moneyStr() {
return `${money}余额:`;
}
},
methods: {
clickHandler() {
eventBus.$emit("rechargeView");
} }
} }
}; };
+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>
+1 -1
View File
@@ -72,7 +72,7 @@ export default {
} }
}, },
created() { created() {
this.getQueryTicketNum({ uid: this.uid }); this.getQueryTicketNum();
this.getqueryTicketRule(this.drawType); this.getqueryTicketRule(this.drawType);
}, },
methods: { methods: {
+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: {
+3 -15
View File
@@ -91,12 +91,6 @@ export default {
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;
@@ -152,11 +146,8 @@ export default {
]), ]),
...mapActions(["getQueryPrizeInfo", "runLottery"]), ...mapActions(["getQueryPrizeInfo", "runLottery"]),
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() {
@@ -172,10 +163,7 @@ export default {
this.request = false; this.request = false;
this.$refs.LuckDraw.play(); this.$refs.LuckDraw.play();
this.runLottery({ this.runLottery().then(res => {
uid: this.uid,
roomUid: this.roomUid
}).then(res => {
const { code } = res; const { code } = res;
if (code === 200) { if (code === 200) {
this.request = true; this.request = true;
+52 -28
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,21 +57,26 @@ 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
@@ -77,10 +85,20 @@ export default {
this.loading = false; this.loading = false;
const { code, data, msg } = res; const { code, data, msg } = 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(msg);
} }
@@ -89,6 +107,7 @@ export default {
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();
} }
} }
}; };
+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, msg } = res;
this.recordList = data; if (code === 200) {
} else { this.recordList = data;
this.$toast.fail(msg); } else {
this.$toast.fail(msg);
}
} }
}); );
} }
} }
}; };
+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);
// }
// };
+203 -93
View File
@@ -1,121 +1,231 @@
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("tutuApp"),
app: u.match("tutuApp") // 是否在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}__`); const 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") {
info.deviceId = window.androidJsObj.getDeviceId();
info.roomUid = window.androidJsObj.getRoomUid();
}
// 获取指定的用户权限 info.appVersion = tools.nativeUtils.getAppVersion();
const getUserSomeonePowerCache = code => { }
let data = getUserPowerCache();
let item = null;
if (data) item = data[code];
return item;
};
// 删除用户权限 info.uid = tools.nativeUtils.getUid();
const removeUserPowerCache = () => { info.ticket = tools.nativeUtils.getTicket();
_removeItem(`__UserPower_${systemCode}__`); info.appVersion = tools.nativeUtils.getAppVersion();
} else {
info.roomUid = 904860;
info.uid = 1000002;
info.deviceId = "afhksafhksajhfs1kjahsfkjsf0000aaaaaaaacaa";
info.ticket =
"eyJhbGciOiJIUzI1NiJ9.eyJ0aWNrZXRfdHlwZSI6bnVsbCwidWlkIjo5MTMzOSwidGlja2V0X2lkIjoiOGJmMTdlYmQtMTY4ZC00NTliLWI0NzUtMDU3M2Y1ZmM4MDQzIiwiZXhwIjozNjAwLCJjbGllbnRfaWQiOiJlcmJhbi1jbGllbnQifQ.MnKGEc6bSkyOkCbx26lib6J0koFDA2uiKnbwkhdk3MU";
}
return info;
}; };
export { export {
randomString, randomString,
setUserInfoCache, checkVersion,
getUserInfoCache, tools,
removeUserInfoCache, getQueryString,
setToken, getMsgFromDevice,
getToken, routeTypeConstant
removeToken,
setUserPowerCache,
getUserPowerCache,
removeUserPowerCache,
getUserSomeonePowerCache
}; };
+5 -1
View File
@@ -11,7 +11,9 @@ import {
Image as VanImage, Image as VanImage,
List, List,
Empty, Empty,
Icon Icon,
PullRefresh,
Button
} from "vant"; } from "vant";
Vue.config.productionTip = false; Vue.config.productionTip = false;
@@ -25,6 +27,8 @@ 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);
new Vue({ new Vue({
router, router,
+44 -16
View File
@@ -8,6 +8,11 @@ import {
saveLog, saveLog,
queryTicketNum queryTicketNum
} 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 +26,7 @@ export default new Vuex.Store({
// prizeItemList: [], // prizeItemList: [],
ruleType: "one", ruleType: "one",
remainTicketNum: 0, remainTicketNum: 0,
goldNum: 0,
ticketRule: null, ticketRule: null,
canLottery: true, canLottery: true,
lotteryRecordRateVo: {}, lotteryRecordRateVo: {},
@@ -71,6 +77,9 @@ export default new Vuex.Store({
remainTicketNum: state => { remainTicketNum: state => {
return state.remainTicketNum; return state.remainTicketNum;
}, },
goldNum: state => {
return state.goldNum;
},
ticketRule: state => { ticketRule: state => {
return state.ticketRule; return state.ticketRule;
}, },
@@ -93,10 +102,11 @@ export default new Vuex.Store({
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}${unit}`,
value: val, value: times,
ruleType: element.ruleType ruleType: element.ruleType
}); });
} }
@@ -170,6 +180,9 @@ export default new Vuex.Store({
SetRemainTicketNum(state, payload) { SetRemainTicketNum(state, payload) {
state.remainTicketNum = payload; state.remainTicketNum = payload;
}, },
SetGoldNum(state, payload) {
state.goldNum = payload;
},
SetTicketRule(state, payload) { SetTicketRule(state, payload) {
state.ticketRule = payload; state.ticketRule = payload;
}, },
@@ -186,15 +199,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, msg } = 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(msg);
reject(res);
} }
resolve(res);
}) })
.catch(err => { .catch(err => {
Toast.fail("获取抽奖奖品信息失败!"); Toast.fail("获取抽奖奖品信息失败!");
@@ -203,11 +222,19 @@ 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, msg } = 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(msg);
} }
@@ -216,22 +243,22 @@ export default new Vuex.Store({
Toast.fail("获取规则次数失败!"); Toast.fail("获取规则次数失败!");
}); });
}, },
runLottery({ state, commit, dispatch }, option) { runLottery({ state, commit }) {
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, msg } = 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);
} else { } else {
Toast.fail(msg); Toast.fail(msg);
} }
@@ -252,12 +279,13 @@ 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, msg } = res;
if (code === 200) { if (code === 200) {
commit("SetRemainTicketNum", data.num || 0); commit("SetRemainTicketNum", data.num || 0);
commit("SetGoldNum", data.goldNum || 0);
} else { } else {
Toast.fail(msg); Toast.fail(msg);
} }
+24 -10
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"
@@ -48,6 +48,8 @@ import enterView from "@/components/enterView";
import bottomView from "@/components/bottomView"; import bottomView from "@/components/bottomView";
// import prizesView from "./prizesView.vue"; // import prizesView from "./prizesView.vue";
import { mapMutations, mapGetters } from "vuex"; import { mapMutations, mapGetters } from "vuex";
import { tools } from "@/lib/tool";
import eventBus from "@/lib/eventBus";
export default { export default {
name: "Home", name: "Home",
@@ -61,18 +63,20 @@ export default {
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,
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"
} }
}; };
}, },
@@ -85,12 +89,14 @@ 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);
} // }
// },
mounted() {
eventBus.$on("rechargeView", this.showRechargeView);
}, },
mounted() {},
methods: { methods: {
...mapMutations(["SetDrawType"]), ...mapMutations(["SetDrawType"]),
clickTopButton(index) { clickTopButton(index) {
@@ -99,12 +105,20 @@ export default {
}, },
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;
} }
} }
}; };
+271
View File
@@ -0,0 +1,271 @@
<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.money }}{{ 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>剩余欢乐券:</span
><span class="light">{{ this.remainTicketNum }}</span>
</div>
<div class="surplus-itme">
<span>剩余金币:</span><span class="light">{{ this.goldNum }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
import { queryPackList, buyPack } from "@/api";
import { mapGetters, mapMutations } from "vuex";
import { money, unit } from "@/config";
export default {
name: "rechargeView",
components: {},
data() {
return {
money,
unit,
getHappyGiftObj: null,
defaultShowImg: require("@/assets/images/logo.jpg"),
selectOption: [
{
packNum: 1,
money: 20
},
{
packNum: 10,
money: 200
},
{
packNum: 100,
money: 2000
},
{
packNum: 1000,
money: 20000
}
],
curSelect: null
};
},
computed: {
...mapGetters(["goldNum", "remainTicketNum"]),
actId() {
return this.$route.query.actId;
},
showImg() {
if (this.getHappyGiftObj && this.getHappyGiftObj.imgUrl)
return this.getHappyGiftObj.imgUrl;
return this.defaultShowImg;
},
dialogText() {
return `确定花费${this.curSelect.money}${this.money}购买${this.curSelect.packNum}天${this.getHappyGiftObj.name}吗?`;
}
},
created() {
this.curSelect = this.selectOption[0];
this.loadPackList();
},
methods: {
...mapMutations(["SetRemainTicketNum", "SetGoldNum"]),
loadPackList() {
queryPackList({ actId: this.actId })
.then(res => {
const { code, data, message } = res;
if (code === 200 && data && data.length) {
this.getHappyGiftObj = data[0];
} else {
this.$toast.fail(message || "获取礼包失败!");
}
})
.catch(() => {
this.$toast.fail("获取礼包出现意外!");
});
},
selectHandler(item) {
this.curSelect = item;
},
curClass(item) {
const { packNum } = item;
if (this.curSelect.packNum === packNum) return "active";
return "";
},
openDialog() {
if (!this.getHappyGiftObj) return;
if (!this.getHappyGiftObj.id) return;
this.$dialog
.confirm({
title: "提示",
message: this.dialogText
})
.then(() => {
// on confirm
this.postBuyPack();
})
.catch(() => {
// on cancel
});
},
postBuyPack() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
duration: 0
});
buyPack({
packId: this.getHappyGiftObj.id,
packNum: this.curSelect.packNum
})
.then(res => {
this.$toast.clear();
const { code, message, data } = res;
if (code === 200) {
// console.log(this.goldNum, data, this.goldNum + data);
this.SetRemainTicketNum(this.remainTicketNum + data);
this.SetGoldNum(this.goldNum - this.curSelect.money);
this.$toast.success("购买成功");
} else {
this.$toast.fail(message || "购买礼包失败!");
}
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("购买礼包出现意外错误!");
});
}
}
};
</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;
} }
} }
+18 -5
View File
@@ -3,29 +3,39 @@
<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: null,
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, msg } = res;
if (code === 200) { if (code === 200) {
@@ -73,6 +83,9 @@ export default {
&:last-child { &:last-child {
padding-bottom: 0; padding-bottom: 0;
} }
& > img {
width: 100%;
}
} }
} }
</style> </style>