同步数据

This commit is contained in:
XGL-THINKPAD-X1\rucky 2024-01-23 16:12:41 +08:00
parent 2ab7f2daab
commit 8db3e50c0f
7 changed files with 134 additions and 69 deletions

View File

@ -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

View File

@ -14,12 +14,13 @@ 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("抽奖");
if(userStore.hasDraw){
Toast.loading({
message: "抽奖中",
forbidClick: true,
@ -31,12 +32,12 @@ const drawFn = (event) => {
{ rotation: "+30", repeat: -1, yoyo: true, ease: "none", duration: 0.3 }
);
try {
const res = await drawApi(
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,12 +49,15 @@ const drawFn = (event) => {
userStore.updatePrize(res.data);
}
} else {
hasPrize.value = false; // true || false
}
} catch (e) {
hasPrize.value = 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();
@ -65,6 +69,13 @@ const drawFn = (event) => {
});
gsap.killTweensOf(".draw-light,.draw");
}, 1000);
}
}
})
}else{
Toast('今日抽奖次数已用完!')
}
});
};
@ -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>

View File

@ -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
});
};

View File

@ -36,9 +36,7 @@ onMounted(() => {
<div class="part">
<div>领奖说明</div>
<div>
1中奖后在中奖页面复制兑换码前往[平安理财服务号]
消息框发送兑换码即可领取奖品如关闭了中奖界面可在首页-[我的奖品]
内查看兑换码
1中奖后在中奖页面复制兑换码前往[平安理财服务号] 消息框输入2024财运滚滚获取兑换链接进入链接输入兑换码兑换奖品如关闭了中奖界面可在首页-[我的奖品] 内查看兑换码
</div>
<div>2成功领奖后奖品将会在24小时内自动到账请耐心等候</div>
<div>3中奖人请在活动结束前进行兑换逾期视为弃权</div>

View File

@ -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,8 +119,7 @@ onMounted(() => {
if (res.code == 0) {
console.log("重定向地址:", res.data);
location.replace(res.data);
}
} else {
// 6001
if (res.code == "6001") {
Toast.fail({
@ -148,6 +147,9 @@ onMounted(() => {
duration: 0,
forbidClick: true,
});
}
});
}
});
@ -156,8 +158,7 @@ onMounted(() => {
if (res.code == 0) {
console.log("重定向地址:", res.data);
location.replace(res.data);
}
} else {
// 6001
if (res.code == "6001") {
Toast.fail({
@ -176,6 +177,9 @@ onMounted(() => {
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;

View File

@ -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();
});
}

View File

@ -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