From 19665e9938a4e5635705fd59fee11f2d924bc244 Mon Sep 17 00:00:00 2001 From: xiamuceer Date: Tue, 30 Dec 2025 10:05:34 +0800 Subject: [PATCH] =?UTF-8?q?style:=E6=9B=B4=E6=96=B0=E6=89=80=E6=9C=89Modal?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=A0=B7=E5=BC=8F=E4=BD=BF=E7=94=A8=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ChapterContentComparison.tsx | 11 ++++++++--- frontend/src/components/ChapterRegenerationModal.tsx | 11 ++++++++--- frontend/src/components/CharacterCareerCard.tsx | 5 ++++- frontend/src/pages/Careers.tsx | 11 ++++++++--- frontend/src/pages/MCPPlugins.tsx | 3 ++- frontend/src/pages/Relationships.tsx | 12 ++++++++---- frontend/src/pages/Settings.tsx | 6 ++++-- 7 files changed, 42 insertions(+), 17 deletions(-) diff --git a/frontend/src/components/ChapterContentComparison.tsx b/frontend/src/components/ChapterContentComparison.tsx index 1129d9a..db87187 100644 --- a/frontend/src/components/ChapterContentComparison.tsx +++ b/frontend/src/components/ChapterContentComparison.tsx @@ -28,6 +28,7 @@ const ChapterContentComparison: React.FC = ({ }) => { const [applying, setApplying] = useState(false); const [viewMode, setViewMode] = useState<'split' | 'unified'>('split'); + const [modal, contextHolder] = Modal.useModal(); const originalWordCount = originalContent.length; const wordCountDiff = wordCount - originalWordCount; @@ -85,9 +86,10 @@ const ChapterContentComparison: React.FC = ({ }; const handleDiscard = () => { - Modal.confirm({ + modal.confirm({ title: '确认放弃', content: '确定要放弃新生成的内容吗?此操作不可恢复。', + centered: true, okText: '确定放弃', cancelText: '取消', okButtonProps: { danger: true }, @@ -100,7 +102,9 @@ const ChapterContentComparison: React.FC = ({ }; return ( - + {contextHolder} + = ({ }} /> - + + ); }; diff --git a/frontend/src/components/ChapterRegenerationModal.tsx b/frontend/src/components/ChapterRegenerationModal.tsx index 560906f..a861142 100644 --- a/frontend/src/components/ChapterRegenerationModal.tsx +++ b/frontend/src/components/ChapterRegenerationModal.tsx @@ -55,6 +55,7 @@ const ChapterRegenerationModal: React.FC = ({ hasAnalysis }) => { const [form] = Form.useForm(); + const [modal, contextHolder] = Modal.useModal(); const [loading, setLoading] = useState(false); const [progress, setProgress] = useState(0); const [status, setStatus] = useState<'idle' | 'generating' | 'success' | 'error'>('idle'); @@ -202,9 +203,10 @@ const ChapterRegenerationModal: React.FC = ({ const handleCancel = () => { if (loading) { - Modal.confirm({ + modal.confirm({ title: '确认取消', content: '生成正在进行中,确定要取消吗?', + centered: true, onOk: () => { setLoading(false); setStatus('idle'); @@ -217,7 +219,9 @@ const ChapterRegenerationModal: React.FC = ({ }; return ( - + {contextHolder} + = ({ message={`正在重新生成中... (已生成 ${wordCount} 字)`} title="重新生成章节" /> - + + ); }; diff --git a/frontend/src/components/CharacterCareerCard.tsx b/frontend/src/components/CharacterCareerCard.tsx index 7fb11af..25099a8 100644 --- a/frontend/src/components/CharacterCareerCard.tsx +++ b/frontend/src/components/CharacterCareerCard.tsx @@ -57,6 +57,7 @@ export const CharacterCareerCard: React.FC = ({ const [mainForm] = Form.useForm(); const [subForm] = Form.useForm(); const [progressForm] = Form.useForm(); + const [modal, contextHolder] = Modal.useModal(); useEffect(() => { fetchCharacterCareers(); @@ -149,9 +150,10 @@ export const CharacterCareerCard: React.FC = ({ }; const handleRemoveSubCareer = (careerId: string) => { - Modal.confirm({ + modal.confirm({ title: '确认删除', content: '确定要移除这个副职业吗?', + centered: true, onOk: async () => { try { await axios.delete( @@ -237,6 +239,7 @@ export const CharacterCareerCard: React.FC = ({ return ( <> + {contextHolder} diff --git a/frontend/src/pages/Careers.tsx b/frontend/src/pages/Careers.tsx index af0ea61..9ee22c5 100644 --- a/frontend/src/pages/Careers.tsx +++ b/frontend/src/pages/Careers.tsx @@ -39,6 +39,7 @@ export default function Careers() { const [editingCareer, setEditingCareer] = useState(null); const [form] = Form.useForm(); const [aiForm] = Form.useForm(); + const [modal, contextHolder] = Modal.useModal(); // AI生成状态 const [aiGenerating, setAiGenerating] = useState(false); @@ -129,9 +130,10 @@ export default function Careers() { }; const handleDelete = async (id: string) => { - Modal.confirm({ + modal.confirm({ title: '确认删除', content: '确定要删除这个职业吗?如果有角色使用了该职业,将无法删除。', + centered: true, onOk: async () => { try { await api.delete(`/careers/${id}`); @@ -264,7 +266,9 @@ export default function Careers() { ]; return ( -
+ {contextHolder} +
setAiGenerating(false)} /> -
+
+ ); } \ No newline at end of file diff --git a/frontend/src/pages/MCPPlugins.tsx b/frontend/src/pages/MCPPlugins.tsx index 642bc35..56a6a9b 100644 --- a/frontend/src/pages/MCPPlugins.tsx +++ b/frontend/src/pages/MCPPlugins.tsx @@ -113,9 +113,10 @@ export default function MCPPluginsPage() { }; const handleDelete = (plugin: MCPPlugin) => { - Modal.confirm({ + modal.confirm({ title: '删除插件', content: `确定要删除插件 "${plugin.display_name || plugin.plugin_name}" 吗?`, + centered: true, okText: '确定', cancelText: '取消', okType: 'danger', diff --git a/frontend/src/pages/Relationships.tsx b/frontend/src/pages/Relationships.tsx index ea09f9b..2e42ee4 100644 --- a/frontend/src/pages/Relationships.tsx +++ b/frontend/src/pages/Relationships.tsx @@ -43,6 +43,7 @@ export default function Relationships() { const [isEditMode, setIsEditMode] = useState(false); const [editingRelationship, setEditingRelationship] = useState(null); const [form] = Form.useForm(); + const [modal, contextHolder] = Modal.useModal(); const [isMobile, setIsMobile] = useState(window.innerWidth <= 768); const [pageSize, setPageSize] = useState(10); const [currentPage, setCurrentPage] = useState(1); @@ -149,7 +150,7 @@ export default function Relationships() { }; const handleDeleteRelationship = async (id: string) => { - Modal.confirm({ + modal.confirm({ title: '确认删除', content: '确定要删除这条关系吗?', centered: true, @@ -304,8 +305,10 @@ export default function Relationships() { }; return ( -
- + {contextHolder} +
+ @@ -522,6 +525,7 @@ export default function Relationships() { -
+
+ ); } \ No newline at end of file diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx index 69ceef7..6485d29 100644 --- a/frontend/src/pages/Settings.tsx +++ b/frontend/src/pages/Settings.tsx @@ -107,9 +107,10 @@ export default function SettingsPage() { }; const handleReset = () => { - Modal.confirm({ + modal.confirm({ title: '重置设置', content: '确定要重置为默认值吗?', + centered: true, okText: '确定', cancelText: '取消', onOk: () => { @@ -127,9 +128,10 @@ export default function SettingsPage() { }; const handleDelete = () => { - Modal.confirm({ + modal.confirm({ title: '删除设置', content: '确定要删除所有设置吗?此操作不可恢复。', + centered: true, okText: '确定', cancelText: '取消', okType: 'danger',