feat(游戏王页面): 新增每日弹窗

This commit is contained in:
hzj 2026-02-04 15:13:40 +08:00
parent 7e3ed71c9e
commit 19bd6cdbdf
2 changed files with 115 additions and 16 deletions

17
src/stores/gamesKing.js Normal file
View File

@ -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,
})

View File

@ -51,7 +51,7 @@
:src="imageUrl('helpBt')"
alt=""
style="display: block; position: relative; width: 8vw; margin-right: 4vw"
@click="maskLayerShow = true"
@click="openPopup('help')"
/>
</div>
@ -677,20 +677,46 @@
</itemCenter>
<!-- 弹窗遮罩层 -->
<maskLayer :maskLayerShow="maskLayerShow" @click="maskLayerShow = false">
<!-- help弹窗 -->
<div style="margin: 10vh 0 5vh" @click.stop>
<itemCenter
:imgUrl="imageUrl(getImgName('helpBg'))"
:contentStyle="`inset: 15% 8% 3%;overflow-y: auto;display:block;`"
>
<img
v-smart-img
:src="imageUrl(getImgName('helpInfo'))"
alt=""
style="display: block; width: 100%; object-fit: cover; margin-bottom: 6vw"
/>
</itemCenter>
<maskLayer :maskLayerShow="maskLayerShow" @click="closedPopup">
<!-- 居中弹窗 -->
<div
style="
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
"
@click="closedPopup"
>
<!-- help弹窗 -->
<div v-show="helpShow" @click.stop>
<itemCenter
:imgUrl="imageUrl(getImgName('helpBg'))"
:contentStyle="`inset: 15% 8% 3%;overflow-y: auto;display:block;`"
>
<img
v-smart-img
:src="imageUrl(getImgName('helpInfo'))"
alt=""
style="display: block; width: 100%; object-fit: cover; margin-bottom: 6vw"
/>
</itemCenter>
</div>
<!-- 每日弹窗 -->
<div v-show="dailyPopUpShow" @click.stop>
<itemCenter :imgUrl="imageUrl(getImgName('dailyPopUp'))">
<!-- 关闭按钮 -->
<img
v-smart-img
:src="imageUrl('closeBt')"
alt=""
style="display: block; position: absolute; width: 8vw; top: -1vw; right: 2vw"
@click="closedPopup"
/>
</itemCenter>
</div>
</div>
</maskLayer>
</div>
@ -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) //
})