From 6fde1b90baad742faaaee53cf36e589afe6dab8d Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Tue, 6 Jan 2026 18:53:15 +0800 Subject: [PATCH] =?UTF-8?q?community=E5=A2=9E=E5=8A=A0=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShareButton/index.js | 57 ++++++++++++++++------------- src/views/Company/config.ts | 57 +++++++++++++++++------------ src/views/Company/index.tsx | 16 ++++++-- 3 files changed, 77 insertions(+), 53 deletions(-) diff --git a/src/components/ShareButton/index.js b/src/components/ShareButton/index.js index 1df43504..b3d14c95 100644 --- a/src/components/ShareButton/index.js +++ b/src/components/ShareButton/index.js @@ -179,36 +179,41 @@ const ShareButton = ({ {/* 分享选项 */} - - {/* 微信分享提示(仅在微信环境显示) */} - {isInWechat && ( - - - - - 微信分享 - - - 请点击右上角「...」选择分享方式 - - - - )} + + {/* 微信分享提示 */} + + + + + 分享到微信 + + + {isInWechat + ? '请点击右上角「...」选择分享方式' + : '复制链接后,打开微信发送给好友'} + + + - {/* 复制链接 */} + {/* 复制链接按钮 */} - - {copied ? '已复制' : '复制链接'} + + {copied ? '链接已复制,去微信粘贴吧!' : '复制链接'} {link || window.location.href} diff --git a/src/views/Company/config.ts b/src/views/Company/config.ts index ac43bbdc..3891a7d0 100644 --- a/src/views/Company/config.ts +++ b/src/views/Company/config.ts @@ -5,12 +5,11 @@ */ import React, { lazy } from 'react'; -import { Building2, Brain, TrendingUp, Wallet, FileBarChart, Newspaper } from 'lucide-react'; +import { Building2, Brain, TrendingUp, Wallet, Newspaper, Layers } from 'lucide-react'; import type { CompanyTheme, TabConfig } from './types'; // 骨架屏组件(同步导入,用于 Suspense fallback) import { FinancialPanoramaSkeleton } from './components/FinancialPanorama/components'; -import { ForecastSkeleton } from './components/ForecastReport/components'; import { MarketDataSkeleton } from './components/MarketDataView/components'; import DynamicTrackingNavSkeleton from './components/DynamicTracking/components/DynamicTrackingNavSkeleton'; import CompanyOverviewNavSkeleton from './components/CompanyOverview/BasicInfoTab/components/CompanyOverviewNavSkeleton'; @@ -61,25 +60,29 @@ const MarketDataView = lazy(() => const FinancialPanorama = lazy(() => import(/* webpackChunkName: "company-financial" */ './components/FinancialPanorama') ); -const ForecastReport = lazy(() => - import(/* webpackChunkName: "company-forecast" */ './components/ForecastReport') -); const DynamicTracking = lazy(() => import(/* webpackChunkName: "company-tracking" */ './components/DynamicTracking') ); +const ConceptSector = lazy(() => + import(/* webpackChunkName: "company-concept" */ './components/ConceptSector') +); // ============================================ // Tab 配置 // ============================================ +/** + * Tab 配置 + * 调整: + * - 深度分析作为首位 + * - 股票行情 + * - 概念板块(新增) + * - 动态跟踪 + * - 财务全景 + * - 公司档案(移到最后) + * - 去掉"盈利预测" + */ export const TAB_CONFIG: TabConfig[] = [ - { - key: 'overview', - name: '公司概览', - icon: Building2, - component: CompanyOverview, - fallback: React.createElement(CompanyOverviewNavSkeleton), - }, { key: 'analysis', name: '深度分析', @@ -94,18 +97,10 @@ export const TAB_CONFIG: TabConfig[] = [ fallback: React.createElement(MarketDataSkeleton), }, { - key: 'financial', - name: '财务全景', - icon: Wallet, - component: FinancialPanorama, - fallback: React.createElement(FinancialPanoramaSkeleton), - }, - { - key: 'forecast', - name: '盈利预测', - icon: FileBarChart, - component: ForecastReport, - fallback: React.createElement(ForecastSkeleton), + key: 'concept', + name: '概念板块', + icon: Layers, + component: ConceptSector, }, { key: 'tracking', @@ -114,6 +109,20 @@ export const TAB_CONFIG: TabConfig[] = [ component: DynamicTracking, fallback: React.createElement(DynamicTrackingNavSkeleton), }, + { + key: 'financial', + name: '财务全景', + icon: Wallet, + component: FinancialPanorama, + fallback: React.createElement(FinancialPanoramaSkeleton), + }, + { + key: 'overview', + name: '公司档案', + icon: Building2, + component: CompanyOverview, + fallback: React.createElement(CompanyOverviewNavSkeleton), + }, ]; // ============================================ diff --git a/src/views/Company/index.tsx b/src/views/Company/index.tsx index 6704c643..0a5e8eef 100644 --- a/src/views/Company/index.tsx +++ b/src/views/Company/index.tsx @@ -55,7 +55,7 @@ import './theme/fui-animations.css'; // 第三方库导入 // ============================================ // React Router - 用于读取和修改 URL 查询参数 -import { useSearchParams } from 'react-router-dom'; +import { useSearchParams, useParams } from 'react-router-dom'; // Chakra UI - 基础布局组件 import { Box } from '@chakra-ui/react'; @@ -111,6 +111,15 @@ const CompanyIndex: React.FC = () => { // ========================================== // URL 参数管理 // ========================================== + /** + * useParams - React Router v6 的 Hook + * 用于读取 URL 路径参数 (path params) + * + * 示例 URL: /company/300394 + * params.code 返回 '300394' + */ + const params = useParams<{ code?: string }>(); + /** * useSearchParams - React Router v6 的 Hook * 用于读取和修改 URL 中的查询参数 (query string) @@ -122,10 +131,11 @@ const CompanyIndex: React.FC = () => { /** * 当前股票代码 - * - 从 URL 参数 `scode` 读取 + * - 优先从 URL 路径参数 `code` 读取 (支持 /company/300394 格式) + * - 其次从 URL 查询参数 `scode` 读取 (支持 /company?scode=300394 格式) * - 默认值 '000001' (平安银行) 作为兜底 */ - const stockCode = searchParams.get('scode') || '000001'; + const stockCode = params.code || searchParams.get('scode') || '000001'; /** * 前一个股票代码的引用