From 08842b909714fad789e8c5352cf3c87a7f7bb92c Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Fri, 19 Dec 2025 16:51:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=92=8C=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MarketDataView: - 移除重复的 LoadingState,改用 KLineModule 内部骨架屏 - 修复点击股票行情后数据不显示的问题 FinancialPanorama: - 移除表格右上角"显示 6 期"标签 - 优化 loadingTab 状态处理 SubTabContainer: - 重构布局:Tab 区域可滚动,右侧元素固定 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/components/SubTabContainer/index.tsx | 176 ++++++++++-------- .../components/UnifiedFinancialTable.tsx | 6 - .../FinancialPanorama/tabs/UnifiedTabs.tsx | 12 +- .../panels/TradeDataPanel/KLineModule.tsx | 17 +- .../components/MarketDataView/index.tsx | 56 +++--- .../components/MarketDataView/types.ts | 1 + 6 files changed, 140 insertions(+), 128 deletions(-) diff --git a/src/components/SubTabContainer/index.tsx b/src/components/SubTabContainer/index.tsx index e077358d..a946d439 100644 --- a/src/components/SubTabContainer/index.tsx +++ b/src/components/SubTabContainer/index.tsx @@ -22,6 +22,7 @@ import React, { useState, useCallback, memo, Suspense } from 'react'; import { Box, + Flex, Tabs, TabList, TabPanels, @@ -30,7 +31,6 @@ import { Icon, HStack, Text, - Spacer, Center, Spinner, } from '@chakra-ui/react'; @@ -202,8 +202,8 @@ const SubTabContainer: React.FC = memo(({ index={currentIndex} onChange={handleTabChange} > - {/* TabList - 玻璃态导航栏 */} - = memo(({ borderRadius={compact ? 0 : DEEP_SPACE.radiusLG} mx={compact ? 0 : 2} mb={compact ? 0 : 2} - px={3} - py={compact ? 2 : 3} - flexWrap="nowrap" - gap={2} - alignItems="center" - overflowX="auto" position="relative" boxShadow={compact ? 'none' : DEEP_SPACE.innerGlow} - css={{ - '&::-webkit-scrollbar': { display: 'none' }, - scrollbarWidth: 'none', - }} + alignItems="center" > {/* 顶部金色光条 */} = memo(({ background={`linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.4), transparent)`} /> - {tabs.map((tab, idx) => { - const isSelected = idx === currentIndex; + {/* 左侧:可滚动的 Tab 区域 */} + + + {tabs.map((tab, idx) => { + const isSelected = idx === currentIndex; - return ( - - - {tab.icon && ( - - )} - {tab.name} - - - ); - })} + return ( + + + {tab.icon && ( + + )} + {tab.name} + + + ); + })} + + + + {/* 右侧:固定的自定义元素(如期数选择器) */} {rightElement && ( - <> - - {rightElement} - + + {rightElement} + )} - + {tabs.map((tab, idx) => { diff --git a/src/views/Company/components/FinancialPanorama/components/UnifiedFinancialTable.tsx b/src/views/Company/components/FinancialPanorama/components/UnifiedFinancialTable.tsx index 61869c73..f039900d 100644 --- a/src/views/Company/components/FinancialPanorama/components/UnifiedFinancialTable.tsx +++ b/src/views/Company/components/FinancialPanorama/components/UnifiedFinancialTable.tsx @@ -345,12 +345,6 @@ const UnifiedFinancialTableInner: React.FC = ({ return ( - {/* 右上角显示期数标签 */} - - - 显示 {displayData.length} 期 - - (({ balanceSheet, loading, showMetricChart }) => ( +export const BalanceSheetTab = memo(({ balanceSheet, loading, loadingTab, showMetricChart }) => ( )); BalanceSheetTab.displayName = 'BalanceSheetTab'; /** 利润表 Tab */ -export const IncomeStatementTab = memo(({ incomeStatement, loading, showMetricChart }) => ( +export const IncomeStatementTab = memo(({ incomeStatement, loading, loadingTab, showMetricChart }) => ( )); IncomeStatementTab.displayName = 'IncomeStatementTab'; @@ -251,14 +251,14 @@ const CASHFLOW_SECTIONS = [{ }]; /** 现金流量表 Tab */ -export const CashflowTab = memo(({ cashflow, loading, showMetricChart }) => ( +export const CashflowTab = memo(({ cashflow, loading, loadingTab, showMetricChart }) => ( )); CashflowTab.displayName = 'CashflowTab'; diff --git a/src/views/Company/components/MarketDataView/components/panels/TradeDataPanel/KLineModule.tsx b/src/views/Company/components/MarketDataView/components/panels/TradeDataPanel/KLineModule.tsx index 12e18409..7ee7b9d0 100644 --- a/src/views/Company/components/MarketDataView/components/panels/TradeDataPanel/KLineModule.tsx +++ b/src/views/Company/components/MarketDataView/components/panels/TradeDataPanel/KLineModule.tsx @@ -2,7 +2,7 @@ // K线模块 - 日K线/分时图切换展示(黑金主题 + 专业技术指标 + 商品数据叠加 + 分时盘口) import React, { useState, useMemo, useCallback, memo } from 'react'; -import { Box } from '@chakra-ui/react'; +import { Box, HStack, Skeleton, Card, CardBody } from '@chakra-ui/react'; import { darkGoldTheme } from '../../../constants'; import type { IndicatorType, MainIndicatorType, DrawingType } from '../../../utils/chartOptions'; @@ -30,6 +30,7 @@ const KLineModule: React.FC = ({ selectedPeriod, onPeriodChange, stockCode, + loading = false, }) => { // ========== 状态管理 ========== const [mode, setMode] = useState('daily'); @@ -127,7 +128,19 @@ const KLineModule: React.FC = ({ {/* 图表内容区域 */} - {mode === 'daily' ? ( + {/* 加载中骨架屏 */} + {loading && tradeData.length === 0 ? ( + + + + + + ) : mode === 'daily' ? ( // 日K线图 = ({ stockCode: propStockCod minuteData, minuteLoading, analysisMap, - refetch, loadMinuteData, loadDataByType, } = useMarketData(stockCode, selectedPeriod); @@ -133,41 +131,29 @@ const MarketDataView: React.FC = ({ stockCode: propStockCod {summary && } {/* 交易数据 - 日K/分钟K线(独立显示在 Tab 上方) */} - {!loading && ( - - )} + {/* 主要内容区域 - Tab */} - {loading ? ( - - - - ) : ( - - )} + diff --git a/src/views/Company/components/MarketDataView/types.ts b/src/views/Company/components/MarketDataView/types.ts index c9fabdfb..84f1320f 100644 --- a/src/views/Company/components/MarketDataView/types.ts +++ b/src/views/Company/components/MarketDataView/types.ts @@ -300,6 +300,7 @@ export interface KLineModuleProps { selectedPeriod?: number; onPeriodChange?: (period: number) => void; stockCode?: string; // 股票代码,用于获取实时盘口数据 + loading?: boolean; // 日K线数据加载中 } /**