剩下兑奖逻辑
This commit is contained in:
@@ -32,16 +32,21 @@ const drawFn = (event) => {
|
||||
);
|
||||
|
||||
try {
|
||||
const res = await drawApi({}, userStore.token);
|
||||
const res = await drawApi(
|
||||
{ subAnswerKey: userStore.drawKey },
|
||||
userStore.token
|
||||
);
|
||||
if (res.code == 0) {
|
||||
// isDrawn后端判断有没有中奖
|
||||
hasPrize.value = res.data.isDrawn == 1 ? true : false; // true 中奖 || false 未中奖
|
||||
userStore.updateDraw(); // 更新抽奖机会
|
||||
|
||||
// if (res.data.isDrawn == 1) {
|
||||
// hasPrize.value = true
|
||||
// } else {
|
||||
// hasPrize.value = false
|
||||
// }
|
||||
// 有奖品的话更新奖品信息
|
||||
if (res.data.isDrawn == 1) {
|
||||
money.value = res.data.prizeAmount;
|
||||
code.value = res.data.prizeCode;
|
||||
userStore.updatePrize(res.data);
|
||||
}
|
||||
} else {
|
||||
hasPrize.value = false; // true 中奖 || false 未中奖
|
||||
}
|
||||
@@ -60,15 +65,6 @@ const drawFn = (event) => {
|
||||
});
|
||||
gsap.killTweensOf(".draw-light,.draw");
|
||||
}, 1000);
|
||||
|
||||
// setTimeout(() => {
|
||||
// hasPrize.value = false // true 中奖 || false 未中奖
|
||||
// showResult.value = true
|
||||
// console.log("showResult:", showResult.value);
|
||||
// Toast.clear()
|
||||
// gsap.from('.result-container', { duration: 0.5, scale: 0.7, autoAlpha: 0 })
|
||||
// gsap.killTweensOf('.draw-light,.draw')
|
||||
// }, 3000)
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ import { Toast } from "vant";
|
||||
import gsap from "gsap";
|
||||
import Preloader from "@/plugins/Preloader";
|
||||
import { loadImg, pageImg } from "@/data/imgList";
|
||||
import { getMyPrize } from '@/api'
|
||||
import { useMainStore } from '@/store'
|
||||
import { getMyPrize } from "@/api";
|
||||
import { useMainStore } from "@/store";
|
||||
|
||||
// 页面配置初始化
|
||||
const emit = defineEmits(["LoadPage"]);
|
||||
const userStore = useMainStore()
|
||||
const userStore = useMainStore();
|
||||
|
||||
const loadNum = ref(0);
|
||||
|
||||
@@ -45,19 +45,18 @@ onMounted(() => {
|
||||
duration: 0.2,
|
||||
autoAlpha: 1,
|
||||
onComplete: () => {
|
||||
if(import.meta.env.VITE_MODE!='dev'){
|
||||
getMyPrize({}, userStore.token).then(
|
||||
res => {
|
||||
if (import.meta.env.VITE_MODE != "dev") {
|
||||
getMyPrize({}, userStore.token).then((res) => {
|
||||
if (res.code == 0) {
|
||||
console.log('我的奖品', res);
|
||||
if(res.data){
|
||||
// userStore.updatePrize(code,money)
|
||||
console.log("我的奖品", res);
|
||||
if (res.data) {
|
||||
console.log("有奖品");
|
||||
userStore.updatePrize(res.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Preloader({
|
||||
name: "内页资源",
|
||||
imgs: pageImg,
|
||||
@@ -81,9 +80,6 @@ onMounted(() => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -104,8 +104,7 @@ const showResult = (event) => {
|
||||
subAnswer({}, userStore.token).then((res) => {
|
||||
console.log("key:", res);
|
||||
if (res.code == 0) {
|
||||
userStore.updateDrawKey(res.data)
|
||||
|
||||
userStore.updateDrawKey(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -218,11 +217,11 @@ onMounted(() => {
|
||||
duration: 1.5,
|
||||
ease: "slow(0.7,0.7,false)",
|
||||
onStart: () => {
|
||||
gsap.to(".question-bg", {
|
||||
backgroundPosition: "0px 835px",
|
||||
duration: 0.75,
|
||||
ease: "slow(0.7,0.7,false)",
|
||||
});
|
||||
// gsap.to(".question-bg", {
|
||||
// backgroundPosition: "0px 835px",
|
||||
// duration: 0.75,
|
||||
// ease: "slow(0.7,0.7,false)",
|
||||
// });
|
||||
},
|
||||
})
|
||||
.to(
|
||||
|
||||
@@ -30,6 +30,8 @@ const posterBg = reactive([
|
||||
new URL("@/assets/images/result/poster-bg-4.jpg", import.meta.url).href,
|
||||
]);
|
||||
|
||||
// console.log("mbtiList", mbtiList.length);
|
||||
|
||||
const changBg = (event, number) => {
|
||||
let e = event.target;
|
||||
if (number == bgId.value) return;
|
||||
@@ -51,7 +53,7 @@ onMounted(() => {
|
||||
QRCode.toDataURL(eqCodeUrl)
|
||||
.then((url) => {
|
||||
eqcodePic.value = url;
|
||||
console.log("eq", eqcodePic.value);
|
||||
// console.log("eq", eqcodePic.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
@@ -197,7 +199,7 @@ const goDraw = (event) => {
|
||||
if (userStore.hasDraw) {
|
||||
emit("ResultPage", { action: "showDraw" });
|
||||
} else {
|
||||
Toast("暂无抽奖机会");
|
||||
Toast("今日暂无抽奖机会");
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -324,7 +326,7 @@ const hideShare = () => {
|
||||
}
|
||||
|
||||
.mbti-title {
|
||||
@include pos(480px, 120px, 90px, 418px);
|
||||
@include pos(600px, 120px, 90px, 418px);
|
||||
font-size: 80px;
|
||||
font-family: "HYYaKuHei";
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user