From eb61f6bc658664821088ac675cb3cff70d513153 Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Fri, 9 Jan 2026 07:40:21 +0800 Subject: [PATCH] =?UTF-8?q?heropanel=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 13 ++- .../Community/components/EventDailyStats.js | 92 ++++++++----------- 2 files changed, 47 insertions(+), 58 deletions(-) diff --git a/app.py b/app.py index 7a2acad4..3d1ef615 100755 --- a/app.py +++ b/app.py @@ -11306,7 +11306,10 @@ def get_events_effectiveness_stats(): if prev_trading_day: prev_date_str = prev_trading_day.strftime('%Y%m%d') - # 查询所有 A 股的最新价格(排除指数和北交所) + # 查询所有 A 股的最新价格(排除指数) + # 上证股票: 60xxxx.SH (主板), 68xxxx.SH (科创板) + # 深证股票: 00xxxx.SZ (主板), 30xxxx.SZ (创业板) + # 排除: 399xxx.SZ (深证指数), 000xxx.SH (上证指数) market_price_query = """ SELECT code, @@ -11314,9 +11317,11 @@ def get_events_effectiveness_stats(): FROM stock_minute WHERE timestamp >= %(start)s AND timestamp <= %(end)s - AND (code LIKE '%%.SH' OR code LIKE '%%.SZ') - AND code NOT LIKE '399%%' - AND code NOT LIKE '000%%' + AND ( + (code LIKE '6%%.SH') -- 上证主板和科创板 + OR (code LIKE '0%%.SZ' AND code NOT LIKE '399%%') -- 深证主板(排除指数) + OR (code LIKE '3%%.SZ' AND code NOT LIKE '399%%') -- 创业板(排除指数) + ) GROUP BY code """ market_data = client.execute(market_price_query, { diff --git a/src/views/Community/components/EventDailyStats.js b/src/views/Community/components/EventDailyStats.js index 2207e5fe..740c6b7a 100644 --- a/src/views/Community/components/EventDailyStats.js +++ b/src/views/Community/components/EventDailyStats.js @@ -69,8 +69,8 @@ const getRateColor = (rate) => { }; /** - * 半圆仪表盘组件 - 参考用户提供的设计 - * 使用渐变色:左侧绿色 -> 中间黄色 -> 右侧红色 + * 半圆仪表盘组件 - 使用 SVG 实现渐变弧线 + * 渐变色:左侧绿色 -> 中间黄色 -> 右侧红色 */ const SemiCircleGauge = ({ rate, label, size = 'normal' }) => { const validRate = Math.min(100, Math.max(0, rate || 0)); @@ -79,57 +79,43 @@ const SemiCircleGauge = ({ rate, label, size = 'normal' }) => { const gaugeColor = getRateColor(validRate); const isSmall = size === 'small'; - const gaugeWidth = isSmall ? 80 : 100; - const gaugeHeight = gaugeWidth / 2; - const needleLength = isSmall ? 30 : 38; + const svgSize = isSmall ? 80 : 100; + const strokeWidth = isSmall ? 6 : 8; + const radius = (svgSize - strokeWidth) / 2; + const needleLength = isSmall ? 28 : 35; + const gradientId = `gauge-gradient-${label.replace(/\s/g, '-')}`; + + // 计算半圆弧的路径(从左到右) + const arcPath = `M ${strokeWidth / 2} ${svgSize / 2} A ${radius} ${radius} 0 0 1 ${svgSize - strokeWidth / 2} ${svgSize / 2}`; return ( - - {/* 半圆背景(渐变色弧线) */} - - - {/* 内部遮罩(让弧线更细) */} - + + {/* SVG 半圆弧 */} + + + + + + + + + + {/* 指针 */} { {/* 指针中心点 */} { {/* 刻度标记 */} 0 100