完成逻辑

This commit is contained in:
Andy Leong 2024-02-06 22:25:55 +08:00
parent 98d301a749
commit 2ae9dc33f4
10 changed files with 17 additions and 30 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -46,6 +46,11 @@ const answerFn = (item, event) => {
userStore.updatePosterId(getRandomNumber([1, 2, 3]))
gsap.set('.question-box', { pointerEvents: 'none' })
Toast('答题结束')
Toast.loading({
message: '结果生成中',
duration: 0,
forbidClick: true,
})
if (import.meta.env.VITE_MODE != "dev") {
//
@ -55,14 +60,18 @@ const answerFn = (item, event) => {
userStore.updateDrawKey(res.data);
}
setTimeout(() => {
Toast.clear()
gsap.to('.QuestionPage', {
duration: 0.5, autoAlpha: 0, onComplete: () => {
emit("QuestionPage", { action: "showResult" });
}
})
}, 1000)
});
} else {
setTimeout(() => {
Toast.clear()
gsap.to('.QuestionPage', {
duration: 0.5, autoAlpha: 0, onComplete: () => {
emit("QuestionPage", { action: "showResult" });
@ -72,32 +81,11 @@ const answerFn = (item, event) => {
}
}
console.log("答案库", answerList.value);
});
};
const showResult = () => {
gsap.set(".answer-box", { pointerEvents: "none" })
gsap.to(".prev-btn", { duration: 0.5, x: "-=20px", autoAlpha: 0 });
questionOut.timeScale(2);
questionOut.restart();
questionOut.eventCallback("onComplete", () => {
gsap.to(".QuestionPage", {
duration: 0.5,
autoAlpha: 0,
onComplete: () => {
emit("QuestionPage", { action: "showResult" });
},
});
});
};
//
const getRandomNumber = (arr) => {
var randomIndex = Math.floor(Math.random() * arr.length);
@ -246,7 +234,6 @@ onMounted(() => {
width: 100%;
font-family: 'DouyinSansBold';
font-size: 35px;
font-family: "DOUYINSANSBOLD";
color: rgb(255, 255, 255);
text-align: center;
padding: 10px;