完成海报页面逻辑,及流程整合

This commit is contained in:
Andy Leong
2024-02-04 18:30:23 +08:00
parent abbae9aede
commit 67c8521b18
78 changed files with 213 additions and 714 deletions

View File

@@ -42,32 +42,46 @@ const answerFn = (item, event) => {
activeId.value = ''
} else {
// 随机生成海报id
userStore.updatePosterId(getRandomNumber([1, 2, 3]))
gsap.set('.question-box', { pointerEvents: 'none' })
Toast('答题结束')
gsap.set('.question-box',{pointerEvents:'none'})
}
if (import.meta.env.VITE_MODE != "dev") {
// 提交完成记录
subAnswer({}, userStore.token).then((res) => {
console.log("key:", res);
if (res.code == 0) {
userStore.updateDrawKey(res.data);
}
gsap.to('.QuestionPage', {
duration: 0.5, autoAlpha: 0, onComplete: () => {
emit("QuestionPage", { action: "showResult" });
}
})
});
} else {
setTimeout(() => {
gsap.to('.QuestionPage', {
duration: 0.5, autoAlpha: 0, onComplete: () => {
emit("QuestionPage", { action: "showResult" });
}
})
}, 1000)
}
}
console.log("答案库", answerList.value);
});
};
const mbtiArr = [[], [], [], []]; //四组数组分别存放 E&IS&TT&FJ&P四组结果
const showResult = () => {
gsap.set(".answer-box", { pointerEvents: "none" });
if (import.meta.env.VITE_MODE != "dev") {
// 提交完成记录
subAnswer({}, userStore.token).then((res) => {
console.log("key:", res);
if (res.code == 0) {
userStore.updateDrawKey(res.data);
}
});
}
gsap.set(".answer-box", { pointerEvents: "none" })
// Toast("你的MBTI测试结果:" + mbti);
// resultBtnAni.reverse();
gsap.to(".prev-btn", { duration: 0.5, x: "-=20px", autoAlpha: 0 });
@@ -85,7 +99,11 @@ const showResult = () => {
};
// 从数组中随机生成一个数字
const getRandomNumber = (arr) => {
var randomIndex = Math.floor(Math.random() * arr.length);
return arr[randomIndex];
}
// 查看结果事件及动画
// const resultBtnAni = gsap.timeline({ paused: true });