diff --git a/src/views/ValueForum/index.js b/src/views/ValueForum/index.js index 12ceb034..e7521adc 100644 --- a/src/views/ValueForum/index.js +++ b/src/views/ValueForum/index.js @@ -16,7 +16,6 @@ import { InputGroup, InputLeftElement, Select, - Spinner, Center, useDisclosure, Flex, @@ -38,6 +37,7 @@ import PredictionTopicCard from './components/PredictionTopicCard'; import CreatePostModal from './components/CreatePostModal'; import CreatePredictionModal from './components/CreatePredictionModal'; import PredictionGuideModal from './components/PredictionGuideModal'; +import PageLoader from '@components/Loading/PageLoader'; const MotionBox = motion(Box); @@ -97,10 +97,15 @@ const ValueForum = () => { setLoading(true); const response = await getTopics({ status: 'active', sort_by: sortBy }); if (response.success) { - setPredictionTopics(response.data); + // 支持两种返回格式:直接数组或带分页的对象 + const topicsData = Array.isArray(response.data) + ? response.data + : (response.data?.topics || []); + setPredictionTopics(topicsData); } } catch (error) { console.error('获取预测话题失败:', error); + setPredictionTopics([]); } finally { setLoading(false); } @@ -153,8 +158,8 @@ const ValueForum = () => { pt="80px" pb="20" > - {/* padding 由 MainLayout 统一设置 */} - + {/* 内容区域 */} + {/* 顶部横幅 */} { {/* 普通帖子标签页 */} {loading && page === 1 ? ( -
- - - 加载中... - -
+ ) : posts.length === 0 ? (
@@ -420,17 +415,7 @@ const ValueForum = () => { {/* 预测市场标签页 */} {loading ? ( -
- - - 加载中... - -
+ ) : predictionTopics.length === 0 ? (