feat(StockQuoteCard): 新增每股收益(EPS)显示
- Mock 数据添加 eps、pb、主力动态等指标 - StockQuoteCard 显示 EPS 数据 - useStockQuote 支持 eps 字段转换 - StockInfoHeader 移除重复的 EPS 显示
This commit is contained in:
@@ -421,7 +421,19 @@ export const stockHandlers = [
|
|||||||
// 行业和指数标签
|
// 行业和指数标签
|
||||||
industry_l1: industryInfo.industry_l1,
|
industry_l1: industryInfo.industry_l1,
|
||||||
industry: industryInfo.industry,
|
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))
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ export const StockInfoHeader: React.FC<StockInfoHeaderProps> = ({
|
|||||||
boxShadow: '0 8px 30px rgba(212, 175, 55, 0.15)',
|
boxShadow: '0 8px 30px rgba(212, 175, 55, 0.15)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Grid templateColumns="repeat(6, 1fr)" gap={4} alignItems="center">
|
<Grid templateColumns="repeat(5, 1fr)" gap={4} alignItems="center">
|
||||||
<GridItem colSpan={{ base: 6, md: 2 }}>
|
<GridItem colSpan={{ base: 5, md: 2 }}>
|
||||||
<VStack align="start" spacing={1}>
|
<VStack align="start" spacing={1}>
|
||||||
<Text fontSize="xs" color={darkGoldTheme.textMuted}>
|
<Text fontSize="xs" color={darkGoldTheme.textMuted}>
|
||||||
股票名称
|
股票名称
|
||||||
@@ -84,16 +84,6 @@ export const StockInfoHeader: React.FC<StockInfoHeaderProps> = ({
|
|||||||
</HStack>
|
</HStack>
|
||||||
</VStack>
|
</VStack>
|
||||||
</GridItem>
|
</GridItem>
|
||||||
<GridItem>
|
|
||||||
<Stat>
|
|
||||||
<StatLabel color={darkGoldTheme.textMuted} fontSize="xs">
|
|
||||||
最新EPS
|
|
||||||
</StatLabel>
|
|
||||||
<StatNumber color={darkGoldTheme.goldLight} fontSize="lg">
|
|
||||||
{stockInfo.key_metrics?.eps?.toFixed(3) || '-'}
|
|
||||||
</StatNumber>
|
|
||||||
</Stat>
|
|
||||||
</GridItem>
|
|
||||||
<GridItem>
|
<GridItem>
|
||||||
<Stat>
|
<Stat>
|
||||||
<StatLabel color={darkGoldTheme.textMuted} fontSize="xs">
|
<StatLabel color={darkGoldTheme.textMuted} fontSize="xs">
|
||||||
|
|||||||
@@ -276,6 +276,12 @@ const StockQuoteCard: React.FC<StockQuoteCardProps> = ({
|
|||||||
{data.pe.toFixed(2)}
|
{data.pe.toFixed(2)}
|
||||||
</Text>
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
<HStack justify="space-between">
|
||||||
|
<Text color={labelColor}>每股收益(EPS):</Text>
|
||||||
|
<Text color={valueColor} fontWeight="bold" fontSize="16px">
|
||||||
|
{data.eps?.toFixed(3) || '-'}
|
||||||
|
</Text>
|
||||||
|
</HStack>
|
||||||
<HStack justify="space-between">
|
<HStack justify="space-between">
|
||||||
<Text color={labelColor}>市净率(PB):</Text>
|
<Text color={labelColor}>市净率(PB):</Text>
|
||||||
<Text color={valueColor} fontWeight="bold" fontSize="16px">
|
<Text color={valueColor} fontWeight="bold" fontSize="16px">
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export interface StockQuoteCardData {
|
|||||||
|
|
||||||
// 关键指标
|
// 关键指标
|
||||||
pe: number; // 市盈率
|
pe: number; // 市盈率
|
||||||
|
eps?: number; // 每股收益
|
||||||
pb: number; // 市净率
|
pb: number; // 市净率
|
||||||
marketCap: string; // 流通市值(已格式化,如 "2.73万亿")
|
marketCap: string; // 流通市值(已格式化,如 "2.73万亿")
|
||||||
week52Low: number; // 52周最低
|
week52Low: number; // 52周最低
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ const transformQuoteData = (apiData, stockCode) => {
|
|||||||
|
|
||||||
// 关键指标
|
// 关键指标
|
||||||
pe: apiData.pe || apiData.pe_ttm || 0,
|
pe: apiData.pe || apiData.pe_ttm || 0,
|
||||||
|
eps: apiData.eps || apiData.basic_eps || undefined,
|
||||||
pb: apiData.pb || apiData.pb_mrq || 0,
|
pb: apiData.pb || apiData.pb_mrq || 0,
|
||||||
marketCap: apiData.market_cap || apiData.marketCap || apiData.circ_mv || '0',
|
marketCap: apiData.market_cap || apiData.marketCap || apiData.circ_mv || '0',
|
||||||
week52Low: apiData.week52_low || apiData.week52Low || 0,
|
week52Low: apiData.week52_low || apiData.week52Low || 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user