fix: 优化加载状态和布局
MarketDataView: - 移除重复的 LoadingState,改用 KLineModule 内部骨架屏 - 修复点击股票行情后数据不显示的问题 FinancialPanorama: - 移除表格右上角"显示 6 期"标签 - 优化 loadingTab 状态处理 SubTabContainer: - 重构布局:Tab 区域可滚动,右侧元素固定 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -345,12 +345,6 @@ const UnifiedFinancialTableInner: React.FC<UnifiedFinancialTableProps> = ({
|
||||
return (
|
||||
<Box className={TABLE_CLASS_NAME}>
|
||||
<style>{extendedTableStyles}</style>
|
||||
{/* 右上角显示期数标签 */}
|
||||
<HStack justify="flex-end" mb={1}>
|
||||
<Text fontSize="2xs" color="gray.500">
|
||||
显示 {displayData.length} 期
|
||||
</Text>
|
||||
</HStack>
|
||||
<ConfigProvider theme={BLACK_GOLD_TABLE_THEME}>
|
||||
<Table
|
||||
columns={columns}
|
||||
|
||||
@@ -216,26 +216,26 @@ const BALANCE_SHEET_SECTIONS = [
|
||||
];
|
||||
|
||||
/** 资产负债表 Tab */
|
||||
export const BalanceSheetTab = memo<BalanceSheetTabProps>(({ balanceSheet, loading, showMetricChart }) => (
|
||||
export const BalanceSheetTab = memo<BalanceSheetTabProps>(({ balanceSheet, loading, loadingTab, showMetricChart }) => (
|
||||
<UnifiedFinancialTable
|
||||
type="statement"
|
||||
data={balanceSheet as unknown as FinancialDataItem[]}
|
||||
sections={BALANCE_SHEET_SECTIONS}
|
||||
showMetricChart={showMetricChart}
|
||||
loading={loading}
|
||||
loading={loading || loadingTab === 'balance'}
|
||||
/>
|
||||
));
|
||||
BalanceSheetTab.displayName = 'BalanceSheetTab';
|
||||
|
||||
/** 利润表 Tab */
|
||||
export const IncomeStatementTab = memo<IncomeStatementTabProps>(({ incomeStatement, loading, showMetricChart }) => (
|
||||
export const IncomeStatementTab = memo<IncomeStatementTabProps>(({ incomeStatement, loading, loadingTab, showMetricChart }) => (
|
||||
<UnifiedFinancialTable
|
||||
type="statement"
|
||||
data={incomeStatement as unknown as FinancialDataItem[]}
|
||||
sections={INCOME_STATEMENT_SECTIONS}
|
||||
hideTotalSectionTitle={false}
|
||||
showMetricChart={showMetricChart}
|
||||
loading={loading}
|
||||
loading={loading || loadingTab === 'income'}
|
||||
/>
|
||||
));
|
||||
IncomeStatementTab.displayName = 'IncomeStatementTab';
|
||||
@@ -251,14 +251,14 @@ const CASHFLOW_SECTIONS = [{
|
||||
}];
|
||||
|
||||
/** 现金流量表 Tab */
|
||||
export const CashflowTab = memo<CashflowTabProps>(({ cashflow, loading, showMetricChart }) => (
|
||||
export const CashflowTab = memo<CashflowTabProps>(({ cashflow, loading, loadingTab, showMetricChart }) => (
|
||||
<UnifiedFinancialTable
|
||||
type="statement"
|
||||
data={cashflow as unknown as FinancialDataItem[]}
|
||||
sections={CASHFLOW_SECTIONS}
|
||||
hideTotalSectionTitle
|
||||
showMetricChart={showMetricChart}
|
||||
loading={loading}
|
||||
loading={loading || loadingTab === 'cashflow'}
|
||||
/>
|
||||
));
|
||||
CashflowTab.displayName = 'CashflowTab';
|
||||
|
||||
@@ -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<KLineModuleProps> = ({
|
||||
selectedPeriod,
|
||||
onPeriodChange,
|
||||
stockCode,
|
||||
loading = false,
|
||||
}) => {
|
||||
// ========== 状态管理 ==========
|
||||
const [mode, setMode] = useState<ChartMode>('daily');
|
||||
@@ -127,7 +128,19 @@ const KLineModule: React.FC<KLineModuleProps> = ({
|
||||
|
||||
{/* 图表内容区域 */}
|
||||
<Box pt={4}>
|
||||
{mode === 'daily' ? (
|
||||
{/* 加载中骨架屏 */}
|
||||
{loading && tradeData.length === 0 ? (
|
||||
<Card bg="gray.900" border="1px solid" borderColor="rgba(212, 175, 55, 0.3)">
|
||||
<CardBody p={4}>
|
||||
<Skeleton
|
||||
height="600px"
|
||||
borderRadius="md"
|
||||
startColor="rgba(26, 32, 44, 0.6)"
|
||||
endColor="rgba(212, 175, 55, 0.2)"
|
||||
/>
|
||||
</CardBody>
|
||||
</Card>
|
||||
) : mode === 'daily' ? (
|
||||
// 日K线图
|
||||
<DailyKLineChart
|
||||
tradeData={tradeData}
|
||||
|
||||
@@ -30,7 +30,6 @@ import {
|
||||
UnusualPanel,
|
||||
PledgePanel,
|
||||
} from './components/panels';
|
||||
import LoadingState from '../LoadingState';
|
||||
import type { MarketDataViewProps } from './types';
|
||||
|
||||
/**
|
||||
@@ -61,7 +60,6 @@ const MarketDataView: React.FC<MarketDataViewProps> = ({ stockCode: propStockCod
|
||||
minuteData,
|
||||
minuteLoading,
|
||||
analysisMap,
|
||||
refetch,
|
||||
loadMinuteData,
|
||||
loadDataByType,
|
||||
} = useMarketData(stockCode, selectedPeriod);
|
||||
@@ -133,41 +131,29 @@ const MarketDataView: React.FC<MarketDataViewProps> = ({ stockCode: propStockCod
|
||||
{summary && <StockSummaryCard summary={summary} theme={theme} />}
|
||||
|
||||
{/* 交易数据 - 日K/分钟K线(独立显示在 Tab 上方) */}
|
||||
{!loading && (
|
||||
<TradeDataPanel
|
||||
theme={theme}
|
||||
tradeData={tradeData}
|
||||
minuteData={minuteData}
|
||||
minuteLoading={minuteLoading}
|
||||
analysisMap={analysisMap}
|
||||
onLoadMinuteData={loadMinuteData}
|
||||
onChartClick={handleChartClick}
|
||||
selectedPeriod={selectedPeriod}
|
||||
onPeriodChange={setSelectedPeriod}
|
||||
stockCode={stockCode}
|
||||
/>
|
||||
)}
|
||||
<TradeDataPanel
|
||||
theme={theme}
|
||||
tradeData={tradeData}
|
||||
minuteData={minuteData}
|
||||
minuteLoading={minuteLoading}
|
||||
analysisMap={analysisMap}
|
||||
onLoadMinuteData={loadMinuteData}
|
||||
onChartClick={handleChartClick}
|
||||
selectedPeriod={selectedPeriod}
|
||||
onPeriodChange={setSelectedPeriod}
|
||||
stockCode={stockCode}
|
||||
loading={loading}
|
||||
/>
|
||||
|
||||
{/* 主要内容区域 - Tab */}
|
||||
{loading ? (
|
||||
<Box
|
||||
bg="gray.900"
|
||||
border="1px solid"
|
||||
borderColor="rgba(212, 175, 55, 0.3)"
|
||||
borderRadius="xl"
|
||||
>
|
||||
<LoadingState message="数据加载中..." height="400px" />
|
||||
</Box>
|
||||
) : (
|
||||
<SubTabContainer
|
||||
tabs={tabConfigs}
|
||||
componentProps={componentProps}
|
||||
themePreset="blackGold"
|
||||
index={activeTab}
|
||||
onTabChange={handleTabChange}
|
||||
isLazy
|
||||
/>
|
||||
)}
|
||||
<SubTabContainer
|
||||
tabs={tabConfigs}
|
||||
componentProps={componentProps}
|
||||
themePreset="blackGold"
|
||||
index={activeTab}
|
||||
onTabChange={handleTabChange}
|
||||
isLazy
|
||||
/>
|
||||
</VStack>
|
||||
</Container>
|
||||
|
||||
|
||||
@@ -300,6 +300,7 @@ export interface KLineModuleProps {
|
||||
selectedPeriod?: number;
|
||||
onPeriodChange?: (period: number) => void;
|
||||
stockCode?: string; // 股票代码,用于获取实时盘口数据
|
||||
loading?: boolean; // 日K线数据加载中
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user