From 2ee6172498308d7a537ffe9c8b3924bec674392b Mon Sep 17 00:00:00 2001 From: xiaoaojiao Date: Tue, 23 Sep 2025 19:33:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=92=E5=90=8D=E5=A5=96?= =?UTF-8?q?=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/HomePage.vue | 17 ++++++++++--- src/components/Lottery.vue | 36 ++++++++++++++++++++++++--- src/components/SynthesizedResults.vue | 2 +- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/src/components/HomePage.vue b/src/components/HomePage.vue index 7500219..35a6fcd 100644 --- a/src/components/HomePage.vue +++ b/src/components/HomePage.vue @@ -22,6 +22,7 @@ const videoLoaded = ref(false); const videoError = ref(false); const lotteryShow = ref(false) const lotteryType = ref("draw") +const lotteryNoticeData = ref(null) // 初始化全局音频实例 const initGlobalAudio = () => { @@ -228,6 +229,8 @@ const handleLottery = () => { if (globalStore.draw_chances <= 0) { return weui.alert("还没有抽奖机会,快去参加活动吧") }; + lotteryType.value = 'draw' + lotteryNoticeData.value = null globalToastEvent.emit(ToastType.SHOW_LOTTERY) } @@ -307,12 +310,20 @@ const initUserGameInfos = async (refresh_official, refresh_cap_scan) => { globalToastEvent.emit(ToastType.MOUNTED) } } - +const getNotice = async () => { + const result = await Request('notice/latest', {}, "GET") + if (result.json.notification) { + lotteryType.value = 'notice' + lotteryNoticeData.value = result.json.notification + lotteryShow.value = true + } +} const handleLoginSuccess = async () => { console.log("已登录") loginShow.value = false await initUserGameInfos(true, true) + await getNotice() } if (isLogin()) { @@ -334,7 +345,7 @@ watch(() => mergeId, async (newVal) => { } }, { immediate: true }) -globalToastEvent.on(ToastType.SHOW_LOTTERY, async() => { +globalToastEvent.on(ToastType.SHOW_LOTTERY, async () => { await initUserGameInfos(false, false); lotteryShow.value = true }) @@ -413,7 +424,7 @@ globalToastEvent.on(ToastType.SHOW_LOTTERY, async() => { - +