同步数据
This commit is contained in:
parent
2ab7f2daab
commit
8db3e50c0f
5
.env.prd
5
.env.prd
@ -1,5 +1,6 @@
|
||||
VITE_MODE = prd
|
||||
VITE_HOST = https://hd.xglpa.com
|
||||
VITE_HOST = https://wmm.pingan.com.cn
|
||||
VITE_CDN = https://cdn.xglpa.com
|
||||
VITE_FOLDER = /vite-4
|
||||
VITE_API = /vite-api
|
||||
VITE_API = /intfgw/data/mmoactivity
|
||||
VITE_URL = https://w.pingan.com.cn/lckj/pawm-mmo-activity-xgl-frontend/index.html
|
||||
@ -14,13 +14,14 @@ const money = ref("8.88");
|
||||
const code = ref("sss");
|
||||
|
||||
const showResult = ref(false);
|
||||
const hasPrize = ref(true);
|
||||
const hasPrize = ref(false);
|
||||
|
||||
const drawFn = (event) => {
|
||||
let e = event.target.parentElement;
|
||||
debounceTap(e, async () => {
|
||||
console.log("抽奖");
|
||||
Toast.loading({
|
||||
if(userStore.hasDraw){
|
||||
Toast.loading({
|
||||
message: "抽奖中",
|
||||
forbidClick: true,
|
||||
duration: 0,
|
||||
@ -31,12 +32,12 @@ const drawFn = (event) => {
|
||||
{ rotation: "+30", repeat: -1, yoyo: true, ease: "none", duration: 0.3 }
|
||||
);
|
||||
|
||||
try {
|
||||
const res = await drawApi(
|
||||
{ subAnswerKey: userStore.drawKey },
|
||||
userStore.token
|
||||
);
|
||||
drawApi(
|
||||
{ subAnswerKey: userStore.drawKey },
|
||||
userStore.token
|
||||
).then(res => {
|
||||
if (res.code == 0) {
|
||||
console.log('正常抽奖');
|
||||
// isDrawn后端判断有没有中奖
|
||||
hasPrize.value = res.data.isDrawn == 1 ? true : false; // true 中奖 || false 未中奖
|
||||
userStore.updateDraw(); // 更新抽奖机会
|
||||
@ -48,23 +49,33 @@ const drawFn = (event) => {
|
||||
userStore.updatePrize(res.data);
|
||||
}
|
||||
} else {
|
||||
hasPrize.value = false; // true 中奖 || false 未中奖
|
||||
console.log('抽奖异常');
|
||||
if (res.code == 6003) {
|
||||
console.log('6003', res);
|
||||
Toast(res.msg)
|
||||
userStore.updateDraw();
|
||||
|
||||
} else {
|
||||
console.log('eroor', res);
|
||||
hasPrize.value = false; // true 中奖 || false 未中奖
|
||||
userStore.updateDraw();
|
||||
setTimeout(() => {
|
||||
Toast.clear();
|
||||
showResult.value = true;
|
||||
gsap.from(".result-container", {
|
||||
duration: 0.5,
|
||||
scale: 0.7,
|
||||
autoAlpha: 0,
|
||||
});
|
||||
gsap.killTweensOf(".draw-light,.draw");
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
hasPrize.value = false;
|
||||
})
|
||||
}else{
|
||||
Toast('今日抽奖次数已用完!')
|
||||
}
|
||||
|
||||
userStore.updateDraw();
|
||||
setTimeout(() => {
|
||||
Toast.clear();
|
||||
showResult.value = true;
|
||||
gsap.from(".result-container", {
|
||||
duration: 0.5,
|
||||
scale: 0.7,
|
||||
autoAlpha: 0,
|
||||
});
|
||||
gsap.killTweensOf(".draw-light,.draw");
|
||||
}, 1000);
|
||||
});
|
||||
};
|
||||
|
||||
@ -115,6 +126,8 @@ onMounted(() => {
|
||||
</div>
|
||||
<div class="draw-star"></div>
|
||||
<div class="draw-tips"></div>
|
||||
<!-- 关闭按钮 -->
|
||||
<div class="draw-cls-btn" @click="hide($event)"></div>
|
||||
</div>
|
||||
<div v-show="showResult" class="result-container">
|
||||
<!-- 有奖品 -->
|
||||
@ -132,6 +145,7 @@ onMounted(() => {
|
||||
<div class="cls-btn" @click="hide($event)"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -146,6 +160,12 @@ onMounted(() => {
|
||||
@include box(685px, 694px);
|
||||
position: relative;
|
||||
|
||||
|
||||
.draw-cls-btn{
|
||||
@include pos(82px, 82px,300.5px,670px);
|
||||
@include bg_pos("prize/cls-btn.png");
|
||||
}
|
||||
|
||||
.draw-light {
|
||||
pointer-events: none;
|
||||
@include pos(685px, 694px, 0px, 0px);
|
||||
@ -231,5 +251,6 @@ onMounted(() => {
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
@ -36,10 +36,13 @@ const answerFn = (item, event) => {
|
||||
qid: cid,
|
||||
answer: item.secore,
|
||||
text: item.text,
|
||||
aid: item.aid
|
||||
});
|
||||
} else {
|
||||
answerList.value[has].answer = item.secore;
|
||||
answerList.value[has].text = item.text;
|
||||
answerList.value[has].aid = item.aid;
|
||||
|
||||
}
|
||||
|
||||
// 更新下一题信息
|
||||
@ -63,10 +66,12 @@ const answerFn = (item, event) => {
|
||||
qid: cid,
|
||||
answer: item.secore,
|
||||
text: item.text,
|
||||
aid: item.aid
|
||||
});
|
||||
} else {
|
||||
answerList.value[has].answer = item.secore;
|
||||
answerList.value[has].text = item.text;
|
||||
answerList.value[has].aid = item.aid;
|
||||
}
|
||||
resultBtnAni.play();
|
||||
}
|
||||
@ -139,6 +144,10 @@ const prevePage = (event) => {
|
||||
}
|
||||
activeId.value = "";
|
||||
currentId.value--;
|
||||
|
||||
// 查询上一题做的选择
|
||||
console.log('当前题库:',answerList.value[currentId.value]);
|
||||
activeId.value = answerList.value[currentId.value].aid
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -36,9 +36,7 @@ onMounted(() => {
|
||||
<div class="part">
|
||||
<div>【领奖说明】:</div>
|
||||
<div>
|
||||
1、中奖后在中奖页面复制兑换码,前往[平安理财服务号]
|
||||
消息框发送兑换码即可领取奖品。如关闭了中奖界面,可在首页-[我的奖品]
|
||||
内查看兑换码;
|
||||
1、中奖后在中奖页面复制兑换码,前往[平安理财服务号] 消息框输入“2024财运滚滚”获取兑换链接,进入链接输入兑换码兑换奖品。如关闭了中奖界面,可在首页-[我的奖品] 内查看兑换码。
|
||||
</div>
|
||||
<div>2、成功领奖后,奖品将会在24小时内自动到账,请耐心等候;</div>
|
||||
<div>3、中奖人请在活动结束前进行兑换,逾期视为弃权。</div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<div class="home" @click.once="playMusic">
|
||||
<Index v-if="showIndex" @IndexPage="indexFn"></Index>
|
||||
<Question v-if="showQuestion" @QuestionPage="questionFn"></Question>
|
||||
<Result v-if="showResult" @ResultPage="resultFn"></Result>
|
||||
@ -19,7 +19,7 @@ import MyPrize from "@/components/MyPrize";
|
||||
import Draw from "@/components/Draw";
|
||||
import Result from "@/components/Result";
|
||||
import Rule from "@/components/Rule";
|
||||
import { createBGM, getQueryString, screenOrientation } from "@/plugins";
|
||||
import { createBGM, getQueryString, screenOrientation, isAndriod } from "@/plugins";
|
||||
import { authorize, getUserInfo } from "@/api";
|
||||
import { Toast } from "vant";
|
||||
import { useMainStore } from "@/store";
|
||||
@ -109,7 +109,7 @@ onMounted(() => {
|
||||
getUserInfo({ code: code }).then((res) => {
|
||||
if (res.code == 0) {
|
||||
console.log("我的信息:", res.data);
|
||||
userStore.updateToken(res.data.authorization);
|
||||
userStore.updateToken(res.data);
|
||||
createBGM();
|
||||
// 开始加载组件
|
||||
showLoad.value = true;
|
||||
@ -119,35 +119,37 @@ onMounted(() => {
|
||||
if (res.code == 0) {
|
||||
console.log("重定向地址:", res.data);
|
||||
location.replace(res.data);
|
||||
}
|
||||
} else {
|
||||
// 活动已结束:6001
|
||||
if (res.code == "6001") {
|
||||
Toast.fail({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 活动已结束:6001
|
||||
if (res.code == "6001") {
|
||||
Toast.fail({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 活动未开启:6002
|
||||
if (res.code == "6002") {
|
||||
Toast({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
icon: "flag-o",
|
||||
forbidClick: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 活动未开启:6002
|
||||
if (res.code == "6002") {
|
||||
// 其余情况
|
||||
Toast({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
icon: "flag-o",
|
||||
forbidClick: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 其余情况
|
||||
Toast({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -156,26 +158,28 @@ onMounted(() => {
|
||||
if (res.code == 0) {
|
||||
console.log("重定向地址:", res.data);
|
||||
location.replace(res.data);
|
||||
} else {
|
||||
// 活动已结束:6001
|
||||
if (res.code == "6001") {
|
||||
Toast.fail({
|
||||
message: "活动已结束",
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
});
|
||||
}
|
||||
|
||||
// 活动未开启:6002
|
||||
if (res.code == "6002") {
|
||||
Toast({
|
||||
message: "活动未开始",
|
||||
duration: 0,
|
||||
icon: "flag-o",
|
||||
forbidClick: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 活动已结束:6001
|
||||
if (res.code == "6001") {
|
||||
Toast.fail({
|
||||
message: "活动已结束",
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
});
|
||||
}
|
||||
|
||||
// 活动未开启:6002
|
||||
if (res.code == "6002") {
|
||||
Toast({
|
||||
message: "活动未开始",
|
||||
duration: 0,
|
||||
icon: "flag-o",
|
||||
forbidClick: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@ -206,6 +210,16 @@ const fontAdpat = () => {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const playMusic = () => {
|
||||
if (isAndriod) {
|
||||
var audio = document.getElementById("audio");
|
||||
audio.play();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
@ -247,6 +261,7 @@ const fontAdpat = () => {
|
||||
@include bg_pos("orientation-icon.png");
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.orientation-text {
|
||||
color: #fff;
|
||||
font-size: 30px;
|
||||
|
||||
@ -58,6 +58,25 @@ export function createBGM() {
|
||||
setTimeout(() => {
|
||||
audioAni.play()
|
||||
}, 1000)
|
||||
|
||||
|
||||
// ios自动播放音乐
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
function audioAutoPlay() {
|
||||
var audio = document.getElementById("bg-music");
|
||||
audio.play();
|
||||
document.addEventListener(
|
||||
"WeixinJSBridgeReady",
|
||||
function () {
|
||||
WeixinJSBridge.invoke("getNetworkType", {}, function (e) {
|
||||
audio.play();
|
||||
});
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
audioAutoPlay();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ export const useMainStore = defineStore("counter", {
|
||||
actions: {
|
||||
updateToken(data) {
|
||||
this.token = data.authorization
|
||||
// this.hasDraw = data.drawNumber == 0 ? false : true
|
||||
this.hasDraw = data.drawNumber == 0 ? false : true
|
||||
|
||||
},
|
||||
updatePrize(data) {
|
||||
@ -30,8 +30,10 @@ export const useMainStore = defineStore("counter", {
|
||||
updateMBTI(type) {
|
||||
this.MBTI = type
|
||||
},
|
||||
updateDrawKey(key) {
|
||||
this.drawKey = key
|
||||
updateDrawKey(data) {
|
||||
console.log('保存结果:',data);
|
||||
this.drawKey = data.subKey
|
||||
this.hasDraw = data.drawFlag
|
||||
},
|
||||
updateDraw(value) {
|
||||
this.hasDraw = false
|
||||
|
||||
Loading…
Reference in New Issue
Block a user