diff --git a/.env.prd b/.env.prd index b112485..9b7d66e 100644 --- a/.env.prd +++ b/.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 \ No newline at end of file +VITE_API = /intfgw/data/mmoactivity +VITE_URL = https://w.pingan.com.cn/lckj/pawm-mmo-activity-xgl-frontend/index.html \ No newline at end of file diff --git a/src/components/Draw.vue b/src/components/Draw.vue index 338accc..3531811 100644 --- a/src/components/Draw.vue +++ b/src/components/Draw.vue @@ -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(() => {
+ +