事件中心的涨停原因里面和事件相关

This commit is contained in:
2026-01-11 14:04:07 +08:00
parent 5ee6fe54f1
commit 11c9e7b134
5 changed files with 69 additions and 1229 deletions

View File

@@ -3,7 +3,7 @@
* 展示预测市场的话题概览
*/
import React, { useMemo } from 'react';
import React, { useMemo, useState, useEffect } from 'react';
import {
Box,
Text,
@@ -51,12 +51,20 @@ const PredictionTopicCard = ({ topic }) => {
};
// 计算实际状态(基于截止时间自动判断)
const effectiveStatus = useMemo(() => {
const [effectiveStatus, setEffectiveStatus] = useState(topic.status);
useEffect(() => {
// 如果已经是结算状态,保持不变
if (topic.status === 'settled') return 'settled';
if (topic.status === 'settled') {
setEffectiveStatus('settled');
return;
}
// 如果已过截止时间,自动变为已截止
if (timeLeft.expired && topic.status === 'active') return 'trading_closed';
return topic.status;
if (timeLeft.expired && topic.status === 'active') {
setEffectiveStatus('trading_closed');
return;
}
setEffectiveStatus(topic.status);
}, [topic.status, timeLeft.expired]);
// 获取选项数据