chore(恢复过期活动): 暂时保留以便查看数据

This commit is contained in:
hzj 2025-12-03 11:41:39 +08:00
parent 365c3c220a
commit 9bbe7fe313

View File

@ -1,10 +1,10 @@
<!-- src/views/Activities/Oman/NationalDay/index.vue --> <!-- src/views/Activities/heroesDay/index.vue -->
<template> <template>
<div class="fullPage"> <div class="fullPage">
<!-- 新增的背景图层 --> <!-- 新增的背景图层 -->
<div class="background-overlay"></div> <div class="background-overlay"></div>
<div class="bg" :style="{ '--bg-url': `url(${imageUrl('bg')})` }"> <div class="bg">
<!-- 状态栏占位区域仅在APP中显示 --> <!-- 状态栏占位区域仅在APP中显示 -->
<div v-if="isInAppEnvironment" style="height: 30px"></div> <div v-if="isInAppEnvironment" style="height: 30px"></div>
@ -23,25 +23,25 @@
<!-- 倒计时 --> <!-- 倒计时 -->
<div style="display: flex; justify-content: center; gap: 4px; margin-top: 1vw"> <div style="display: flex; justify-content: center; gap: 4px; margin-top: 1vw">
<div style="width: 20%"> <div style="width: 20%">
<itemCenter :imgUrl="imageUrl('timeDayBg')"> <itemCenter :imgUrl="images.timeDayBg">
<div class="timeText" style="margin-bottom: 20%">{{ Days }}D</div> <div class="timeText" style="margin-bottom: 20%">{{ Days }}D</div>
</itemCenter> </itemCenter>
</div> </div>
<div class="timeText timeGap" style="width: 6px"></div> <div class="timeText timeGap" style="width: 6px"></div>
<div style="width: 20%"> <div style="width: 20%">
<itemCenter :imgUrl="imageUrl('timeHourBg')"> <itemCenter :imgUrl="images.timeHourBg">
<div class="timeText" style="margin-bottom: 20%">{{ Hours }}</div> <div class="timeText" style="margin-bottom: 20%">{{ Hours }}</div>
</itemCenter> </itemCenter>
</div> </div>
<div class="timeText timeGap">:</div> <div class="timeText timeGap">:</div>
<div style="width: 20%"> <div style="width: 20%">
<itemCenter :imgUrl="imageUrl('timeMinBg')"> <itemCenter :imgUrl="images.timeMinBg">
<div class="timeText" style="margin-bottom: 20%">{{ Minutes }}</div> <div class="timeText" style="margin-bottom: 20%">{{ Minutes }}</div>
</itemCenter> </itemCenter>
</div> </div>
<div class="timeText timeGap">:</div> <div class="timeText timeGap">:</div>
<div style="width: 20%"> <div style="width: 20%">
<itemCenter :imgUrl="imageUrl('timeSecBg')"> <itemCenter :imgUrl="images.timeSecBg">
<div class="timeText" style="margin-bottom: 20%">{{ Second }}</div> <div class="timeText" style="margin-bottom: 20%">{{ Second }}</div>
</itemCenter> </itemCenter>
</div> </div>
@ -49,22 +49,21 @@
<!-- 每周礼物 --> <!-- 每周礼物 -->
<div style="display: flex; justify-content: center; margin-top: 10px"> <div style="display: flex; justify-content: center; margin-top: 10px">
<itemCenter :imgUrl="imageUrl('giftsBg')" :contentStyle="'paddingTop: 10%;'"> <itemCenter :imgUrl="images.giftsBg" :contentStyle="'paddingTop: 10%;'">
<div style="width: 85%; display: flex; justify-content: space-around; margin-top: 10%"> <div style="width: 85%; display: flex; justify-content: space-around; margin-top: 10%">
<div <div
v-for="(gift, index) in gifts" v-for="(gift, index) in gifts"
:key="index" :key="index"
style="width: 30%; display: flex; flex-direction: column" style="width: 30%; display: flex; flex-direction: column"
> >
<itemCenter :imgUrl="imageUrl('giftItemBg')"> <itemCenter :imgUrl="images.giftItemBg"
<img ><img
v-smart-img v-smart-img
:src="gift.giftPhoto" :src="gift.giftPhoto"
alt="" alt=""
width="70%" width="70%"
style="display: block; object-fit: cover" style="display: block; object-fit: cover"
/> /></itemCenter>
</itemCenter>
<div style="display: flex; justify-content: center; align-items: center; gap: 5px"> <div style="display: flex; justify-content: center; align-items: center; gap: 5px">
<img <img
v-smart-img v-smart-img
@ -85,14 +84,14 @@
<div style="display: flex; justify-content: space-around"> <div style="display: flex; justify-content: space-around">
<img <img
v-smart-img v-smart-img
:src="rankingShow ? imageUrl('rankingBtActive') : imageUrl('rankingBt')" :src="rankingShow ? images.rankingBtActive : images.rankingBt"
alt="" alt=""
style="display: block; width: 40%" style="display: block; width: 40%"
@click="rankingShow = true" @click="rankingShow = true"
/> />
<img <img
v-smart-img v-smart-img
:src="!rankingShow ? imageUrl('rewardBtActive') : imageUrl('rewardsBt')" :src="!rankingShow ? images.rewardBtActive : images.rewardsBt"
alt="" alt=""
style="display: block; width: 40%" style="display: block; width: 40%"
@click="rankingShow = false" @click="rankingShow = false"
@ -114,12 +113,12 @@
></div> ></div>
<div style="position: relative; z-index: 1"> <div style="position: relative; z-index: 1">
<!-- 前三名 --> <!-- 前三名 -->
<itemCenter :imgUrl="imageUrl('RankingMain')" :contentStyle="`padding: 25% 7% 10%`"> <itemCenter :imgUrl="images.RankingMain" :contentStyle="`padding: 25% 7% 10%`">
<div style="margin-top: 13%"> <div style="margin-top: 13%">
<!-- 第一 --> <!-- 第一 -->
<div style="display: flex; justify-content: center"> <div style="display: flex; justify-content: center">
<TopUser <TopUser
:BorderImgUrl="imageUrl('topOne')" :BorderImgUrl="images.topOne"
:avatarUrl="RankingHasTop3[0].avatar" :avatarUrl="RankingHasTop3[0].avatar"
:name="RankingHasTop3[0].nickname" :name="RankingHasTop3[0].nickname"
:distributionValue="RankingHasTop3[0].quantity" :distributionValue="RankingHasTop3[0].quantity"
@ -132,7 +131,7 @@
<TopUser <TopUser
:isTopOne="false" :isTopOne="false"
ranking="2" ranking="2"
:BorderImgUrl="imageUrl('topTwo')" :BorderImgUrl="images.topTwo"
:avatarUrl="RankingHasTop3[1].avatar" :avatarUrl="RankingHasTop3[1].avatar"
:name="RankingHasTop3[1].nickname" :name="RankingHasTop3[1].nickname"
:distributionValue="RankingHasTop3[1].quantity" :distributionValue="RankingHasTop3[1].quantity"
@ -142,7 +141,7 @@
<TopUser <TopUser
:isTopOne="false" :isTopOne="false"
ranking="3" ranking="3"
:BorderImgUrl="imageUrl('topThree')" :BorderImgUrl="images.topThree"
:avatarUrl="RankingHasTop3[2].avatar" :avatarUrl="RankingHasTop3[2].avatar"
:name="RankingHasTop3[2].nickname" :name="RankingHasTop3[2].nickname"
:distributionValue="RankingHasTop3[2].quantity" :distributionValue="RankingHasTop3[2].quantity"
@ -157,11 +156,8 @@
<div v-if="showRanking.length > 0" style="margin-bottom: 6vw; margin-top: -10vw"> <div v-if="showRanking.length > 0" style="margin-bottom: 6vw; margin-top: -10vw">
<itemCenter <itemCenter
v-for="listItem in showRanking" v-for="listItem in showRanking"
:key="listItem.userId" :imgUrl="images.RankingItem"
:imgUrl="imageUrl('RankingItem')"
:contentStyle="`padding: 0 10%`" :contentStyle="`padding: 0 10%`"
:lazy="true"
:immediate="index < 2"
@click="viewUserInfo(listItem.userId)" @click="viewUserInfo(listItem.userId)"
> >
<div style="width: 75%; min-width: 0; display: flex; align-items: center"> <div style="width: 75%; min-width: 0; display: flex; align-items: center">
@ -227,7 +223,7 @@
<!-- 底框 --> <!-- 底框 -->
<img <img
v-smart-img v-smart-img
:src="imageUrl('RankingBottomBorder')" :src="images.RankingBottomBorder"
alt="" alt=""
width="100%" width="100%"
style="display: block; margin-top: -22vw; position: relative; z-index: 9" style="display: block; margin-top: -22vw; position: relative; z-index: 9"
@ -254,7 +250,7 @@
:key="rewardIndex" :key="rewardIndex"
style="width: 100%" style="width: 100%"
> >
<itemCenter :imgUrl="imageUrl('giftItemBg')"> <itemCenter :imgUrl="images.giftItemBg">
<img <img
v-smart-img v-smart-img
:src="reward.cover || ''" :src="reward.cover || ''"
@ -288,7 +284,7 @@
background: linear-gradient(0deg, #6e1116 0%, #6e1116 100%), #d9d9d9; background: linear-gradient(0deg, #6e1116 0%, #6e1116 100%), #d9d9d9;
z-index: 2; z-index: 2;
" "
:imgUrl="imageUrl('myRankingBg')" :imgUrl="images.myRankingBg"
:contentStyle="`padding: 2% 5% 0`" :contentStyle="`padding: 2% 5% 0`"
> >
<div <div
@ -364,7 +360,7 @@
<maskLayer :maskLayerShow="maskLayerShow" @click="maskLayerShow = false"> <maskLayer :maskLayerShow="maskLayerShow" @click="maskLayerShow = false">
<!-- help弹窗 --> <!-- help弹窗 -->
<div style="margin: 20% 0" @click.stop> <div style="margin: 20% 0" @click.stop>
<img v-smart-img :src="imageUrl('helpInfo')" alt="" style="display: block; width: 100%" /> <img v-smart-img :src="images.helpInfo" alt="" style="display: block; width: 100%" />
</div> </div>
</maskLayer> </maskLayer>
</div> </div>
@ -372,20 +368,28 @@
</template> </template>
<script setup> <script setup>
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { isInApp, viewUserInfo } from '@/utils/appBridge.js' import { isInApp, viewUserInfo } from '@/utils/appBridge.js'
import { connectToApp } from '@/utils/appConnector.js' import { computed, onMounted, onUnmounted, ref } from 'vue'
import { getPngUrl } from '@/config/imagePaths.js'
import { preloadImages } from '@/utils/imagePreloader.js'
import { getThisWeekRewardsAndGifts, getRankingListAndMyRanking } from '@/api/activity.js'
import itemCenter from '@/components/itemCenter.vue' import itemCenter from '@/components/itemCenter.vue'
import TopUser from './components/topUser.vue' import TopUser from './components/topUser.vue'
import maskLayer from '@/components/MaskLayer.vue' import maskLayer from '@/components/MaskLayer.vue'
import { getThisWeekRewardsAndGifts, getRankingListAndMyRanking } from '@/api/activity.js'
import { connectToApp } from '@/utils/appConnector.js'
// OSSURL // vite
const imageUrl = (filename) => getPngUrl('Activities/Oman/NationalDay/', filename) const imageModules = import.meta.glob(
'@/assets/images/Activities/Oman/NationalDay/*.{png,jpg,svg}',
{
eager: true,
}
)
//
const images = Object.fromEntries(
Object.entries(imageModules).map(([path, module]) => {
const fileName = path.split('/').pop().split('.')[0]
return [fileName, module.default]
})
)
const isInAppEnvironment = ref(false) // APP const isInAppEnvironment = ref(false) // APP
const maskLayerShow = ref(false) // const maskLayerShow = ref(false) //
@ -405,7 +409,7 @@ const myRanking = ref({}) // 我的排名
const rewardsList = ref([]) // const rewardsList = ref([]) //
const gifts = ref([]) // const gifts = ref([]) //
const topImg = ref([imageUrl('top1RewardBg'), imageUrl('top2RewardBg'), imageUrl('top3RewardBg')]) // top const topImg = ref([images.top1RewardBg, images.top2RewardBg, images.top3RewardBg]) // top
// 3 // 3
const RankingHasTop3 = computed(() => { const RankingHasTop3 = computed(() => {
@ -424,6 +428,7 @@ const RankingHasTop3 = computed(() => {
// //
const showRanking = computed(() => { const showRanking = computed(() => {
return Ranking.value.filter((_, index) => index >= 3) return Ranking.value.filter((_, index) => index >= 3)
// return []
}) })
// //
@ -517,42 +522,11 @@ const initData = () => {
getRewardsAndGifts() // getRewardsAndGifts() //
} }
//
const preloadCriticalImages = () => {
const criticalImages = [
imageUrl('bg'),
imageUrl('timeDayBg'),
imageUrl('timeHourBg'),
imageUrl('timeMinBg'),
imageUrl('timeSecBg'),
imageUrl('giftsBg'),
imageUrl('giftItemBg'),
imageUrl('rankingBt'),
imageUrl('rankingBtActive'),
imageUrl('rewardBtActive'),
imageUrl('rewardsBt'),
imageUrl('RankingMain'),
imageUrl('topOne'),
imageUrl('topTwo'),
imageUrl('topThree'),
imageUrl('RankingItem'),
imageUrl('RankingBottomBorder'),
imageUrl('myRankingBg'),
imageUrl('helpInfo'),
imageUrl('top1RewardBg'),
imageUrl('top2RewardBg'),
imageUrl('top3RewardBg'),
]
preloadImages(criticalImages, { useSmartCache: true })
}
// 使APP // 使APP
const connectToAppHandler = async () => { const connectToAppHandler = async () => {
await connectToApp(() => { await connectToApp(() => {
// //
initData() // initData() //
preloadCriticalImages() //
}) })
} }
@ -594,7 +568,7 @@ onUnmounted(() => {
.bg { .bg {
width: 100vw; width: 100vw;
min-height: 100vh; min-height: 100vh;
background-image: var(--bg-url); background-image: url(../../../../assets/images/Activities/Oman/NationalDay/bg.png);
background-size: 100% auto; background-size: 100% auto;
background-repeat: no-repeat; background-repeat: no-repeat;
position: relative; position: relative;