From b2160347db83f7bbd137c509b1b89583532e9e1e Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Fri, 9 Jan 2026 10:10:47 +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 | 6 +- .../Community/components/EventDailyStats.js | 143 ++++++++++++------ src/views/Community/components/HeroPanel.js | 10 +- 3 files changed, 102 insertions(+), 57 deletions(-) diff --git a/app.py b/app.py index 120f55ff..b0fe6f2b 100755 --- a/app.py +++ b/app.py @@ -11418,10 +11418,10 @@ def get_events_effectiveness_stats(): 'topEvents': top_events }) - # 找出表现最好的事件(全局) + # 找出表现最好的事件(全局,按平均超额排序) top_performers = sorted( - [e for e in events_query if e.related_max_chg is not None], - key=lambda x: x.related_max_chg, + [e for e in events_query if e.related_avg_chg is not None], + key=lambda x: x.related_avg_chg, reverse=True )[:10] diff --git a/src/views/Community/components/EventDailyStats.js b/src/views/Community/components/EventDailyStats.js index ee0bf845..67382b27 100644 --- a/src/views/Community/components/EventDailyStats.js +++ b/src/views/Community/components/EventDailyStats.js @@ -27,6 +27,7 @@ import { TrophyOutlined, StockOutlined, CalendarOutlined, + ReloadOutlined, } from '@ant-design/icons'; import { getApiBase } from '@utils/apiConfig'; @@ -346,8 +347,8 @@ const TopEventItem = ({ event, rank }) => { {event.title} - - {formatChg(event.maxChg)} + + {formatChg(event.avgChg)} ); @@ -392,13 +393,18 @@ const TopStockItem = ({ stock, rank }) => { const EventDailyStats = () => { const [loading, setLoading] = useState(true); + const [refreshing, setRefreshing] = useState(false); const [stats, setStats] = useState(null); const [error, setError] = useState(null); const [activeTab, setActiveTab] = useState(0); const [selectedDate, setSelectedDate] = useState(''); - const fetchStats = useCallback(async (dateStr = '') => { - setLoading(true); + const fetchStats = useCallback(async (dateStr = '', isRefresh = false) => { + if (isRefresh) { + setRefreshing(true); + } else { + setLoading(true); + } setError(null); try { const apiBase = getApiBase(); @@ -416,6 +422,7 @@ const EventDailyStats = () => { setError(err.message); } finally { setLoading(false); + setRefreshing(false); } }, []); @@ -423,10 +430,10 @@ const EventDailyStats = () => { fetchStats(selectedDate); }, [fetchStats, selectedDate]); - // 自动刷新(仅当选择今天时) + // 自动刷新(仅当选择今天时,每60秒刷新一次) useEffect(() => { if (!selectedDate) { - const interval = setInterval(() => fetchStats(''), 5 * 60 * 1000); + const interval = setInterval(() => fetchStats('', true), 60 * 1000); return () => clearInterval(interval); } }, [selectedDate, fetchStats]); @@ -435,6 +442,13 @@ const EventDailyStats = () => { setSelectedDate(e.target.value); }; + // 手动刷新 + const handleRefresh = () => { + if (!refreshing) { + fetchStats(selectedDate, true); + } + }; + const isToday = !selectedDate; if (loading) { @@ -549,6 +563,27 @@ const EventDailyStats = () => { )} + {/* 刷新按钮 */} + + + + + {/* 今天按钮 - 仅在查看历史时显示 */} {!isToday && ( { - {/* 内容区域 - 使用 flex: 1 填充剩余空间 */} - - {/* 胜率对比仪表盘 */} - + {/* 内容区域 - 固定高度滚动 */} + + + {/* 胜率对比仪表盘 */} + - {/* 核心指标 - 2x2 网格 */} - - } - color="#FFD700" - subText="追踪中" - /> - } - color="#1890FF" - subText="去重" - /> - } - color={getChgColor(summary?.avgChg)} - /> - } - color="#FF4D4F" - /> - + {/* 核心指标 - 2x2 网格 */} + + } + color="#F59E0B" + /> + } + color="#06B6D4" + /> + } + color={summary?.avgChg >= 0 ? '#F31260' : '#17C964'} + /> + } + color="#F31260" + /> + - {/* 分割线 */} - + {/* 分割线 */} + - {/* TOP 表现 - Tab 切换,flex: 1 填充剩余空间 */} - + {/* TOP 表现 - Tab 切换 */} + { - - + + + ); }; diff --git a/src/views/Community/components/HeroPanel.js b/src/views/Community/components/HeroPanel.js index c692a81c..a8cbfc03 100644 --- a/src/views/Community/components/HeroPanel.js +++ b/src/views/Community/components/HeroPanel.js @@ -2617,8 +2617,8 @@ const RightPanelTabs = () => { - {/* Tab 内容区域 - 固定高度确保一致 */} - + {/* Tab 内容区域 */} + {activeTab === 'comet' ? ( @@ -2808,14 +2808,14 @@ const HeroPanel = () => { {/* AI舆情时空决策驾驶舱 - 左侧今日统计(2/5),右侧Tab切换(3/5) */} - + {/* 左侧:今日事件统计 */} - + {/* 右侧:连板情绪 / 日历 Tab 切换 */} - +