From 39ad523dada3e1481866d4b1350990f60200a074 Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Thu, 11 Dec 2025 13:16:03 +0800 Subject: [PATCH] update pay ui --- .../FlexScreen/hooks/useRealtimeQuote.ts | 31 +++++++++++-------- .../components/FlexScreen/index.tsx | 2 +- src/views/StockOverview/index.js | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/views/StockOverview/components/FlexScreen/hooks/useRealtimeQuote.ts b/src/views/StockOverview/components/FlexScreen/hooks/useRealtimeQuote.ts index 3db861c4..9b4ad3c4 100644 --- a/src/views/StockOverview/components/FlexScreen/hooks/useRealtimeQuote.ts +++ b/src/views/StockOverview/components/FlexScreen/hooks/useRealtimeQuote.ts @@ -152,8 +152,8 @@ const handleSZSEBatchMessage = ( hasUpdate = true; if (isIndexType) { - // 指数数据格式 - const prevClose = quoteData.prev_close ?? 0; + // 指数数据格式(兼容多种字段名) + const prevClose = quoteData.prev_close_px ?? quoteData.prev_close ?? quoteData.prevClose ?? 0; const currentIndex = quoteData.current_index ?? quoteData.last_px ?? 0; updated[fullCode] = { @@ -165,8 +165,8 @@ const handleSZSEBatchMessage = ( high: quoteData.high_index ?? quoteData.high_px ?? 0, low: quoteData.low_index ?? quoteData.low_px ?? 0, close: quoteData.close_index, - volume: quoteData.volume ?? 0, - amount: quoteData.amount ?? 0, + volume: quoteData.total_volume_trade ?? quoteData.volume ?? 0, + amount: quoteData.total_value_trade ?? quoteData.amount ?? 0, numTrades: quoteData.num_trades, change: currentIndex - prevClose, changePct: calcChangePct(currentIndex, prevClose), @@ -283,20 +283,25 @@ const handleSZSERealtimeMessage = ( case 'index': { const indexData = data as SZSEIndexData; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const anyIndexData = indexData as any; + const prevClose = anyIndexData.prev_close_px ?? indexData.prev_close ?? 0; + const currentIndex = anyIndexData.current_index ?? anyIndexData.last_px ?? 0; + updated[fullCode] = { code: fullCode, name: prevQuotes[fullCode]?.name || '', - price: indexData.current_index, - prevClose: indexData.prev_close, - open: indexData.open_index, - high: indexData.high_index, - low: indexData.low_index, + price: currentIndex, + prevClose, + open: indexData.open_index ?? anyIndexData.open_px ?? 0, + high: indexData.high_index ?? anyIndexData.high_px ?? 0, + low: indexData.low_index ?? anyIndexData.low_px ?? 0, close: indexData.close_index, - volume: indexData.volume, - amount: indexData.amount, + volume: anyIndexData.total_volume_trade ?? indexData.volume ?? 0, + amount: anyIndexData.total_value_trade ?? indexData.amount ?? 0, numTrades: indexData.num_trades, - change: indexData.current_index - indexData.prev_close, - changePct: calcChangePct(indexData.current_index, indexData.prev_close), + change: currentIndex - prevClose, + changePct: calcChangePct(currentIndex, prevClose), bidPrices: [], bidVolumes: [], askPrices: [], diff --git a/src/views/StockOverview/components/FlexScreen/index.tsx b/src/views/StockOverview/components/FlexScreen/index.tsx index c73e1e33..8a56f7b7 100644 --- a/src/views/StockOverview/components/FlexScreen/index.tsx +++ b/src/views/StockOverview/components/FlexScreen/index.tsx @@ -128,7 +128,7 @@ const FlexScreen: React.FC = () => { const borderColor = 'rgba(255, 255, 255, 0.08)'; const textColor = 'rgba(255, 255, 255, 0.95)'; const subTextColor = 'rgba(255, 255, 255, 0.6)'; - const searchBg = 'rgba(255, 255, 255, 0.05)'; + const searchBg = 'rgba(255, 255, 255, 0.12)'; // 调亮搜索框背景 const hoverBg = 'rgba(255, 255, 255, 0.08)'; const accentColor = '#8b5cf6'; diff --git a/src/views/StockOverview/index.js b/src/views/StockOverview/index.js index dbd5e67d..4fad168d 100644 --- a/src/views/StockOverview/index.js +++ b/src/views/StockOverview/index.js @@ -108,7 +108,7 @@ const StockOverview = () => { const cardBg = 'rgba(255, 255, 255, 0.03)'; // 玻璃态卡片背景 const borderColor = 'rgba(255, 255, 255, 0.08)'; // 边框 const hoverBg = 'rgba(255, 255, 255, 0.06)'; // 悬停背景 - const searchBg = 'rgba(255, 255, 255, 0.05)'; // 搜索框背景 + const searchBg = 'rgba(255, 255, 255, 0.15)'; // 搜索框背景(调亮) const textColor = 'rgba(255, 255, 255, 0.95)'; // 主文字 const subTextColor = 'rgba(255, 255, 255, 0.6)'; // 次要文字 const goldColor = '#8b5cf6'; // 使用紫色作为强调色