修改抽奖动画
This commit is contained in:
@@ -32,11 +32,11 @@ import ModalTransition from "./ModalTransition.vue"
|
||||
import confetti from "canvas-confetti";
|
||||
import { Request, Sleep } from "../libs/utils"
|
||||
import { globalStore } from "@/globalstore";
|
||||
import getUserPicture from "../libs/getUserPicture";
|
||||
//TODO: globalStore.result_url 这里这张图要用用户分享那张图
|
||||
// import lotteryFace from "../assets/images/haibao-cover.webp"
|
||||
|
||||
const lotteryFace = globalStore.result_url;
|
||||
const lotteryFaceUrl = ref(lotteryFace)
|
||||
const lotteryFaceUrl = ref('')
|
||||
const cardRef = ref(null)
|
||||
const sceneRef = ref(null)
|
||||
const guangRef = ref(null)
|
||||
@@ -117,12 +117,24 @@ watch(() => props.show, async (newVal) => {
|
||||
return
|
||||
}
|
||||
|
||||
const loading = weui.loading()
|
||||
const userPicture = await getUserPicture()
|
||||
|
||||
const preimg = async() => {
|
||||
new Promise((resolve) => {
|
||||
const img = new Image()
|
||||
img.onload = () => resolve(img)
|
||||
img.src = userPicture
|
||||
})
|
||||
}
|
||||
await preimg()
|
||||
lotteryFaceUrl.value = userPicture
|
||||
|
||||
shakeTimeline.play()
|
||||
|
||||
//TODO: 延时测试,上限删掉
|
||||
// await Sleep(2000)
|
||||
// await Sleep(20000)
|
||||
|
||||
shakeTimeline.pause()
|
||||
|
||||
const lottteryResult = await Request("lottery/draw", { pool: 'game', consume_type: 'points' })
|
||||
// TODO: 测试数据
|
||||
// const lottteryResult = {
|
||||
@@ -136,6 +148,9 @@ watch(() => props.show, async (newVal) => {
|
||||
// }
|
||||
// }
|
||||
|
||||
loading.hide()
|
||||
shakeTimeline.pause()
|
||||
|
||||
if (lottteryResult.res.status !== 200) {
|
||||
emit('close')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user