community增加事件详情
This commit is contained in:
@@ -456,6 +456,20 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
|
||||
return ztDetail.word_freq_data.slice(0, 12);
|
||||
}, [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之后
|
||||
if (!selectedDate) return null;
|
||||
|
||||
@@ -485,12 +499,6 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
|
||||
setDetailDrawerVisible(true);
|
||||
};
|
||||
|
||||
// 获取六位股票代码(去掉后缀)
|
||||
const getSixDigitCode = (code) => {
|
||||
if (!code) return code;
|
||||
return code.split('.')[0];
|
||||
};
|
||||
|
||||
// 加载股票行情
|
||||
const loadStockQuotes = async (stocks) => {
|
||||
if (!stocks || stocks.length === 0) return;
|
||||
@@ -571,14 +579,6 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
|
||||
return sixDigitCode;
|
||||
};
|
||||
|
||||
// 检查股票是否已在自选中
|
||||
const isStockInWatchlist = useCallback((stockCode) => {
|
||||
const sixDigitCode = getSixDigitCode(stockCode);
|
||||
return reduxWatchlist?.some(item =>
|
||||
getSixDigitCode(item.stock_code) === sixDigitCode
|
||||
);
|
||||
}, [reduxWatchlist]);
|
||||
|
||||
// 显示K线图
|
||||
const showKline = (stock) => {
|
||||
const code = stock.code;
|
||||
|
||||
Reference in New Issue
Block a user