community增加事件详情

This commit is contained in:
2026-01-07 13:26:48 +08:00
parent 66e623d473
commit a8cf4266b4

View File

@@ -456,6 +456,20 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
return ztDetail.word_freq_data.slice(0, 12); return ztDetail.word_freq_data.slice(0, 12);
}, [ztDetail]); }, [ztDetail]);
// 获取六位股票代码(去掉后缀)- 纯函数不是hook
const getSixDigitCode = (code) => {
if (!code) return code;
return code.split('.')[0];
};
// 检查股票是否已在自选中 - 必须在条件返回之前
const isStockInWatchlist = useCallback((stockCode) => {
const sixDigitCode = getSixDigitCode(stockCode);
return reduxWatchlist?.some(item =>
getSixDigitCode(item.stock_code) === sixDigitCode
);
}, [reduxWatchlist]);
// 条件返回必须在所有hooks之后 // 条件返回必须在所有hooks之后
if (!selectedDate) return null; if (!selectedDate) return null;
@@ -485,12 +499,6 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
setDetailDrawerVisible(true); setDetailDrawerVisible(true);
}; };
// 获取六位股票代码(去掉后缀)
const getSixDigitCode = (code) => {
if (!code) return code;
return code.split('.')[0];
};
// 加载股票行情 // 加载股票行情
const loadStockQuotes = async (stocks) => { const loadStockQuotes = async (stocks) => {
if (!stocks || stocks.length === 0) return; if (!stocks || stocks.length === 0) return;
@@ -571,14 +579,6 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
return sixDigitCode; return sixDigitCode;
}; };
// 检查股票是否已在自选中
const isStockInWatchlist = useCallback((stockCode) => {
const sixDigitCode = getSixDigitCode(stockCode);
return reduxWatchlist?.some(item =>
getSixDigitCode(item.stock_code) === sixDigitCode
);
}, [reduxWatchlist]);
// 显示K线图 // 显示K线图
const showKline = (stock) => { const showKline = (stock) => {
const code = stock.code; const code = stock.code;