From 8f20efb98eff82590245140e0c950896214d8ad8 Mon Sep 17 00:00:00 2001 From: 1708-huayu <57060237+1708-huayu@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:28:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=90=9C=E7=B4=A2=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DetailForm/index.js | 38 ++++++++--- src/components/DetailSearchBar/index.js | 49 ++++++++++---- src/pages/DetailSearchContext/index.js | 88 +++++++++++++++++-------- src/pages/Home/index.js | 36 ++++++---- src/pages/ToDoList/index.js | 2 +- src/utils/requestUtil.js | 2 +- 6 files changed, 151 insertions(+), 64 deletions(-) diff --git a/src/components/DetailForm/index.js b/src/components/DetailForm/index.js index 80d30fb..cd54d05 100644 --- a/src/components/DetailForm/index.js +++ b/src/components/DetailForm/index.js @@ -14,13 +14,14 @@ import "./index.css" import {addTask} from "../../utils"; import {useNavigate, useOutletContext} from "react-router-dom"; export default () => { + // 设置标题栏 const {setTitle} = useOutletContext(); setTitle("添加任务") + // 路由 + const navigate = useNavigate(); + // 获取form引用 const [form] = Form.useForm(); const onFinish = (values) => { - // Dialog.alert({ - // content:
{JSON.stringify(values, null, 2)}, - // }) console.log("提交:",values) if (values.pidArray===undefined){ values.pid='0' @@ -28,9 +29,29 @@ export default () => { values.pid=values.pidArray[values.pidArray.length-1]; } addTask(values).then(values=>{ - Dialog.alert({ - content: '添加任务成功' + values.data, - onConfirm:()=>{} + Dialog.show({ + content: `添加任务${values.name}成功`, + closeOnAction:true, + actions: [ + [ + { + key: 'back', + text: '回到列表', + onClick:()=>{ + navigate("/home/listTask") + } + }, + { + key: 'create', + text: '创建下一条', + onClick:()=>{ + // 清空值 + form.resetFields(); + form.setFieldValue("pidArray",values.pidArray); + } + }, + ], + ], }) }) } @@ -65,11 +86,10 @@ export default () => {