2025-11-06 12:36:32 +08:00
|
|
|
|
import { Modal, Button, Space } from 'antd';
|
|
|
|
|
|
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);
|
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
|
|
|
|
|
|
title="🎉 欢迎使用 AI小说创作助手"
|
|
|
|
|
|
open={visible}
|
|
|
|
|
|
onCancel={onClose}
|
|
|
|
|
|
footer={
|
|
|
|
|
|
<Space style={{ width: '100%', justifyContent: 'center' }}>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
<Button onClick={handleDoNotShowToday} size="large">
|
|
|
|
|
|
今日内不再展示
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</Button>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
<Button type="primary" onClick={handleNeverShow} size="large">
|
|
|
|
|
|
永不再展示
|
2025-11-06 12:36:32 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
}
|
2025-11-27 17:29:23 +08:00
|
|
|
|
width={800}
|
2025-11-06 12:36:32 +08:00
|
|
|
|
centered
|
|
|
|
|
|
styles={{
|
|
|
|
|
|
body: {
|
|
|
|
|
|
padding: '24px',
|
|
|
|
|
|
},
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
<div style={{ textAlign: 'center' }}>
|
|
|
|
|
|
<div style={{
|
|
|
|
|
|
marginBottom: '16px',
|
|
|
|
|
|
fontSize: '16px',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
color: 'var(--color-text-secondary)',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
lineHeight: '1.6',
|
|
|
|
|
|
}}>
|
|
|
|
|
|
<p>👋 欢迎加入我们的交流群!</p>
|
|
|
|
|
|
<p>在这里你可以:</p>
|
|
|
|
|
|
<ul style={{
|
|
|
|
|
|
textAlign: 'left',
|
|
|
|
|
|
marginLeft: '40px',
|
|
|
|
|
|
marginTop: '12px',
|
|
|
|
|
|
marginBottom: '20px',
|
|
|
|
|
|
}}>
|
|
|
|
|
|
<li>💬 与其他创作者交流心得</li>
|
|
|
|
|
|
<li>💡 获取最新功能更新和使用技巧</li>
|
|
|
|
|
|
<li>🐛 反馈问题和建议</li>
|
|
|
|
|
|
<li>📚 分享创作经验和灵感</li>
|
|
|
|
|
|
</ul>
|
2025-12-11 17:01:25 +08:00
|
|
|
|
<p style={{ fontWeight: 600, color: 'var(--color-text-primary)', marginBottom: '16px' }}>
|
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',
|
|
|
|
|
|
padding: '20px',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
background: 'var(--color-bg-layout)',
|
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',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
minWidth: '280px',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}}>
|
2025-12-11 17:01:25 +08:00
|
|
|
|
<p style={{ fontWeight: 600, color: 'var(--color-text-primary)', marginBottom: '12px', fontSize: '15px' }}>
|
2025-11-27 17:29:23 +08:00
|
|
|
|
QQ交流群
|
|
|
|
|
|
</p>
|
|
|
|
|
|
{!qqImageError ? (
|
|
|
|
|
|
<div style={{
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'center',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
background: 'var(--color-bg-container)',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
borderRadius: '8px',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
padding: '8px',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
}}>
|
|
|
|
|
|
<img
|
|
|
|
|
|
src="/qq.jpg"
|
|
|
|
|
|
alt="QQ交流群二维码"
|
|
|
|
|
|
style={{
|
|
|
|
|
|
maxWidth: '280px',
|
|
|
|
|
|
maxHeight: '280px',
|
|
|
|
|
|
width: 'auto',
|
|
|
|
|
|
height: 'auto',
|
|
|
|
|
|
display: 'block',
|
|
|
|
|
|
objectFit: 'contain',
|
|
|
|
|
|
}}
|
|
|
|
|
|
onError={() => setQqImageError(true)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div style={{
|
|
|
|
|
|
width: '280px',
|
|
|
|
|
|
height: '280px',
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'center',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
background: 'var(--color-bg-container)',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
borderRadius: '8px',
|
|
|
|
|
|
color: '#999',
|
|
|
|
|
|
}}>
|
|
|
|
|
|
<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',
|
|
|
|
|
|
minWidth: '280px',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
}}>
|
2025-12-11 17:01:25 +08:00
|
|
|
|
<p style={{ fontWeight: 600, color: 'var(--color-text-primary)', marginBottom: '12px', fontSize: '15px' }}>
|
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',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
background: 'var(--color-bg-container)',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
borderRadius: '8px',
|
|
|
|
|
|
padding: '8px',
|
|
|
|
|
|
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
|
|
|
|
|
|
}}>
|
|
|
|
|
|
<img
|
|
|
|
|
|
src="/WX.png"
|
|
|
|
|
|
alt="微信交流群二维码"
|
|
|
|
|
|
style={{
|
|
|
|
|
|
maxWidth: '280px',
|
|
|
|
|
|
maxHeight: '280px',
|
|
|
|
|
|
width: 'auto',
|
|
|
|
|
|
height: 'auto',
|
|
|
|
|
|
display: 'block',
|
|
|
|
|
|
objectFit: 'contain',
|
|
|
|
|
|
}}
|
|
|
|
|
|
onError={() => setWxImageError(true)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div style={{
|
|
|
|
|
|
width: '280px',
|
|
|
|
|
|
height: '280px',
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
|
alignItems: 'center',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
background: 'var(--color-bg-container)',
|
2025-11-27 17:29:23 +08:00
|
|
|
|
borderRadius: '8px',
|
|
|
|
|
|
color: '#999',
|
|
|
|
|
|
}}>
|
|
|
|
|
|
<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={{
|
|
|
|
|
|
marginTop: '20px',
|
|
|
|
|
|
padding: '12px',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
background: 'var(--color-warning-bg)',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
borderRadius: '8px',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
border: '1px solid var(--color-warning-border)',
|
2025-11-06 12:36:32 +08:00
|
|
|
|
fontSize: '14px',
|
2025-12-11 17:01:25 +08:00
|
|
|
|
color: 'var(--color-warning)',
|
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>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|