feat(周星、国王皇后榜): 调整倒计时、更新帮助弹窗图源
This commit is contained in:
parent
a73cbe3928
commit
83abdf7db0
22
src/main.js
22
src/main.js
@ -41,10 +41,7 @@ app.use(pinia)
|
|||||||
const langStore = useLangStore() // 直接使用 import 的函数
|
const langStore = useLangStore() // 直接使用 import 的函数
|
||||||
|
|
||||||
//排行榜
|
//排行榜
|
||||||
const RankingPage = [
|
const RankingPage = []
|
||||||
'/top-list', //排行榜
|
|
||||||
'/weekly-star', //每周明星
|
|
||||||
]
|
|
||||||
|
|
||||||
// 活动页面
|
// 活动页面
|
||||||
const ACTIVITIES = [
|
const ACTIVITIES = [
|
||||||
@ -99,11 +96,14 @@ app.mount('#app')
|
|||||||
|
|
||||||
// 定时检查是否更新
|
// 定时检查是否更新
|
||||||
if (versionChecker.enableCheck) {
|
if (versionChecker.enableCheck) {
|
||||||
setInterval(async () => {
|
setInterval(
|
||||||
const versionResult = await versionChecker.checkServerVersion()
|
async () => {
|
||||||
if (versionResult.shouldUpdate) {
|
const versionResult = await versionChecker.checkServerVersion()
|
||||||
// 自动处理更新,不需要用户交互
|
if (versionResult.shouldUpdate) {
|
||||||
await versionChecker.handleVersionUpdate(versionResult.versionType)
|
// 自动处理更新,不需要用户交互
|
||||||
}
|
await versionChecker.handleVersionUpdate(versionResult.versionType)
|
||||||
}, 5 * 60 * 1000)
|
}
|
||||||
|
},
|
||||||
|
5 * 60 * 1000,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -336,19 +336,19 @@ const router = createRouter({
|
|||||||
name: 'couple',
|
name: 'couple',
|
||||||
component: () => import('../views/Ranking/Couple/index.vue'),
|
component: () => import('../views/Ranking/Couple/index.vue'),
|
||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
}, //北京时间每周一早上5点刷新
|
}, // 沙特每周一早上0点(北京时间5点)刷新
|
||||||
{
|
{
|
||||||
path: '/top-list',
|
path: '/top-list',
|
||||||
name: 'top-list',
|
name: 'top-list',
|
||||||
component: () => import('../views/Ranking/KingAndQueen/TopList.vue'),
|
component: () => import('../views/Ranking/KingAndQueen/TopList.vue'),
|
||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
}, //沙特下周一当天早上6点(北京时间3点)刷新
|
}, // 沙特每周一早上0点(北京时间5点)刷新
|
||||||
{
|
{
|
||||||
path: '/weekly-star',
|
path: '/weekly-star',
|
||||||
name: 'weekly-star',
|
name: 'weekly-star',
|
||||||
component: () => import('../views/Ranking/WeeklyStar/WeeklyStar.vue'),
|
component: () => import('../views/Ranking/WeeklyStar/WeeklyStar.vue'),
|
||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
}, //沙特下周一当天早上6点(北京时间3点)刷新
|
}, // 沙特每周一早上0点(北京时间5点)刷新
|
||||||
{
|
{
|
||||||
path: '/ranking',
|
path: '/ranking',
|
||||||
name: 'ranking',
|
name: 'ranking',
|
||||||
|
|||||||
@ -348,7 +348,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-smart-img
|
v-smart-img
|
||||||
:src="imageUrl('helpInfo')"
|
:src="imageUrl(getImgName('helpInfo'))"
|
||||||
alt=""
|
alt=""
|
||||||
style="width: 108vw; position: relative; left: -4vw; display: block"
|
style="width: 108vw; position: relative; left: -4vw; display: block"
|
||||||
/>
|
/>
|
||||||
@ -775,6 +775,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { isInApp, viewUserInfo } from '@/utils/appBridge.js'
|
import { isInApp, viewUserInfo } from '@/utils/appBridge.js'
|
||||||
|
import { useLangStore } from '@/stores/lang'
|
||||||
import { useThrottle } from '@/utils/useDebounce'
|
import { useThrottle } from '@/utils/useDebounce'
|
||||||
import { connectToApp } from '@/utils/appConnector.js'
|
import { connectToApp } from '@/utils/appConnector.js'
|
||||||
import { getPngUrl } from '@/config/imagePaths.js'
|
import { getPngUrl } from '@/config/imagePaths.js'
|
||||||
@ -794,11 +795,21 @@ import borderImg from './components/borderImg.vue'
|
|||||||
import itemCenter from '@/components/itemCenter.vue'
|
import itemCenter from '@/components/itemCenter.vue'
|
||||||
import maskLayer from '@/components/MaskLayer.vue'
|
import maskLayer from '@/components/MaskLayer.vue'
|
||||||
|
|
||||||
|
const langStore = useLangStore()
|
||||||
|
// 当前语言类型
|
||||||
|
const currentLangType = computed(() => {
|
||||||
|
return langStore.selectedLang?.type || 'en'
|
||||||
|
})
|
||||||
|
|
||||||
// 预加载状态
|
// 预加载状态
|
||||||
const isLoading = ref(true)
|
const isLoading = ref(true)
|
||||||
|
|
||||||
// 获取OSS图片URL的函数
|
// 获取OSS图片URL的函数
|
||||||
const imageUrl = (filename) => getPngUrl('Ranking/KingQueen/', filename)
|
const imageUrl = (filename) => getPngUrl('Ranking/KingQueen/', filename)
|
||||||
|
// 根据语言获取图片名
|
||||||
|
const getImgName = (filename) => {
|
||||||
|
return currentLangType.value === 'ar' ? `${filename}_ar` : filename
|
||||||
|
}
|
||||||
|
|
||||||
// 使用工具函数连接APP
|
// 使用工具函数连接APP
|
||||||
const connectToAppHandler = async () => {
|
const connectToAppHandler = async () => {
|
||||||
@ -922,27 +933,47 @@ const Minutes = ref(0)
|
|||||||
const Second = ref(0)
|
const Second = ref(0)
|
||||||
let timer = null
|
let timer = null
|
||||||
|
|
||||||
// 获取沙特下周一早上六点的时间戳
|
// 获取对应的时间戳
|
||||||
const getNextMondayInSaudi = () => {
|
const getNextMondayInBeijing = () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const utcDay = now.getUTCDay() //获取UTC星期几,0(周日)-6(周六)
|
const targetDate = new Date(now.getTime()) // 创建一个基于当前时间的新日期对象
|
||||||
|
|
||||||
// 计算到下周一的所需天数
|
// 转换为北京时间来判断星期几
|
||||||
const daysToAdd = utcDay === 1 ? 7 : (1 + 7 - utcDay) % 7
|
const utcTime = now.getTime() + now.getTimezoneOffset() * 60000
|
||||||
const nextMondayUTC = new Date(now) //以当前UTC时间为基准,而不是重新获取
|
const beijingTime = new Date(utcTime + 8 * 3600000) // UTC+8
|
||||||
|
|
||||||
nextMondayUTC.setUTCDate(now.getUTCDate() + daysToAdd) //增加到下周一那天
|
const beijingDay = beijingTime.getDay() // 0=周日, 1=周一, ..., 6=周六
|
||||||
nextMondayUTC.setUTCHours(3, 0, 0, 0) // 设置为沙特下周一当天早上6点(北京时间3点)
|
const beijingHour = beijingTime.getHours()
|
||||||
return nextMondayUTC.getTime() //得到下周一00:00:00.000的时间戳
|
|
||||||
|
// 转换为 0=周一, 1=周二, ..., 6=周日
|
||||||
|
const normalizedDay = beijingDay === 0 ? 6 : beijingDay - 1
|
||||||
|
|
||||||
|
let daysToAdd
|
||||||
|
if (normalizedDay === 0) {
|
||||||
|
// 今天是周一
|
||||||
|
if (beijingHour >= 5) {
|
||||||
|
daysToAdd = 7 // 超过5点,计算到下周一的所需时间
|
||||||
|
} else {
|
||||||
|
daysToAdd = 0 // 今天
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
daysToAdd = 7 - normalizedDay // 到下周一的天数
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正确地添加天数
|
||||||
|
targetDate.setDate(targetDate.getDate() + daysToAdd) // 添加天数到下周一的当前时间
|
||||||
|
targetDate.setHours(5, 0, 0, 0) // 将时间重新设置为早上5点,作为目标时间戳
|
||||||
|
|
||||||
|
return targetDate.getTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 时间格式化为2位
|
const targetTime = ref(getNextMondayInBeijing()) // 闭包保存目标时间 (核心修正)
|
||||||
|
|
||||||
|
// 格式化时间
|
||||||
const formatTime = (value) => {
|
const formatTime = (value) => {
|
||||||
return value < 10 ? `0${value}` : value
|
return value < 10 ? `0${value}` : value
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetTime = ref(getNextMondayInSaudi()) // 闭包保存目标时间 (核心修正)
|
|
||||||
|
|
||||||
// 更新倒计时
|
// 更新倒计时
|
||||||
const getCountdown = () => {
|
const getCountdown = () => {
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
@ -1097,7 +1128,7 @@ const preloadCriticalImages = async () => {
|
|||||||
imageUrl('queenBt'),
|
imageUrl('queenBt'),
|
||||||
imageUrl('kingBt'),
|
imageUrl('kingBt'),
|
||||||
imageUrl('queenBtActive'),
|
imageUrl('queenBtActive'),
|
||||||
imageUrl('helpInfo'),
|
imageUrl(getImgName('helpInfo')),
|
||||||
imageUrl('timeBack'),
|
imageUrl('timeBack'),
|
||||||
imageUrl('timeNext'),
|
imageUrl('timeNext'),
|
||||||
imageUrl('cancel'),
|
imageUrl('cancel'),
|
||||||
@ -1156,6 +1187,7 @@ onUnmounted(() => {
|
|||||||
background-color: rgba(77, 30, 22, 1);
|
background-color: rgba(77, 30, 22, 1);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
direction: ltr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg {
|
.bg {
|
||||||
|
|||||||
@ -572,7 +572,7 @@
|
|||||||
<maskLayer :maskLayerShow="maskLayerShow" @click="closedPopup">
|
<maskLayer :maskLayerShow="maskLayerShow" @click="closedPopup">
|
||||||
<!-- help弹窗 -->
|
<!-- help弹窗 -->
|
||||||
<div v-show="helpInfoShow" style="margin: 20% 0" @click.stop>
|
<div v-show="helpInfoShow" style="margin: 20% 0" @click.stop>
|
||||||
<img v-smart-img :src="imageUrl('helpInfo')" alt="" style="width: 100%" />
|
<img v-smart-img :src="imageUrl(getImgName('helpInfo'))" alt="" style="width: 100%" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- history弹窗 -->
|
<!-- history弹窗 -->
|
||||||
@ -837,6 +837,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { isInApp, viewUserInfo } from '@/utils/appBridge.js'
|
import { isInApp, viewUserInfo } from '@/utils/appBridge.js'
|
||||||
|
import { useLangStore } from '@/stores/lang'
|
||||||
import { connectToApp } from '@/utils/appConnector.js'
|
import { connectToApp } from '@/utils/appConnector.js'
|
||||||
import { useThrottle } from '@/utils/useDebounce'
|
import { useThrottle } from '@/utils/useDebounce'
|
||||||
import { showWarning } from '@/utils/toast.js'
|
import { showWarning } from '@/utils/toast.js'
|
||||||
@ -861,11 +862,21 @@ import itemCenter from '@/components/itemCenter.vue'
|
|||||||
import maskLayer from '@/components/MaskLayer.vue'
|
import maskLayer from '@/components/MaskLayer.vue'
|
||||||
import TopUser from './components/topUser.vue'
|
import TopUser from './components/topUser.vue'
|
||||||
|
|
||||||
|
const langStore = useLangStore()
|
||||||
|
// 当前语言类型
|
||||||
|
const currentLangType = computed(() => {
|
||||||
|
return langStore.selectedLang?.type || 'en'
|
||||||
|
})
|
||||||
|
|
||||||
// 预加载状态
|
// 预加载状态
|
||||||
const isLoading = ref(true)
|
const isLoading = ref(true)
|
||||||
|
|
||||||
// 获取OSS图片URL的函数
|
// 获取OSS图片URL的函数
|
||||||
const imageUrl = (filename) => getPngUrl('Ranking/WeeklyStar/', filename)
|
const imageUrl = (filename) => getPngUrl('Ranking/WeeklyStar/', filename)
|
||||||
|
// 根据语言获取图片名
|
||||||
|
const getImgName = (filename) => {
|
||||||
|
return currentLangType.value === 'ar' ? `${filename}_ar` : filename
|
||||||
|
}
|
||||||
|
|
||||||
// 使用工具函数连接APP
|
// 使用工具函数连接APP
|
||||||
const connectToAppHandler = async () => {
|
const connectToAppHandler = async () => {
|
||||||
@ -995,21 +1006,41 @@ const handleBt = (type) => {
|
|||||||
exchargeShow.value = type == 'Exchange' ? true : false
|
exchargeShow.value = type == 'Exchange' ? true : false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取沙特下周一早上六点的时间戳
|
// 获取对应的时间戳
|
||||||
const getNextMondayInSaudi = () => {
|
const getNextMondayInBeijing = () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const utcDay = now.getUTCDay() //获取UTC星期几,0(周日)-6(周六)
|
const targetDate = new Date(now.getTime()) // 创建一个基于当前时间的新日期对象
|
||||||
|
|
||||||
// 计算到下周一的所需天数
|
// 转换为北京时间来判断星期几
|
||||||
const daysToAdd = utcDay === 1 ? 7 : (1 + 7 - utcDay) % 7
|
const utcTime = now.getTime() + now.getTimezoneOffset() * 60000
|
||||||
const nextMondayUTC = new Date(now) //以当前UTC时间为基准,而不是重新获取
|
const beijingTime = new Date(utcTime + 8 * 3600000) // UTC+8
|
||||||
|
|
||||||
nextMondayUTC.setUTCDate(now.getUTCDate() + daysToAdd) //增加到下周一那天
|
const beijingDay = beijingTime.getDay() // 0=周日, 1=周一, ..., 6=周六
|
||||||
nextMondayUTC.setUTCHours(3, 0, 0, 0) // 设置为沙特下周一当天早上6点(北京时间3点)
|
const beijingHour = beijingTime.getHours()
|
||||||
return nextMondayUTC.getTime() //得到下周一00:00:00.000的时间戳
|
|
||||||
|
// 转换为 0=周一, 1=周二, ..., 6=周日
|
||||||
|
const normalizedDay = beijingDay === 0 ? 6 : beijingDay - 1
|
||||||
|
|
||||||
|
let daysToAdd
|
||||||
|
if (normalizedDay === 0) {
|
||||||
|
// 今天是周一
|
||||||
|
if (beijingHour >= 5) {
|
||||||
|
daysToAdd = 7 // 超过5点,计算到下周一的所需时间
|
||||||
|
} else {
|
||||||
|
daysToAdd = 0 // 今天
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
daysToAdd = 7 - normalizedDay // 到下周一的天数
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正确地添加天数
|
||||||
|
targetDate.setDate(targetDate.getDate() + daysToAdd) // 添加天数到下周一的当前时间
|
||||||
|
targetDate.setHours(5, 0, 0, 0) // 将时间重新设置为早上5点,作为目标时间戳
|
||||||
|
|
||||||
|
return targetDate.getTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetTime = ref(getNextMondayInSaudi()) // 闭包保存目标时间 (核心修正)
|
const targetTime = ref(getNextMondayInBeijing()) // 闭包保存目标时间 (核心修正)
|
||||||
|
|
||||||
// 格式化时间
|
// 格式化时间
|
||||||
const formatTime = (value) => {
|
const formatTime = (value) => {
|
||||||
@ -1189,7 +1220,7 @@ const preloadCriticalImages = async () => {
|
|||||||
imageUrl('longBg'),
|
imageUrl('longBg'),
|
||||||
imageUrl('debris'),
|
imageUrl('debris'),
|
||||||
imageUrl('myRankingBg'),
|
imageUrl('myRankingBg'),
|
||||||
imageUrl('helpInfo'),
|
imageUrl(getImgName('helpInfo')),
|
||||||
imageUrl('mediumBg'),
|
imageUrl('mediumBg'),
|
||||||
imageUrl('topOneHistory'),
|
imageUrl('topOneHistory'),
|
||||||
imageUrl('nameBg'),
|
imageUrl('nameBg'),
|
||||||
@ -1259,6 +1290,7 @@ onUnmounted(() => {
|
|||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background-color: #311300;
|
background-color: #311300;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
direction: ltr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeText {
|
.timeText {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user