From 679466d4a4c70f8b14b09019496d12232af821e7 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Fri, 26 Dec 2025 13:32:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(StockQuoteCard):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E8=82=A1=E7=A5=A8=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=92=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - theme.ts: 新增 textPlaceholder 颜色配置,降低透明度避免过亮 - CompareStockInput: placeholder 改为「请输入股票代码」 - CompareStockInput: 使用主题配置的 placeholder 颜色 - CompareStockInput: 添加 loadAllStocks 确保模糊搜索数据加载 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/CompareStockInput.tsx | 18 ++++++++++++++---- .../StockQuoteCard/components/theme.ts | 2 ++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/views/Company/components/StockQuoteCard/components/CompareStockInput.tsx b/src/views/Company/components/StockQuoteCard/components/CompareStockInput.tsx index d77ddfd1..e9b93f52 100644 --- a/src/views/Company/components/StockQuoteCard/components/CompareStockInput.tsx +++ b/src/views/Company/components/StockQuoteCard/components/CompareStockInput.tsx @@ -4,7 +4,7 @@ */ import React, { useState, useEffect, useRef } from 'react'; -import { useSelector } from 'react-redux'; +import { useSelector, useDispatch } from 'react-redux'; import { Box, HStack, @@ -18,6 +18,8 @@ import { } from '@chakra-ui/react'; import { BarChart2, Search } from 'lucide-react'; import { useStockSearch, type Stock } from '../../../hooks/useStockSearch'; +import { loadAllStocks } from '@store/slices/stockSlice'; +import { DEEP_SPACE_THEME as T } from './theme'; interface CompareStockInputProps { onCompare: (stockCode: string) => void; @@ -40,13 +42,21 @@ const CompareStockInput: React.FC = ({ const [showDropdown, setShowDropdown] = useState(false); const [selectedStock, setSelectedStock] = useState(null); const containerRef = useRef(null); + const dispatch = useDispatch(); // 从 Redux 获取全部股票列表 const allStocks = useSelector((state: RootState) => state.stock.allStocks); + // 确保股票列表已加载(用于模糊搜索) + useEffect(() => { + if (!allStocks || allStocks.length === 0) { + dispatch(loadAllStocks() as any); + } + }, [dispatch, allStocks]); + // 黑金主题颜色(提高对比度) const borderColor = '#E8C14D'; - const textColor = 'rgba(245, 240, 225, 0.95)'; + const textColor = T.textSecondary; const goldColor = '#F4D03F'; const bgColor = '#1A202C'; @@ -108,7 +118,7 @@ const CompareStockInput: React.FC = ({ { setInputValue(e.target.value); @@ -121,7 +131,7 @@ const CompareStockInput: React.FC = ({ fontSize="sm" borderColor={borderColor} bg="transparent" - _placeholder={{ color: textColor, fontSize: 'sm' }} + _placeholder={{ color: T.textPlaceholder, fontSize: 'sm' }} _focus={{ borderColor: goldColor, boxShadow: `0 0 0 1px ${goldColor}`, diff --git a/src/views/Company/components/StockQuoteCard/components/theme.ts b/src/views/Company/components/StockQuoteCard/components/theme.ts index 51d77cb3..ede95edd 100644 --- a/src/views/Company/components/StockQuoteCard/components/theme.ts +++ b/src/views/Company/components/StockQuoteCard/components/theme.ts @@ -61,6 +61,8 @@ export const DEEP_SPACE_THEME = { textSecondary: 'rgba(245, 240, 225, 0.95)', // 标签文字(柔和白色) textMuted: 'rgba(235, 230, 215, 0.85)', + // 占位符文字(低透明度,避免过亮) + textPlaceholder: 'rgba(235, 230, 215, 0.45)', // 纯白文字 textWhite: 'rgba(255, 255, 255, 0.98)', textWhiteMuted: 'rgba(255, 255, 255, 0.8)',