diff --git a/src/views/StockOverview/index.js b/src/views/StockOverview/index.js index bd0e3e28..97a099d3 100644 --- a/src/views/StockOverview/index.js +++ b/src/views/StockOverview/index.js @@ -53,6 +53,7 @@ import ConceptStocksModal from '@components/ConceptStocksModal'; import TradeDatePicker from '@components/TradeDatePicker'; import HotspotOverview from './components/HotspotOverview'; import FlexScreen from './components/FlexScreen'; +import { HeroSection } from '@components/HeroSection'; import { echarts } from '@lib/echarts'; import { logger } from '../../utils/logger'; import { getConceptHtmlUrl } from '../../utils/textUtils'; @@ -623,240 +624,83 @@ const StockOverview = () => { zIndex={0} /> - {/* Hero Section */} - - {/* 背景装饰 */} - - - - - - - - - 个股中心 - - - - - 实时追踪市场动态,洞察投资机会 - - - - {/* 搜索框 */} - - - - - - - {searchQuery && ( - - } - variant="ghost" - onClick={handleClearSearch} - aria-label="清空搜索" - color={colorMode === 'dark' ? goldColor : 'gray.600'} - _hover={{ - bg: colorMode === 'dark' ? 'whiteAlpha.100' : 'gray.100' - }} - /> - - )} - - - {/* 搜索结果下拉 */} - - - {isSearching ? ( -
- -
- ) : searchResults.length > 0 ? ( - - {searchResults.map((stock, index) => ( - handleSelectStock(stock, index)} - borderBottomWidth={index < searchResults.length - 1 ? "1px" : "0"} - borderColor={borderColor} - > - - - {stock.stock_name} - - {stock.stock_code} - {stock.pinyin_abbr && ( - ({stock.pinyin_abbr.toUpperCase()}) - )} - {stock.exchange && ( - - {stock.exchange} - - )} - - - - - - ))} - - ) : ( -
- 未找到相关股票 -
- )} -
-
-
- - {/* 统计数据 - 使用市场统计API数据 */} - - - A股总市值 - - {marketStats ? - `${(marketStats.total_market_cap / 10000).toFixed(1)}万亿` - : '-' - } - - - - 今日成交额 - - {marketStats ? - `${(marketStats.total_amount / 10000).toFixed(1)}万亿` - : '-' - } - - - - 上涨家数 - - {marketStats && marketStats.rising_count !== undefined && marketStats.rising_count !== null ? - marketStats.rising_count.toLocaleString() : '-' - } - - - - 下跌家数 - - {marketStats && marketStats.falling_count !== undefined && marketStats.falling_count !== null ? - marketStats.falling_count.toLocaleString() : '-' - } - - - -
-
-
+ {/* Hero Section - 使用通用 HeroSection 组件 */} + { + setSearchQuery(value); + if (value && !searchQuery) { + trackSearchInitiated(); + } + debounceSearch(value); + }, + onClear: handleClearSearch, + results: searchResults.map((stock) => ({ + id: stock.stock_code, + label: stock.stock_name, + subLabel: stock.stock_code, + extra: stock.pinyin_abbr?.toUpperCase(), + tags: stock.exchange ? [{ text: stock.exchange }] : [], + raw: stock, + })), + isSearching: isSearching, + showDropdown: showResults, + onSearch: async () => [], + onResultSelect: (item, index) => handleSelectStock(item.raw, index), + }} + stats={{ + columns: { base: 2, md: 4 }, + items: [ + { + key: 'marketCap', + label: 'A股总市值', + value: marketStats ? `${(marketStats.total_market_cap / 10000).toFixed(1)}万亿` : null, + }, + { + key: 'amount', + label: '今日成交额', + value: marketStats ? `${(marketStats.total_amount / 10000).toFixed(1)}万亿` : null, + }, + { + key: 'rising', + label: '上涨家数', + value: marketStats?.rising_count, + valueColor: '#ff4d4d', + }, + { + key: 'falling', + label: '下跌家数', + value: marketStats?.falling_count, + valueColor: 'green.400', + }, + ], + }} + /> {/* 主内容区 */}