From bdc823e122844870b9633255c53491c200bf3119 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Wed, 17 Dec 2025 12:02:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(CompanyOverview):=20=E4=BF=AE=E5=A4=8D=20us?= =?UTF-8?q?eBasicInfo=20=E9=87=8D=E5=A4=8D=E8=B0=83=E7=94=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - BusinessInfoPanel: 改为内部调用 useBasicInfo,自行获取数据 - BasicInfoTab: 移除 basicInfo prop 传递 - CompanyOverview: 移除顶层 useBasicInfo 调用 - types.ts: 补充 BasicInfo 工商信息字段类型定义 修复前:CompanyOverview 和各子组件重复请求 /api/stock/{code}/basic-info 修复后:仅 BusinessInfoPanel 在需要时请求一次 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/BusinessInfoPanel.tsx | 16 ++++++++++++++-- .../CompanyOverview/BasicInfoTab/index.tsx | 4 +--- .../Company/components/CompanyOverview/index.tsx | 11 +++-------- .../Company/components/CompanyOverview/types.ts | 9 +++++++++ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/views/Company/components/CompanyOverview/BasicInfoTab/components/BusinessInfoPanel.tsx b/src/views/Company/components/CompanyOverview/BasicInfoTab/components/BusinessInfoPanel.tsx index 0752847c..9379a03f 100644 --- a/src/views/Company/components/CompanyOverview/BasicInfoTab/components/BusinessInfoPanel.tsx +++ b/src/views/Company/components/CompanyOverview/BasicInfoTab/components/BusinessInfoPanel.tsx @@ -12,15 +12,27 @@ import { Divider, Center, Code, + Spinner, } from "@chakra-ui/react"; import { THEME } from "../config"; +import { useBasicInfo } from "../../hooks/useBasicInfo"; interface BusinessInfoPanelProps { - basicInfo: any; + stockCode: string; } -const BusinessInfoPanel: React.FC = ({ basicInfo }) => { +const BusinessInfoPanel: React.FC = ({ stockCode }) => { + const { basicInfo, loading } = useBasicInfo(stockCode); + + if (loading) { + return ( +
+ +
+ ); + } + if (!basicInfo) { return (
diff --git a/src/views/Company/components/CompanyOverview/BasicInfoTab/index.tsx b/src/views/Company/components/CompanyOverview/BasicInfoTab/index.tsx index 120f0175..857ab30d 100644 --- a/src/views/Company/components/CompanyOverview/BasicInfoTab/index.tsx +++ b/src/views/Company/components/CompanyOverview/BasicInfoTab/index.tsx @@ -17,7 +17,6 @@ import { // Props 类型定义 export interface BasicInfoTabProps { stockCode: string; - basicInfo?: any; // 可配置项 enabledTabs?: string[]; // 指定显示哪些 Tab(通过 key) @@ -59,7 +58,6 @@ const buildTabsConfig = (enabledKeys?: string[]): SubTabConfig[] => { */ const BasicInfoTab: React.FC = ({ stockCode, - basicInfo, enabledTabs, defaultTabIndex = 0, onTabChange, @@ -72,7 +70,7 @@ const BasicInfoTab: React.FC = ({ = ({ stockCode }) => { - const { basicInfo } = useBasicInfo(stockCode); - return ( {/* 基本信息内容 - 传入 stockCode,内部懒加载各 Tab 数据 */} - + ); }; diff --git a/src/views/Company/components/CompanyOverview/types.ts b/src/views/Company/components/CompanyOverview/types.ts index 5d9268a3..24feb890 100644 --- a/src/views/Company/components/CompanyOverview/types.ts +++ b/src/views/Company/components/CompanyOverview/types.ts @@ -22,6 +22,15 @@ export interface BasicInfo { email?: string; tel?: string; company_intro?: string; + // 工商信息字段 + credit_code?: string; + company_size?: string; + reg_address?: string; + office_address?: string; + accounting_firm?: string; + law_firm?: string; + main_business?: string; + business_scope?: string; } /**