From c4b183e3d16e7523ea43e1b28a800e5b0aa3de50 Mon Sep 17 00:00:00 2001 From: zhaowenkang Date: Thu, 30 Oct 2025 20:27:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=B8=82=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/marketSituation/marketOverview.vue | 42 +++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/pages/marketSituation/marketOverview.vue b/pages/marketSituation/marketOverview.vue index 6dcd1cf..ba74e11 100644 --- a/pages/marketSituation/marketOverview.vue +++ b/pages/marketSituation/marketOverview.vue @@ -6,10 +6,10 @@ - 道琼斯{{ judgeSymbol(INDU.value) }} - 纳斯达克{{ judgeSymbol(NDX.value) }} - 恒生指数{{ judgeSymbol(HSI.value) }} - 上证指数{{ judgeSymbol(CN.value) }} + 道琼斯{{ judgeSymbol(INDU.value) }} + 纳斯达克{{ judgeSymbol(NDX.value) }} + 恒生指数{{ judgeSymbol(HSI.value) }} + 上证指数{{ judgeSymbol(CN.value) }} @@ -90,6 +90,16 @@ const judgeSymbol = (num) => { return num[0] === "-" ? num : "+" + num; }; +function getSignClass(value) { + const s = typeof value === 'string' ? value : String(value ?? ''); + const trimmed = s.trim(); + if (trimmed.startsWith('-')) return 'index-down'; + if (trimmed.startsWith('+')) return 'index-up'; + const n = parseFloat(trimmed); + if (!isNaN(n)) return n >= 0 ? 'index-up' : 'index-down'; + return ''; +} + // 搜索输入事件 const onSearchInput = (e) => { searchValue.value = e.detail.value; @@ -785,6 +795,9 @@ watch(headerHeight, (newHeight) => { border-radius: 10rpx; background-color: #ffffff; z-index: 10; + display: flex; + align-items: center; + justify-content: center; } .INDU { position: absolute; @@ -797,11 +810,14 @@ watch(headerHeight, (newHeight) => { border-radius: 10rpx; background-color: #ffffff; z-index: 10; + display: flex; + align-items: center; + justify-content: center; } .HSI { position: absolute; top: 30%; - right: 13%; + right: 4%; transform: translate(-50%, -50%); font-size: 11rpx; color: #000000; @@ -809,11 +825,14 @@ watch(headerHeight, (newHeight) => { border-radius: 10rpx; background-color: #ffffff; z-index: 10; + display: flex; + align-items: center; + justify-content: center; } .CN { position: absolute; top: 23%; - right: 16%; + right: 8%; transform: translate(-50%, -50%); font-size: 11rpx; color: #000000; @@ -821,6 +840,9 @@ watch(headerHeight, (newHeight) => { border-radius: 10rpx; background-color: #ffffff; z-index: 10; + display: flex; + align-items: center; + justify-content: center; } .map image { @@ -1081,4 +1103,12 @@ watch(headerHeight, (newHeight) => { overflow: hidden; background-color: white; } + +.index-up { + color: #2fc25b !important; +} + +.index-down { + color: #f04864 !important; +}