From 4bb37c6e6d42c6a8c419e926e577f0f9ed026972 Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Thu, 13 Nov 2025 17:18:33 +0800 Subject: [PATCH] update ui --- src/views/Community/components/HeroPanel.js | 230 ++++++++++++++---- .../Community/components/HotEventsSection.js | 30 ++- 2 files changed, 204 insertions(+), 56 deletions(-) diff --git a/src/views/Community/components/HeroPanel.js b/src/views/Community/components/HeroPanel.js index eef36b8f..d94f2b2d 100644 --- a/src/views/Community/components/HeroPanel.js +++ b/src/views/Community/components/HeroPanel.js @@ -2,6 +2,28 @@ // 顶部说明面板组件:产品功能介绍 + 沪深指数折线图 + 热门概念词云图 import React, { useEffect, useState, useMemo, useCallback } from 'react'; + +// 定义 pulse 动画 +const pulseAnimation = ` + @keyframes pulse { + 0%, 100% { + opacity: 1; + transform: scale(1); + } + 50% { + opacity: 0.6; + transform: scale(1.1); + } + } +`; + +// 注入样式到页面 +if (typeof document !== 'undefined') { + const styleSheet = document.createElement('style'); + styleSheet.type = 'text/css'; + styleSheet.innerText = pulseAnimation; + document.head.appendChild(styleSheet); +} import { Box, Card, @@ -103,8 +125,9 @@ const MiniIndexChart = ({ indexCode, indexName }) => { const [currentDate, setCurrentDate] = useState(''); const chartBg = useColorModeValue('transparent', 'transparent'); - const upColor = '#00da3c'; - const downColor = '#ec0000'; + // 中国市场惯例:涨红跌绿 + const upColor = '#ec0000'; // 上涨:红色 + const downColor = '#00da3c'; // 下跌:绿色 // 加载日线数据 const loadDailyData = useCallback(async () => { @@ -260,21 +283,21 @@ const MiniIndexChart = ({ indexCode, indexName }) => { const changePct = prevClose ? ((change / prevClose) * 100).toFixed(2) : '0.00'; const isUp = close >= prevClose; - // Bloomberg 风格格式化 - const changeColor = isUp ? '#00da3c' : '#ec0000'; + // Bloomberg 风格格式化(涨红跌绿) + const changeColor = isUp ? '#ec0000' : '#00da3c'; const changeSign = isUp ? '+' : ''; return ` -
- ${rawDataItem.time} +
+ 📅 ${rawDataItem.time}
-
- 开盘${open.toFixed(2)} - 最高${high.toFixed(2)} - 最低${low.toFixed(2)} - 收盘${close.toFixed(2)} - 涨跌${changeSign}${change.toFixed(2)} - 涨跌幅${changeSign}${changePct}% +
+ 开盘${open.toFixed(2)} + 最高${high.toFixed(2)} + 最低${low.toFixed(2)} + 收盘${close.toFixed(2)} + 涨跌${changeSign}${change.toFixed(2)} + 涨跌幅${changeSign}${changePct}%
`; } @@ -315,30 +338,46 @@ const MiniIndexChart = ({ indexCode, indexName }) => { - {indexName} - + {indexName} + {latestData?.close.toFixed(2)} - {currentDate} + 📅 {currentDate} - + - {latestData?.isPositive ? '↑' : '↓'} {latestData?.isPositive ? '+' : ''}{latestData?.change}% + {latestData?.isPositive ? '↗' : '↘'} {latestData?.isPositive ? '+' : ''}{latestData?.change}% {isInTradingTime() && ( - - ● 实时更新 - + + + + 实时更新 + + )} - + { const changePct = params.data.change_pct; const sign = changePct > 0 ? '+' : ''; const color = changePct > 0 ? '#ec0000' : '#00da3c'; + const icon = changePct > 0 ? '📈' : '📉'; return ` -
${params.name}
-
涨跌幅: ${sign}${changePct.toFixed(2)}%
+
+ ${icon} ${params.name} +
+
+ 涨跌幅: ${sign}${changePct.toFixed(2)}% +
`; } }, @@ -432,23 +476,30 @@ const ConceptWordCloud = () => { color: function (params) { // 根据涨跌幅设置颜色(中国市场惯例:涨红跌绿) const changePct = params.data.change_pct; + if (changePct > 7) return '#ff0000'; // 超大涨:纯红 if (changePct > 5) return '#ff1744'; // 大涨:亮红色 if (changePct > 3) return '#ff4d4f'; // 中涨:红色 if (changePct > 1) return '#ff7875'; // 小涨:浅红 if (changePct > 0) return '#ffa940'; // 微涨:橙色 if (changePct === 0) return '#FFD700'; // 平盘:金色 - if (changePct > -1) return '#95de64'; // 微跌:浅绿 + if (changePct > -1) return '#73d13d'; // 微跌:浅绿 if (changePct > -3) return '#52c41a'; // 小跌:绿色 if (changePct > -5) return '#00c853'; // 中跌:深绿 - return '#00796b'; // 大跌:墨绿 - } + if (changePct > -7) return '#00a152'; // 大跌:更深绿 + return '#00796b'; // 超大跌:墨绿 + }, + shadowBlur: 3, + shadowColor: 'rgba(0, 0, 0, 0.5)', + shadowOffsetX: 1, + shadowOffsetY: 1 }, emphasis: { focus: 'self', textStyle: { - shadowBlur: 12, + shadowBlur: 20, shadowColor: '#FFD700', - fontSize: 24 + fontSize: 28, + fontWeight: 'bolder' } }, data: concepts @@ -525,21 +576,49 @@ const HeroPanel = () => { bg={gradientBg} borderColor={borderColor} borderWidth={cardBorder} - boxShadow="0 8px 32px rgba(0, 0, 0, 0.4)" + boxShadow="0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 215, 0, 0.1) inset" mb={6} overflow="hidden" position="relative" + transition="all 0.3s ease" + _hover={{ + boxShadow: "0 16px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 215, 0, 0.2) inset", + transform: "translateY(-2px)" + }} > - {/* 装饰性背景图案 */} + {/* 装饰性背景图案 - 多层叠加 */} + + @@ -586,7 +665,7 @@ const HeroPanel = () => {
- {/* 中间:沪深指数折线图 */} + {/* 中间:沪深指数K线图 */} { borderWidth="1px" borderColor="whiteAlpha.200" backdropFilter="blur(10px)" + boxShadow="0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05)" + transition="all 0.3s ease" + _hover={{ + bg: "whiteAlpha.150", + borderColor: "whiteAlpha.300", + boxShadow: "0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1)", + transform: "translateY(-1px)" + }} > @@ -608,6 +695,14 @@ const HeroPanel = () => { borderWidth="1px" borderColor="whiteAlpha.200" backdropFilter="blur(10px)" + boxShadow="0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05)" + transition="all 0.3s ease" + _hover={{ + bg: "whiteAlpha.150", + borderColor: "whiteAlpha.300", + boxShadow: "0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1)", + transform: "translateY(-1px)" + }} > @@ -617,13 +712,37 @@ const HeroPanel = () => { {/* 右侧:热门概念词云图 */} - - - 🔥 热门概念 - - - 实时更新 - + + + + 🔥 热门概念 + + + + + + 实时更新 + + { borderWidth="1px" borderColor="whiteAlpha.200" backdropFilter="blur(10px)" + boxShadow="0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05)" p={3} + position="relative" + overflow="hidden" + transition="all 0.3s ease" + _hover={{ + bg: "whiteAlpha.150", + borderColor: "whiteAlpha.300", + boxShadow: "0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1)" + }} > - - 字体大小表示热度 · 颜色表示涨跌幅 - + + 💡 字体大小表示热度 + + 🎨 颜色表示涨跌幅 + diff --git a/src/views/Community/components/HotEventsSection.js b/src/views/Community/components/HotEventsSection.js index f93851e4..9bb09565 100644 --- a/src/views/Community/components/HotEventsSection.js +++ b/src/views/Community/components/HotEventsSection.js @@ -35,16 +35,34 @@ const HotEventsSection = ({ events, onEventClick }) => { } return ( - - + + - 🔥 热点事件 -

展示最近5天内涨幅最高的事件,助您把握市场热点

+ + 🔥 热点事件 + +

+ 展示最近5天内涨幅最高的事件,助您把握市场热点 +

{/* 页码指示器 */} {totalPages > 1 && ( { )}
- +