2026-03-06 14:14:57 +08:00
|
|
|
|
import { Modal, Button, Space, theme } from 'antd';
|
2025-11-06 12:36:32 +08:00
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
|
|
|
|
|
|
|
|
interface AnnouncementModalProps {
|
|
|
|
|
|
visible: boolean;
|
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
|
onDoNotShowToday: () => void;
|
2025-11-27 17:29:23 +08:00
|
|
|
|
onNeverShow: () => void;
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-27 17:29:23 +08:00
|
|
|
|
export default function AnnouncementModal({ visible, onClose, onDoNotShowToday, onNeverShow }: AnnouncementModalProps) {
|
|
|
|
|
|
const [qqImageError, setQqImageError] = useState(false);
|
|
|
|
|
|
const [wxImageError, setWxImageError] = useState(false);
|
2026-03-06 14:14:57 +08:00
|
|
|
|
const { token } = theme.useToken();
|
|
|
|
|
|
const alphaColor = (color: string, alpha: number) => `color-mix(in srgb, ${color} ${(alpha * 100).toFixed(0)}%, transparent)`;
|
2025-11-06 12:36:32 +08:00
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (visible) {
|
2025-11-27 17:29:23 +08:00
|
|
|
|
setQqImageError(false);
|
|
|
|
|
|
setWxImageError(false);
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}, [visible]);
|
|
|
|
|
|
|
|
|
|
|
|
const handleDoNotShowToday = () => {
|
|
|
|
|
|
onDoNotShowToday();
|
|
|
|
|
|
onClose();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-11-27 17:29:23 +08:00
|
|
|
|
const handleNeverShow = () => {
|
|
|
|
|
|
onNeverShow();
|
|
|
|
|
|
onClose();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-11-06 12:36:32 +08:00
|
|
|
|
return (
|
|
|
|
|
|
<Modal
|
2025-12-12 13:45:27 +08:00
|
|
|
|
title={
|
|
|
|
|
|
<div style={{
|
|
|
|
|
|
fontSize: '20px',
|
|
|
|
|
|
fontWeight: 600,
|
2026-03-06 14:14:57 +08:00
|
|
|
|
color: token.colorPrimary,
|
2025-12-12 13:45:27 +08:00
|
|
|
|
textAlign: 'center',
|
|
|
|
|
|
}}>
|
|
|
|
|
|
🎉 欢迎使用 AI小说创作助手
|
|
|
|
|
|
</div>
|
|
|
|
|
|
}
|
2025-11-06 12:36:32 +08:00
|
|
|
|
open={visible}
|
|
|
|
|
|
onCancel={onClose}
|
|
|
|
|
|
footer={
|
|
|
|
|
|
<Space style={{ width: '100%', justifyContent: 'center' }}>
|
2025-12-12 13:45:27 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
onClick={handleDoNotShowToday}
|
|
|
|
|
|
size="large"
|
|
|
|
|
|
style={{
|
|
|
|
|
|
borderRadius: '8px',
|
|
|
|
|
|
height: '40px',
|
|
|
|
|
|
fontSize: '14px',
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
今日内不再展示
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</Button>
|
2025-12-12 13:45:27 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
onClick={handleNeverShow}
|
|
|
|
|
|
size="large"
|
|
|
|
|
|
style={{
|
|
|
|
|
|
borderRadius: '8px',
|
|
|
|
|
|
height: '40px',
|
|
|
|
|
|
fontSize: '14px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorPrimary,
|
|
|
|
|
|
borderColor: token.colorPrimary,
|
|
|
|
|
|
boxShadow: `0 8px 20px ${alphaColor(token.colorPrimary, 0.32)}`,
|
2025-12-12 13:45:27 +08:00
|
|
|
|
}}
|
|
|
|
|
|
>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
永不再展示
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
}
|
2026-01-14 14:33:43 +08:00
|
|
|
|
width={700}
|
2025-11-06 12:36:32 +08:00
|
|
|
|
centered
|
|
|
|
|
|
styles={{
|
|
|
|
|
|
body: {
|
2026-01-14 14:33:43 +08:00
|
|
|
|
padding: '20px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorBgContainer,
|
2025-12-12 13:45:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
header: {
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: `linear-gradient(135deg, ${alphaColor(token.colorPrimary, 0.1)} 0%, ${alphaColor(token.colorBgContainer, 0.98)} 100%)`,
|
|
|
|
|
|
borderBottom: `1px solid ${token.colorBorderSecondary}`,
|
2026-01-14 14:33:43 +08:00
|
|
|
|
padding: '16px 24px',
|
2025-12-12 13:45:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
footer: {
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorBgContainer,
|
|
|
|
|
|
borderTop: `1px solid ${token.colorBorderSecondary}`,
|
2025-12-12 13:45:27 +08:00
|
|
|
|
padding: '16px 24px',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
},
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
<div style={{ textAlign: 'center' }}>
|
|
|
|
|
|
<div style={{
|
2026-01-14 14:33:43 +08:00
|
|
|
|
marginBottom: '12px',
|
|
|
|
|
|
fontSize: '15px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
color: token.colorTextSecondary,
|
2026-01-14 14:33:43 +08:00
|
|
|
|
lineHeight: '1.5',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}}>
|
2026-01-14 14:33:43 +08:00
|
|
|
|
<p style={{ marginBottom: '8px' }}>👋 欢迎加入我们的交流群!在这里你可以:</p>
|
2025-11-06 12:36:32 +08:00
|
|
|
|
<ul style={{
|
|
|
|
|
|
textAlign: 'left',
|
|
|
|
|
|
marginLeft: '40px',
|
2026-01-14 14:33:43 +08:00
|
|
|
|
marginTop: '0',
|
|
|
|
|
|
marginBottom: '12px',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}}>
|
|
|
|
|
|
<li>💬 与其他创作者交流心得</li>
|
|
|
|
|
|
<li>💡 获取最新功能更新和使用技巧</li>
|
|
|
|
|
|
<li>🐛 反馈问题和建议</li>
|
|
|
|
|
|
<li>📚 分享创作经验和灵感</li>
|
|
|
|
|
|
</ul>
|
2026-03-06 14:14:57 +08:00
|
|
|
|
<p style={{ fontWeight: 600, color: token.colorText, marginBottom: '12px' }}>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
扫描下方二维码加入交流群:
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
2025-12-11 17:01:25 +08:00
|
|
|
|
|
2025-11-27 17:29:23 +08:00
|
|
|
|
<div style={{
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'flex-start',
|
|
|
|
|
|
gap: '24px',
|
2026-01-14 14:33:43 +08:00
|
|
|
|
padding: '16px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorBgLayout,
|
2025-11-27 17:29:23 +08:00
|
|
|
|
borderRadius: '8px',
|
|
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
|
|
}}>
|
|
|
|
|
|
{/* QQ 二维码 */}
|
2025-11-06 12:36:32 +08:00
|
|
|
|
<div style={{
|
|
|
|
|
|
display: 'flex',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
flexDirection: 'column',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
alignItems: 'center',
|
2026-01-14 14:33:43 +08:00
|
|
|
|
minWidth: '200px',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}}>
|
2026-03-06 14:14:57 +08:00
|
|
|
|
<p style={{ fontWeight: 600, color: token.colorText, marginBottom: '8px', fontSize: '14px' }}>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
QQ交流群
|
|
|
|
|
|
</p>
|
|
|
|
|
|
{!qqImageError ? (
|
|
|
|
|
|
<div style={{
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'center',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorBgContainer,
|
2025-11-06 12:36:32 +08:00
|
|
|
|
borderRadius: '8px',
|
2026-01-14 14:33:43 +08:00
|
|
|
|
padding: '6px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
boxShadow: `0 2px 8px ${alphaColor(token.colorText, 0.12)}`,
|
2025-11-27 17:29:23 +08:00
|
|
|
|
}}>
|
|
|
|
|
|
<img
|
|
|
|
|
|
src="/qq.jpg"
|
|
|
|
|
|
alt="QQ交流群二维码"
|
|
|
|
|
|
style={{
|
2026-01-14 14:33:43 +08:00
|
|
|
|
maxWidth: '180px',
|
|
|
|
|
|
maxHeight: '180px',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
width: 'auto',
|
|
|
|
|
|
height: 'auto',
|
|
|
|
|
|
display: 'block',
|
|
|
|
|
|
objectFit: 'contain',
|
|
|
|
|
|
}}
|
|
|
|
|
|
onError={() => setQqImageError(true)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div style={{
|
2026-01-14 14:33:43 +08:00
|
|
|
|
width: '180px',
|
|
|
|
|
|
height: '180px',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'center',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorBgContainer,
|
2025-11-27 17:29:23 +08:00
|
|
|
|
borderRadius: '8px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
color: token.colorTextTertiary,
|
2025-11-27 17:29:23 +08:00
|
|
|
|
}}>
|
|
|
|
|
|
<p>二维码加载失败</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</div>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
|
|
|
|
|
|
{/* 微信二维码 */}
|
2025-11-06 12:36:32 +08:00
|
|
|
|
<div style={{
|
2025-11-27 17:29:23 +08:00
|
|
|
|
display: 'flex',
|
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
|
alignItems: 'center',
|
2026-01-14 14:33:43 +08:00
|
|
|
|
minWidth: '200px',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}}>
|
2026-03-06 14:14:57 +08:00
|
|
|
|
<p style={{ fontWeight: 600, color: token.colorText, marginBottom: '8px', fontSize: '14px' }}>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
微信交流群
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</p>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
{!wxImageError ? (
|
|
|
|
|
|
<div style={{
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'center',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorBgContainer,
|
2025-11-27 17:29:23 +08:00
|
|
|
|
borderRadius: '8px',
|
2026-01-14 14:33:43 +08:00
|
|
|
|
padding: '6px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
boxShadow: `0 2px 8px ${alphaColor(token.colorText, 0.12)}`,
|
2025-11-27 17:29:23 +08:00
|
|
|
|
}}>
|
|
|
|
|
|
<img
|
|
|
|
|
|
src="/WX.png"
|
|
|
|
|
|
alt="微信交流群二维码"
|
|
|
|
|
|
style={{
|
2026-01-14 14:33:43 +08:00
|
|
|
|
maxWidth: '180px',
|
|
|
|
|
|
maxHeight: '180px',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
width: 'auto',
|
|
|
|
|
|
height: 'auto',
|
|
|
|
|
|
display: 'block',
|
|
|
|
|
|
objectFit: 'contain',
|
|
|
|
|
|
}}
|
|
|
|
|
|
onError={() => setWxImageError(true)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div style={{
|
2026-01-14 14:33:43 +08:00
|
|
|
|
width: '180px',
|
|
|
|
|
|
height: '180px',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'center',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorBgContainer,
|
2025-11-27 17:29:23 +08:00
|
|
|
|
borderRadius: '8px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
color: token.colorTextTertiary,
|
2025-11-27 17:29:23 +08:00
|
|
|
|
}}>
|
|
|
|
|
|
<p>二维码加载失败</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</div>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
</div>
|
2025-12-11 17:01:25 +08:00
|
|
|
|
|
2025-11-06 12:36:32 +08:00
|
|
|
|
<div style={{
|
2026-01-14 14:33:43 +08:00
|
|
|
|
marginTop: '16px',
|
|
|
|
|
|
padding: '10px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
background: token.colorWarningBg,
|
2025-11-06 12:36:32 +08:00
|
|
|
|
borderRadius: '8px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
border: `1px solid ${token.colorWarningBorder}`,
|
2026-01-14 14:33:43 +08:00
|
|
|
|
fontSize: '13px',
|
2026-03-06 14:14:57 +08:00
|
|
|
|
color: token.colorWarning,
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}}>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
💡 提示:选择"今日内不再展示"当天不再显示,选择"永不再展示"将永久隐藏此公告
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Modal>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|