From 72816c186caae14d5ba399b7b60838fabc2b52c4 Mon Sep 17 00:00:00 2001 From: hzj <1304805162@qq.com> Date: Mon, 22 Sep 2025 17:04:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=BB=98=E8=AE=A4=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0):=20=E6=96=B0=E5=A2=9E=E5=87=BA=E9=94=99?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=BB=98=E8=AE=A4=E5=9B=BE=E7=89=87=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E8=B0=83=E6=95=B4=E5=A5=96=E5=8A=B1=E7=9A=84?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/TopList/TopList.vue | 30 +++++++++++++++++++++++++++-- src/views/WeeklyStar/WeeklyStar.vue | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/views/TopList/TopList.vue b/src/views/TopList/TopList.vue index 6daa851..a432efe 100644 --- a/src/views/TopList/TopList.vue +++ b/src/views/TopList/TopList.vue @@ -508,6 +508,7 @@ display: grid; grid-template-columns: repeat(3, 1fr); gap: 3%; + margin-bottom: 3%; " >
- +
@@ -540,7 +547,7 @@ text-align: center; " > - {{ reward.name }} + {{ showDetail(reward.type, reward) }} @@ -805,6 +812,25 @@ const getCountdown = () => { Second.value = formatTime(Math.floor(totalSeconds % 60)) //取一分钟内余留秒数,并取整 } +// 格式化奖励的展示信息 +const showDetail = (type, reward) => { + let showamount = ['GOLD', 'DIAMOND', 'GIFT', 'FRAGMENTS'] + if (showamount.includes(type)) { + return reward.content + } else { + return `${reward.quantity}Days` + } +} + +// 奖励图片资源出错处理 +const handleImageError = (e, type) => { + console.log('图片资源出错') + e.target.onerror = null //防止循环 + if ((type = 'GOLD')) { + e.target.src = new URL('/src/assets/icon/coin.png', import.meta.url).href + } +} + // 获取俩榜单 const getTopList = async (params) => { const resWeekTopList = await getWeekTopList(params) diff --git a/src/views/WeeklyStar/WeeklyStar.vue b/src/views/WeeklyStar/WeeklyStar.vue index 760027d..f40f6c4 100644 --- a/src/views/WeeklyStar/WeeklyStar.vue +++ b/src/views/WeeklyStar/WeeklyStar.vue @@ -842,7 +842,7 @@ const showRanking = computed(() => { return Ranking.value.filter((_, index) => index >= 3) }) -// 图片资源出错处理 +// 奖励图片资源出错处理 const handleImageError = (e, type) => { console.log('图片资源出错') e.target.onerror = null //防止循环