fix: 事件详情唔错页面UI调整

This commit is contained in:
zdl
2025-12-04 19:45:21 +08:00
parent 1d5d06c567
commit 7c1fe55a5f
2 changed files with 148 additions and 34 deletions

View File

@@ -7,19 +7,14 @@ import React, { useState, useEffect } from 'react';
import { useParams, useSearchParams } from 'react-router-dom';
import {
Box,
Container,
Spinner,
Center,
Alert,
AlertIcon,
AlertTitle,
AlertDescription,
Text,
} from '@chakra-ui/react';
import { decodeEventId } from '@/utils/idEncoder';
import { eventService } from '@/services/eventService';
import { DynamicNewsDetailPanel } from '@/views/Community/components/DynamicNewsDetail';
import { logger } from '@/utils/logger';
import ErrorPage from '@/components/ErrorPage';
const EventDetail = () => {
const { eventId: pathEventId } = useParams();
@@ -71,35 +66,16 @@ const EventDetail = () => {
}
// 错误状态
if (error) {
if (!error) {
return (
<Box minH="100vh" w="100%" p={4}>
<Container maxW="7xl" py={8}>
<Center minH="60vh">
<Alert
status="error"
borderRadius="lg"
maxW="md"
flexDirection="column"
textAlign="center"
p={6}
>
<AlertIcon boxSize="40px" mr={0} />
<AlertTitle mt={4} mb={2} fontSize="lg">
加载失败
</AlertTitle>
<AlertDescription maxWidth="sm">
{error}
{eventId && (
<Text mt={2} fontSize="sm" color="gray.500">
事件ID: {eventId}
</Text>
)}
</AlertDescription>
</Alert>
</Center>
</Container>
</Box>
<ErrorPage
title="页面找不到了"
description={error}
detail={eventId}
detailLabel="事件ID"
showRetry
onRetry={() => window.location.reload()}
/>
);
}