community增加事件详情
This commit is contained in:
@@ -418,6 +418,7 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
|
|||||||
const [detailDrawerVisible, setDetailDrawerVisible] = useState(false);
|
const [detailDrawerVisible, setDetailDrawerVisible] = useState(false);
|
||||||
const [selectedContent, setSelectedContent] = useState(null);
|
const [selectedContent, setSelectedContent] = useState(null);
|
||||||
const [ztViewMode, setZtViewMode] = useState('sector'); // 'sector' | 'stock'
|
const [ztViewMode, setZtViewMode] = useState('sector'); // 'sector' | 'stock'
|
||||||
|
const [expandedSectors, setExpandedSectors] = useState({}); // 跟踪展开的板块
|
||||||
const [stocksDrawerVisible, setStocksDrawerVisible] = useState(false);
|
const [stocksDrawerVisible, setStocksDrawerVisible] = useState(false);
|
||||||
const [selectedEventStocks, setSelectedEventStocks] = useState([]);
|
const [selectedEventStocks, setSelectedEventStocks] = useState([]);
|
||||||
const [selectedEventTime, setSelectedEventTime] = useState(null);
|
const [selectedEventTime, setSelectedEventTime] = useState(null);
|
||||||
@@ -442,13 +443,25 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
|
|||||||
}, [ztDetail]);
|
}, [ztDetail]);
|
||||||
|
|
||||||
// 股票详情数据处理 - 支持两种字段名:stocks 和 stock_infos
|
// 股票详情数据处理 - 支持两种字段名:stocks 和 stock_infos
|
||||||
|
// 按连板天数降序排列(高连板在前)
|
||||||
const stockList = useMemo(() => {
|
const stockList = useMemo(() => {
|
||||||
const stocksData = ztDetail?.stocks || ztDetail?.stock_infos;
|
const stocksData = ztDetail?.stocks || ztDetail?.stock_infos;
|
||||||
if (!stocksData) return [];
|
if (!stocksData) return [];
|
||||||
return stocksData.map(stock => ({
|
|
||||||
...stock,
|
// 解析连板天数的辅助函数
|
||||||
key: stock.scode,
|
const parseContinuousDays = (text) => {
|
||||||
}));
|
if (!text || text === '首板') return 1;
|
||||||
|
const match = text.match(/(\d+)/);
|
||||||
|
return match ? parseInt(match[1]) : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
return stocksData
|
||||||
|
.map(stock => ({
|
||||||
|
...stock,
|
||||||
|
key: stock.scode,
|
||||||
|
_continuousDays: parseContinuousDays(stock.continuous_days), // 用于排序
|
||||||
|
}))
|
||||||
|
.sort((a, b) => b._continuousDays - a._continuousDays); // 降序排列
|
||||||
}, [ztDetail]);
|
}, [ztDetail]);
|
||||||
|
|
||||||
// 热门关键词
|
// 热门关键词
|
||||||
@@ -942,65 +955,90 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
|
|||||||
title: '涨停股票',
|
title: '涨停股票',
|
||||||
dataIndex: 'stocks',
|
dataIndex: 'stocks',
|
||||||
key: 'stocks',
|
key: 'stocks',
|
||||||
render: (stocks) => {
|
render: (stocks, record) => {
|
||||||
// 根据股票代码查找股票详情
|
// 根据股票代码查找股票详情
|
||||||
const getStockInfo = (code) => {
|
const getStockInfo = (code) => {
|
||||||
const stockInfo = stockList.find(s => s.scode === code);
|
const stockInfo = stockList.find(s => s.scode === code);
|
||||||
return stockInfo || { sname: code, scode: code };
|
return stockInfo || { sname: code, scode: code };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const sectorName = record.name;
|
||||||
|
const isExpanded = expandedSectors[sectorName];
|
||||||
|
const displayStocks = isExpanded ? stocks : stocks.slice(0, 5);
|
||||||
|
const hasMore = stocks.length > 5;
|
||||||
|
|
||||||
|
const toggleExpand = (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
setExpandedSectors(prev => ({
|
||||||
|
...prev,
|
||||||
|
[sectorName]: !prev[sectorName]
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HStack spacing={2} flexWrap="wrap">
|
<VStack align="start" spacing={1}>
|
||||||
{stocks.slice(0, 5).map((code) => {
|
<HStack spacing={2} flexWrap="wrap">
|
||||||
const info = getStockInfo(code);
|
{displayStocks.map((code) => {
|
||||||
return (
|
const info = getStockInfo(code);
|
||||||
<Tooltip
|
return (
|
||||||
key={code}
|
<Tooltip
|
||||||
title={
|
key={code}
|
||||||
<Box>
|
title={
|
||||||
<div style={{ fontWeight: 'bold', marginBottom: 4 }}>{info.sname}</div>
|
<Box>
|
||||||
<div style={{ fontSize: '12px', color: '#888' }}>{code}</div>
|
<div style={{ fontWeight: 'bold', marginBottom: 4 }}>{info.sname}</div>
|
||||||
{info.core_sectors && (
|
<div style={{ fontSize: '12px', color: '#888' }}>{code}</div>
|
||||||
<div style={{ fontSize: '11px', marginTop: 4 }}>
|
{info.core_sectors && (
|
||||||
{info.core_sectors.slice(0, 2).join(' · ')}
|
<div style={{ fontSize: '11px', marginTop: 4 }}>
|
||||||
</div>
|
{info.core_sectors.slice(0, 2).join(' · ')}
|
||||||
)}
|
</div>
|
||||||
</Box>
|
)}
|
||||||
}
|
{info.continuous_days && (
|
||||||
placement="top"
|
<div style={{ fontSize: '11px', marginTop: 2, color: '#fa8c16' }}>
|
||||||
>
|
{info.continuous_days}
|
||||||
<Tag
|
</div>
|
||||||
style={{
|
)}
|
||||||
cursor: 'pointer',
|
</Box>
|
||||||
margin: '2px',
|
}
|
||||||
background: 'rgba(59, 130, 246, 0.15)',
|
placement="top"
|
||||||
border: '1px solid rgba(59, 130, 246, 0.3)',
|
|
||||||
borderRadius: '6px',
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<a
|
<Tag
|
||||||
href={`https://valuefrontier.cn/company?scode=${code}`}
|
style={{
|
||||||
target="_blank"
|
cursor: 'pointer',
|
||||||
rel="noopener noreferrer"
|
margin: '2px',
|
||||||
style={{ color: '#60A5FA', fontSize: '13px' }}
|
background: 'rgba(59, 130, 246, 0.15)',
|
||||||
|
border: '1px solid rgba(59, 130, 246, 0.3)',
|
||||||
|
borderRadius: '6px',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{info.sname}
|
<a
|
||||||
</a>
|
href={`https://valuefrontier.cn/company?scode=${code}`}
|
||||||
</Tag>
|
target="_blank"
|
||||||
</Tooltip>
|
rel="noopener noreferrer"
|
||||||
);
|
style={{ color: '#60A5FA', fontSize: '13px' }}
|
||||||
})}
|
>
|
||||||
{stocks.length > 5 && (
|
{info.sname}
|
||||||
<Tag style={{
|
</a>
|
||||||
margin: '2px',
|
</Tag>
|
||||||
background: 'rgba(255,255,255,0.1)',
|
</Tooltip>
|
||||||
border: '1px solid rgba(255,255,255,0.2)',
|
);
|
||||||
borderRadius: '6px',
|
})}
|
||||||
color: '#888'
|
</HStack>
|
||||||
}}>
|
{hasMore && (
|
||||||
+{stocks.length - 5}
|
<Button
|
||||||
</Tag>
|
type="link"
|
||||||
|
size="small"
|
||||||
|
onClick={toggleExpand}
|
||||||
|
style={{
|
||||||
|
padding: 0,
|
||||||
|
height: 'auto',
|
||||||
|
fontSize: '12px',
|
||||||
|
color: isExpanded ? '#888' : '#FFD700',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isExpanded ? '收起 ▲' : `展开全部 ${stocks.length} 只 ▼`}
|
||||||
|
</Button>
|
||||||
)}
|
)}
|
||||||
</HStack>
|
</VStack>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user