update pay ui

This commit is contained in:
2025-12-10 12:06:13 +08:00
parent 45339902aa
commit 92458a8705
5 changed files with 532 additions and 281 deletions

View File

@@ -60,6 +60,7 @@ import {
} from 'react-icons/fa';
import { useRealtimeQuote } from './hooks';
import { getFullCode } from './hooks/utils';
import QuoteTile from './components/QuoteTile';
import { logger } from '@utils/logger';
import type { WatchlistItem, ConnectionStatus } from './types';
@@ -131,9 +132,9 @@ const FlexScreen: React.FC = () => {
const searchBg = useColorModeValue('gray.50', '#2a2a2a');
const hoverBg = useColorModeValue('gray.100', '#333');
// 获取订阅的证券代码列表
// 获取订阅的证券代码列表带后缀用于区分上证指数000001.SH和平安银行000001.SZ
const subscribedCodes = useMemo(() => {
return watchlist.map(item => item.code);
return watchlist.map(item => getFullCode(item.code, item.isIndex));
}, [watchlist]);
// WebSocket 实时行情
@@ -463,16 +464,19 @@ const FlexScreen: React.FC = () => {
{/* 自选列表 */}
{watchlist.length > 0 ? (
<SimpleGrid columns={{ base: 1, md: 2, lg: 3 }} spacing={4}>
{watchlist.map(item => (
<QuoteTile
key={item.code}
code={item.code}
name={item.name}
quote={quotes[item.code] || {}}
isIndex={item.isIndex}
onRemove={removeSecurity}
/>
))}
{watchlist.map(item => {
const fullCode = getFullCode(item.code, item.isIndex);
return (
<QuoteTile
key={fullCode}
code={item.code}
name={item.name}
quote={quotes[fullCode] || {}}
isIndex={item.isIndex}
onRemove={removeSecurity}
/>
);
})}
</SimpleGrid>
) : (
<Center py={8}>