update pay function

This commit is contained in:
2025-11-29 14:07:55 +08:00
parent 1676d69917
commit d14be2081d
5 changed files with 68 additions and 38 deletions

View File

@@ -19,9 +19,10 @@ import { logger } from '../../../../../utils/logger';
* @param {string} eventTime - 事件时间
* @param {Object} options - 配置选项
* @param {boolean} options.autoLoad - 是否自动加载数据默认true
* @param {boolean} options.autoLoadQuotes - 是否自动加载行情数据默认true设为false可延迟到展开时加载
* @returns {Object} 事件数据和加载状态
*/
export const useEventStocks = (eventId, eventTime, { autoLoad = true } = {}) => {
export const useEventStocks = (eventId, eventTime, { autoLoad = true, autoLoadQuotes = true } = {}) => {
const dispatch = useDispatch();
// 从 Redux 获取数据
@@ -122,12 +123,12 @@ export const useEventStocks = (eventId, eventTime, { autoLoad = true } = {}) =>
}
}, [eventId, autoLoad, loadAllData]); // 添加 loadAllData 依赖
// 自动加载行情数据
// 自动加载行情数据(可通过 autoLoadQuotes 参数控制)
useEffect(() => {
if (stocks.length > 0) {
if (stocks.length > 0 && autoLoadQuotes) {
refreshQuotes();
}
}, [stocks.length, eventId]); // 注意:这里不依赖 refreshQuotes避免重复请求
}, [stocks.length, eventId, autoLoadQuotes]); // 注意:这里不依赖 refreshQuotes避免重复请求
// 计算股票行情合并数据
const stocksWithQuotes = useMemo(() => {