添加排名奖励

This commit is contained in:
xiaoaojiao
2025-09-23 19:33:14 +08:00
parent 1a8a9d9fd4
commit 2ee6172498
3 changed files with 47 additions and 8 deletions

View File

@@ -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() => {
<MyPhoto @go-photo-square="showPhotoSquare" v-model:show="isMyPhotoVisible" />
<PhotoSquare @go-my-photo="showMyPhoto" v-model:show="isPhotoSquareVisible" />
<Login :show="loginShow" @login-success="handleLoginSuccess" />
<Lottery :show="lotteryShow" @close="lotteryShow = false" :type="lotteryType"></Lottery>
<Lottery :show="lotteryShow" @close="lotteryShow = false" :type="lotteryType" :data="lotteryNoticeData"></Lottery>
</template>
<style scoped>