From 19bd6cdbdfffae8f62205fbef713c7518a79eb93 Mon Sep 17 00:00:00 2001 From: hzj <1304805162@qq.com> Date: Wed, 4 Feb 2026 15:13:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B8=B8=E6=88=8F=E7=8E=8B=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2):=20=E6=96=B0=E5=A2=9E=E6=AF=8F=E6=97=A5=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/gamesKing.js | 17 ++++ src/views/Ranking/GamesKing/index.vue | 114 ++++++++++++++++++++++---- 2 files changed, 115 insertions(+), 16 deletions(-) create mode 100644 src/stores/gamesKing.js diff --git a/src/stores/gamesKing.js b/src/stores/gamesKing.js new file mode 100644 index 0000000..6e8f6d0 --- /dev/null +++ b/src/stores/gamesKing.js @@ -0,0 +1,17 @@ +import { defineStore } from 'pinia' + +export const useGamesKingStore = defineStore('gamesKing', { + state: () => ({ + checkDate: '', // 对应几号 + checkStatus: false, // 是否已看过 + }), + + actions: { + setGamesKing(checkDate, checkStatus) { + this.checkDate = checkDate + this.checkStatus = checkStatus + }, + }, + + persist: true, +}) diff --git a/src/views/Ranking/GamesKing/index.vue b/src/views/Ranking/GamesKing/index.vue index b9fdb28..5c33cd9 100644 --- a/src/views/Ranking/GamesKing/index.vue +++ b/src/views/Ranking/GamesKing/index.vue @@ -51,7 +51,7 @@ :src="imageUrl('helpBt')" alt="" style="display: block; position: relative; width: 8vw; margin-right: 4vw" - @click="maskLayerShow = true" + @click="openPopup('help')" /> @@ -677,20 +677,46 @@ - - -
- - - + + +
+ +
+ + + +
+ + +
+ + + + +
@@ -706,6 +732,8 @@ import { useLangStore } from '@/stores/lang' import { getPngUrl, getWebpUrl } from '@/config/imagePaths.js' import { preloadImages } from '@/utils/imagePreloader.js' import { handleAvatarImageError, handleRewardImageError } from '@/utils/imageHandler.js' +import { useGamesKingStore } from '@/stores/gamesKing' +import { storeToRefs } from 'pinia' import { getThisWeekRewardsAndGifts, // 获取本周奖励和礼物 @@ -719,7 +747,7 @@ import TopUser from './components/topUser.vue' import maskLayer from '@/components/MaskLayer.vue' const isInAppEnvironment = ref(false) // 检测是否在APP环境中 -const maskLayerShow = ref(false) //帮助模块 +const gamesKingStore = useGamesKingStore() // 预加载状态 const isLoading = ref(true) @@ -739,6 +767,58 @@ const getImgName = (filename) => { return currentLangType.value === 'ar' ? `${filename}_ar` : filename } +const { + checkDate, // 对应周几 + checkStatus, // 是否已看过 +} = storeToRefs(gamesKingStore) + +const helpShow = ref(false) //帮助模块 +const dailyPopUpShow = ref(false) +const maskLayerShow = computed(() => { + return helpShow.value || dailyPopUpShow.value +}) + +// 打开弹窗 +const openPopup = (type) => { + closedPopup() //先关闭其他弹窗 + switch (type) { + case 'help': + helpShow.value = true + break + case 'dailyPopUp': + dailyPopUpShow.value = true + break + default: + break + } +} + +// 关闭弹窗 +const closedPopup = () => { + // 此时打开的是每日弹窗,设置为已看过 + if (dailyPopUpShow.value) { + checkStatus.value = true + } + + // 关闭所有弹窗 + helpShow.value = false + dailyPopUpShow.value = false +} + +// 检查今日是否已看过 +const checkShow = () => { + const now = new Date() + const dailyDate = now.getMonth() + '-' + now.getDate() + + if (dailyDate != checkDate.value) { + checkDate.value = dailyDate // 更新周几 + checkStatus.value = false // 更新今日状态 + openPopup('dailyPopUp') + } else if (!checkStatus.value) { + openPopup('dailyPopUp') + } +} + // 倒计时 const Days = ref(0) const Hours = ref(0) @@ -1033,6 +1113,8 @@ onMounted(() => { preloadOtherImages() // 预加载其他图片 isInAppEnvironment.value = isInApp() + checkShow() // 检查是否展示每日弹窗 + getCountdown() timer = setInterval(getCountdown, 1000) //倒计时每秒更新 })