From ab7164681a0d3de759edd519fdc640fd30371888 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Tue, 16 Dec 2025 20:08:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(StockQuoteCard):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=AF=8F=E8=82=A1=E6=94=B6=E7=9B=8A(EPS)=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mock 数据添加 eps、pb、主力动态等指标 - StockQuoteCard 显示 EPS 数据 - useStockQuote 支持 eps 字段转换 - StockInfoHeader 移除重复的 EPS 显示 --- src/mocks/handlers/stock.js | 14 +++++++++++++- .../components/StockInfoHeader.tsx | 14 ++------------ .../Company/components/StockQuoteCard/index.tsx | 6 ++++++ .../Company/components/StockQuoteCard/types.ts | 1 + src/views/Company/hooks/useStockQuote.js | 1 + 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/mocks/handlers/stock.js b/src/mocks/handlers/stock.js index aef78954..8581d1e5 100644 --- a/src/mocks/handlers/stock.js +++ b/src/mocks/handlers/stock.js @@ -421,7 +421,19 @@ export const stockHandlers = [ // 行业和指数标签 industry_l1: industryInfo.industry_l1, industry: industryInfo.industry, - index_tags: industryInfo.index_tags || [] + index_tags: industryInfo.index_tags || [], + // 关键指标 + pe: parseFloat((Math.random() * 50 + 5).toFixed(2)), + eps: parseFloat((Math.random() * 5 + 0.1).toFixed(3)), + pb: parseFloat((Math.random() * 8 + 0.5).toFixed(2)), + market_cap: `${(Math.random() * 5000 + 100).toFixed(0)}亿`, + week52_low: parseFloat((basePrice * 0.7).toFixed(2)), + week52_high: parseFloat((basePrice * 1.3).toFixed(2)), + // 主力动态 + main_net_inflow: parseFloat((Math.random() * 10 - 5).toFixed(2)), + institution_holding: parseFloat((Math.random() * 50 + 10).toFixed(2)), + buy_ratio: parseFloat((Math.random() * 40 + 30).toFixed(2)), + sell_ratio: parseFloat((100 - (Math.random() * 40 + 30)).toFixed(2)) }; }); diff --git a/src/views/Company/components/FinancialPanorama/components/StockInfoHeader.tsx b/src/views/Company/components/FinancialPanorama/components/StockInfoHeader.tsx index 50e93c51..1837190d 100644 --- a/src/views/Company/components/FinancialPanorama/components/StockInfoHeader.tsx +++ b/src/views/Company/components/FinancialPanorama/components/StockInfoHeader.tsx @@ -57,8 +57,8 @@ export const StockInfoHeader: React.FC = ({ boxShadow: '0 8px 30px rgba(212, 175, 55, 0.15)', }} > - - + + 股票名称 @@ -84,16 +84,6 @@ export const StockInfoHeader: React.FC = ({ - - - - 最新EPS - - - {stockInfo.key_metrics?.eps?.toFixed(3) || '-'} - - - diff --git a/src/views/Company/components/StockQuoteCard/index.tsx b/src/views/Company/components/StockQuoteCard/index.tsx index 0ed417d6..9da9e96f 100644 --- a/src/views/Company/components/StockQuoteCard/index.tsx +++ b/src/views/Company/components/StockQuoteCard/index.tsx @@ -276,6 +276,12 @@ const StockQuoteCard: React.FC = ({ {data.pe.toFixed(2)} + + 每股收益(EPS): + + {data.eps?.toFixed(3) || '-'} + + 市净率(PB): diff --git a/src/views/Company/components/StockQuoteCard/types.ts b/src/views/Company/components/StockQuoteCard/types.ts index 133e138f..fce90875 100644 --- a/src/views/Company/components/StockQuoteCard/types.ts +++ b/src/views/Company/components/StockQuoteCard/types.ts @@ -26,6 +26,7 @@ export interface StockQuoteCardData { // 关键指标 pe: number; // 市盈率 + eps?: number; // 每股收益 pb: number; // 市净率 marketCap: string; // 流通市值(已格式化,如 "2.73万亿") week52Low: number; // 52周最低 diff --git a/src/views/Company/hooks/useStockQuote.js b/src/views/Company/hooks/useStockQuote.js index 817a8af2..84b5a806 100644 --- a/src/views/Company/hooks/useStockQuote.js +++ b/src/views/Company/hooks/useStockQuote.js @@ -29,6 +29,7 @@ const transformQuoteData = (apiData, stockCode) => { // 关键指标 pe: apiData.pe || apiData.pe_ttm || 0, + eps: apiData.eps || apiData.basic_eps || undefined, pb: apiData.pb || apiData.pb_mrq || 0, marketCap: apiData.market_cap || apiData.marketCap || apiData.circ_mv || '0', week52Low: apiData.week52_low || apiData.week52Low || 0,