From d014383b6913bcd440222a3ad1725306a74d22ee Mon Sep 17 00:00:00 2001 From: xiamuceer Date: Tue, 25 Nov 2025 19:34:03 +0800 Subject: [PATCH] =?UTF-8?q?update:1.=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E4=B8=96=E7=95=8C=E8=A7=82=E7=94=9F=E6=88=90=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90=E4=B8=96=E7=95=8C=E8=A7=82?= =?UTF-8?q?=E6=8C=89=E9=92=AE=202.=E9=A1=B9=E7=9B=AE=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E5=AD=97=E6=95=B0=E6=94=AF=E6=8C=81=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=9B=E5=BA=A6=E5=B1=95=E7=A4=BA=203.?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0=E5=88=9B=E5=BB=BA=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7user=5Fid=E8=BF=87=E9=95=BF=E5=AF=BC=E8=87=B4=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E9=A1=B9=E7=9B=AE=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/ProjectList.tsx | 125 +++++++++++++- frontend/src/pages/WorldSetting.tsx | 246 ++++++++++++++++++++++++++-- 2 files changed, 347 insertions(+), 24 deletions(-) diff --git a/frontend/src/pages/ProjectList.tsx b/frontend/src/pages/ProjectList.tsx index 097cffa..94546f9 100644 --- a/frontend/src/pages/ProjectList.tsx +++ b/frontend/src/pages/ProjectList.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import { Card, Button, Empty, Modal, message, Spin, Row, Col, Statistic, Space, Tag, Progress, Typography, Tooltip, Badge, Alert, Upload, Checkbox, Divider, Switch, Dropdown } from 'antd'; +import { Card, Button, Empty, Modal, message, Spin, Row, Col, Statistic, Space, Tag, Progress, Typography, Tooltip, Badge, Alert, Upload, Checkbox, Divider, Switch, Dropdown, Form, Input, InputNumber } from 'antd'; import { EditOutlined, DeleteOutlined, BookOutlined, RocketOutlined, CalendarOutlined, FileTextOutlined, TrophyOutlined, FireOutlined, SettingOutlined, InfoCircleOutlined, CloseOutlined, UploadOutlined, DownloadOutlined, ApiOutlined, MoreOutlined, BulbOutlined } from '@ant-design/icons'; import { projectApi } from '../services/api'; import { useStore } from '../store'; @@ -27,6 +27,10 @@ export default function ProjectList() { includeWritingStyles: true, includeGenerationHistory: true, }); + const [editModalVisible, setEditModalVisible] = useState(false); + const [editingProject, setEditingProject] = useState(null); + const [editForm] = Form.useForm(); + const [updating, setUpdating] = useState(false); const { refreshProjects, deleteProject } = useProjectSync(); @@ -72,6 +76,45 @@ export default function ProjectList() { }); }; + const handleEditProject = (project: any) => { + setEditingProject(project); + editForm.setFieldsValue({ + description: project.description || '', + target_words: project.target_words || 0, + }); + setEditModalVisible(true); + }; + + const handleCloseEditModal = () => { + setEditModalVisible(false); + setEditingProject(null); + editForm.resetFields(); + }; + + const handleUpdateProject = async () => { + try { + const values = await editForm.validateFields(); + setUpdating(true); + + await projectApi.updateProject(editingProject.id, { + description: values.description, + target_words: values.target_words, + }); + + message.success('项目更新成功'); + handleCloseEditModal(); + await refreshProjects(); + } catch (error: any) { + if (error.errorFields) { + message.error('请检查表单填写'); + } else { + message.error('更新失败,请重试'); + } + } finally { + setUpdating(false); + } + }; + const handleEnterProject = (id: string) => { // 简化后直接进入项目,不再检查向导状态 navigate(`/project/${id}`); @@ -783,15 +826,26 @@ export default function ProjectList() { {formatDate(project.updated_at)} + + + + + + {/* 可滚动内容区域 */} @@ -302,6 +417,101 @@ export default function WorldSetting() { + + {/* AI重新生成加载遮罩 */} + + + {/* 预览重新生成的内容模态框 */} + + {newWorldData && ( +
+
+ + ⚠️ 注意:点击"确认替换"将会用新内容替换当前的世界观设定 + +
+ +
+ + 时间设定 + + + {newWorldData.time_period} + +
+ +
+ + 地点设定 + + + {newWorldData.location} + +
+ +
+ + 氛围设定 + + + {newWorldData.atmosphere} + +
+ +
+ + 规则设定 + + + {newWorldData.rules} + +
+
+ )} +
); } \ No newline at end of file