2025-10-30 11:14:43 +08:00
|
|
|
import React from 'react';
|
2026-03-06 14:14:57 +08:00
|
|
|
import { Spin, theme } from 'antd';
|
2025-10-30 11:14:43 +08:00
|
|
|
import { LoadingOutlined } from '@ant-design/icons';
|
|
|
|
|
|
|
|
|
|
interface SSELoadingOverlayProps {
|
|
|
|
|
loading: boolean;
|
|
|
|
|
progress: number;
|
|
|
|
|
message: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const SSELoadingOverlay: React.FC<SSELoadingOverlayProps> = ({
|
|
|
|
|
loading,
|
|
|
|
|
progress,
|
|
|
|
|
message
|
|
|
|
|
}) => {
|
2026-03-06 14:14:57 +08:00
|
|
|
const { token } = theme.useToken();
|
|
|
|
|
|
2025-10-30 11:14:43 +08:00
|
|
|
if (!loading) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div style={{
|
|
|
|
|
position: 'fixed',
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0,
|
|
|
|
|
right: 0,
|
|
|
|
|
bottom: 0,
|
2026-03-06 14:14:57 +08:00
|
|
|
background: token.colorBgMask,
|
2025-10-30 11:14:43 +08:00
|
|
|
display: 'flex',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
zIndex: 9999
|
|
|
|
|
}}>
|
|
|
|
|
<div style={{
|
2026-03-06 14:14:57 +08:00
|
|
|
background: token.colorBgElevated,
|
2025-10-30 11:14:43 +08:00
|
|
|
borderRadius: 12,
|
|
|
|
|
padding: '40px 60px',
|
|
|
|
|
minWidth: 400,
|
|
|
|
|
maxWidth: 600,
|
2026-03-06 14:14:57 +08:00
|
|
|
boxShadow: token.boxShadowSecondary
|
2025-10-30 11:14:43 +08:00
|
|
|
}}>
|
|
|
|
|
{/* 标题和图标 */}
|
|
|
|
|
<div style={{
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
marginBottom: 24
|
|
|
|
|
}}>
|
2025-12-11 17:01:25 +08:00
|
|
|
<Spin
|
2026-03-06 14:14:57 +08:00
|
|
|
indicator={<LoadingOutlined style={{ fontSize: 48, color: token.colorPrimary }} spin />}
|
2025-10-30 11:14:43 +08:00
|
|
|
/>
|
|
|
|
|
<div style={{
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
fontWeight: 'bold',
|
|
|
|
|
marginTop: 16,
|
2026-03-06 14:14:57 +08:00
|
|
|
color: token.colorTextHeading
|
2025-10-30 11:14:43 +08:00
|
|
|
}}>
|
|
|
|
|
AI生成中...
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 进度条 */}
|
|
|
|
|
<div style={{
|
|
|
|
|
marginBottom: 16
|
|
|
|
|
}}>
|
|
|
|
|
<div style={{
|
|
|
|
|
height: 12,
|
2026-03-06 14:14:57 +08:00
|
|
|
background: token.colorFillTertiary,
|
2025-10-30 11:14:43 +08:00
|
|
|
borderRadius: 6,
|
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
marginBottom: 12
|
|
|
|
|
}}>
|
|
|
|
|
<div style={{
|
|
|
|
|
height: '100%',
|
2025-12-11 17:01:25 +08:00
|
|
|
background: progress === 100
|
2026-03-06 14:14:57 +08:00
|
|
|
? `linear-gradient(90deg, ${token.colorSuccess} 0%, ${token.colorSuccessActive} 100%)`
|
|
|
|
|
: `linear-gradient(90deg, ${token.colorPrimary} 0%, ${token.colorPrimaryActive} 100%)`,
|
2025-10-30 11:14:43 +08:00
|
|
|
width: `${progress}%`,
|
|
|
|
|
transition: 'all 0.3s ease',
|
|
|
|
|
borderRadius: 6,
|
2026-03-06 14:14:57 +08:00
|
|
|
boxShadow: progress > 0 ? token.boxShadow : 'none'
|
2025-10-30 11:14:43 +08:00
|
|
|
}} />
|
|
|
|
|
</div>
|
2025-12-11 17:01:25 +08:00
|
|
|
|
2025-10-30 11:14:43 +08:00
|
|
|
{/* 进度百分比 */}
|
|
|
|
|
<div style={{
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
fontSize: 32,
|
|
|
|
|
fontWeight: 'bold',
|
2026-03-06 14:14:57 +08:00
|
|
|
color: progress === 100 ? token.colorSuccess : token.colorPrimary,
|
2025-10-30 11:14:43 +08:00
|
|
|
marginBottom: 8
|
|
|
|
|
}}>
|
|
|
|
|
{progress}%
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 状态消息 */}
|
|
|
|
|
<div style={{
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
fontSize: 16,
|
2026-03-06 14:14:57 +08:00
|
|
|
color: token.colorText,
|
2025-10-30 11:14:43 +08:00
|
|
|
minHeight: 24,
|
|
|
|
|
padding: '0 20px'
|
|
|
|
|
}}>
|
|
|
|
|
{message || '准备生成...'}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 提示文字 */}
|
|
|
|
|
<div style={{
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
fontSize: 13,
|
2026-03-06 14:14:57 +08:00
|
|
|
color: token.colorTextTertiary,
|
2025-10-30 11:14:43 +08:00
|
|
|
marginTop: 16
|
|
|
|
|
}}>
|
|
|
|
|
请勿关闭页面,生成过程需要一定时间
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|