From ac7e627b2d09916ea6750aa6db01934617bcdef1 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Wed, 17 Dec 2025 10:31:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor(Company):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=89=80=E6=9C=89=20Tab=20=E7=9A=84=20loading=20=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 创建共享的 LoadingState 组件(黑金主题) - DeepAnalysisTab: 使用统一 LoadingState 替换蓝色 Spinner - FinancialPanorama: 使用 LoadingState 替换 Skeleton - MarketDataView: 使用 LoadingState 替换自定义 Spinner - ForecastReport: 使用 LoadingState 替换 Skeleton 骨架屏 所有一级 Tab 现在使用一致的金色 Spinner + 加载提示文案 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../CompanyOverview/DeepAnalysisTab/index.tsx | 10 ++--- .../components/FinancialPanorama/index.tsx | 4 +- .../components/ForecastReport/index.tsx | 14 ++---- src/views/Company/components/LoadingState.tsx | 44 +++++++++++++++++++ .../components/MarketDataView/index.tsx | 15 +------ 5 files changed, 55 insertions(+), 32 deletions(-) create mode 100644 src/views/Company/components/LoadingState.tsx diff --git a/src/views/Company/components/CompanyOverview/DeepAnalysisTab/index.tsx b/src/views/Company/components/CompanyOverview/DeepAnalysisTab/index.tsx index 4bac2e69..858e6575 100644 --- a/src/views/Company/components/CompanyOverview/DeepAnalysisTab/index.tsx +++ b/src/views/Company/components/CompanyOverview/DeepAnalysisTab/index.tsx @@ -11,9 +11,10 @@ */ import React, { useMemo } from 'react'; -import { Card, CardBody, Center, VStack, Spinner, Text } from '@chakra-ui/react'; +import { Card, CardBody } from '@chakra-ui/react'; import { FaBrain, FaBuilding, FaLink, FaHistory } from 'react-icons/fa'; import SubTabContainer, { type SubTabConfig } from '@components/SubTabContainer'; +import LoadingState from '../../LoadingState'; import { StrategyTab, BusinessTab, ValueChainTab, DevelopmentTab } from './tabs'; import type { DeepAnalysisTabProps, DeepAnalysisTabKey } from './types'; @@ -75,12 +76,7 @@ const DeepAnalysisTab: React.FC = ({ componentProps={{}} themePreset="blackGold" /> -
- - - 加载数据中... - -
+ ); diff --git a/src/views/Company/components/FinancialPanorama/index.tsx b/src/views/Company/components/FinancialPanorama/index.tsx index 4a58701b..9ea925c0 100644 --- a/src/views/Company/components/FinancialPanorama/index.tsx +++ b/src/views/Company/components/FinancialPanorama/index.tsx @@ -13,7 +13,6 @@ import { Text, Alert, AlertIcon, - Skeleton, Modal, ModalOverlay, ModalContent, @@ -47,6 +46,7 @@ import { formatUtils } from '@services/financialService'; // 通用组件 import SubTabContainer, { type SubTabConfig } from '@components/SubTabContainer'; +import LoadingState from '../LoadingState'; // 内部模块导入 import { useFinancialData, type DataTypeKey } from './hooks'; @@ -278,7 +278,7 @@ const FinancialPanorama: React.FC = ({ stockCode: propSt {/* 财务全景面板(三列布局:成长能力、盈利与回报、风险与运营) */} {loading ? ( - + ) : ( = ({ stockCode: propStockCod return ( - {/* 加载骨架屏 */} + {/* 加载状态 */} {loading && !data && ( - - {[1, 2, 3].map((i) => ( - - - - ))} - + )} {/* 图表区域 - 3列布局 */} diff --git a/src/views/Company/components/LoadingState.tsx b/src/views/Company/components/LoadingState.tsx new file mode 100644 index 00000000..11df6cba --- /dev/null +++ b/src/views/Company/components/LoadingState.tsx @@ -0,0 +1,44 @@ +// src/views/Company/components/LoadingState.tsx +// 统一的加载状态组件 - 黑金主题 + +import React from "react"; +import { Center, VStack, Spinner, Text } from "@chakra-ui/react"; + +// 黑金主题配置 +const THEME = { + gold: "#D4AF37", + textSecondary: "gray.400", +}; + +interface LoadingStateProps { + message?: string; + height?: string; +} + +/** + * 统一的加载状态组件(黑金主题) + * + * 用于所有一级 Tab 的 loading 状态展示 + */ +const LoadingState: React.FC = ({ + message = "加载中...", + height = "300px", +}) => { + return ( +
+ + + + {message} + + +
+ ); +}; + +export default LoadingState; diff --git a/src/views/Company/components/MarketDataView/index.tsx b/src/views/Company/components/MarketDataView/index.tsx index 445cc4c1..c67d46e5 100644 --- a/src/views/Company/components/MarketDataView/index.tsx +++ b/src/views/Company/components/MarketDataView/index.tsx @@ -6,7 +6,6 @@ import { Box, Container, CardBody, - Spinner, Center, VStack, Text, @@ -39,6 +38,7 @@ import { UnusualPanel, PledgePanel, } from './components/panels'; +import LoadingState from '../LoadingState'; import type { MarketDataViewProps, RiseAnalysis } from './types'; /** @@ -163,18 +163,7 @@ const MarketDataView: React.FC = ({ stockCode: propStockCod {loading ? ( -
- - - 数据加载中... - -
+
) : (