完成部分接口联调

This commit is contained in:
XGL-THINKPAD-X1\rucky
2024-01-16 17:43:41 +08:00
parent 3c258cff70
commit 27b1eab2ce
8 changed files with 182 additions and 19 deletions

View File

@@ -4,7 +4,7 @@ import { addPoint, debounceTap } from '@/plugins'
import { Toast } from "vant";
import { Clipboard } from "v-clipboard";
import { useMainStore } from "@/store";
import { drawApi } from '@/api'
// import { drawApi } from '@/api'
// 页面配置初始化
@@ -29,16 +29,35 @@ const drawFn = (event) => {
gsap.fromTo(e, { rotation: '-30' }, { rotation: '+30', repeat: -1, yoyo: true, ease: 'none', duration: 0.3 })
// const res = await drawApi({})
const res = await draw({},userStore.token)
if(res.code == 0){
// isDrawn后端判断有没有中将
hasPrize.value = res.data.isDrawn == 1 ? true : false // true 中奖 || false 未中奖
if(res.data.isDrawn == 1){
hasPrize.value = true
}else{
setTimeout(() => {
}
}else{
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)
}
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')
// 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)
})
}

View File

@@ -1,11 +1,14 @@
<script setup>
import { Button, Toast } from "vant";
import { Toast } from "vant";
import { debounceTap } from "@/plugins";
import gsap from "gsap";
import {draw} from '@/api'
import {useMainStore} from '@/store'
const emit = defineEmits(["IndexPage"]);
const userStore = useMainStore()
const start = (event) => {
const start = (event) => {
debounceTap(event.target, () => {
emit("IndexPage", { action: "start" });
gsap.to(".IndexPage", {

View File

@@ -4,9 +4,12 @@ import gsap from "gsap";
import { debounceTap } from "@/plugins";
import Preloader from "@/plugins/Preloader";
import { loadImg, pageImg } from "@/data/imgList";
import {getMyPrize} from '@/api'
import {useMainStore} from '@/store'
// 页面配置初始化
const emit = defineEmits(["LoadPage"]);
const userStore = useMainStore()
const loadNum = ref(0);
@@ -43,6 +46,13 @@ onMounted(() => {
duration: 0.2,
autoAlpha: 1,
onComplete: () => {
getMyPrize({},userStore.token).then(
res=>{
if(res.code == 0){
console.log('我的奖品',res);
}
}
)
Preloader({
name: "内页资源",
imgs: pageImg,
@@ -53,6 +63,7 @@ onMounted(() => {
},
}).then((res) => {
console.log("加载完成");
gsap.to(".LoadPage", {
duration: 1,
autoAlpha: 0,
@@ -65,6 +76,9 @@ onMounted(() => {
});
});
});
</script>
<template>