From ad5cdff89acc88e50cbc5e1157a619be021d1929 Mon Sep 17 00:00:00 2001 From: konokono <1845519693@qq.com> Date: Tue, 12 Sep 2023 17:33:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8F=AF=E4=BB=A5=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/homework/pages/userMode/submit/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/homework/pages/userMode/submit/index.tsx b/src/pages/homework/pages/userMode/submit/index.tsx index 00467ad..70a1e3b 100644 --- a/src/pages/homework/pages/userMode/submit/index.tsx +++ b/src/pages/homework/pages/userMode/submit/index.tsx @@ -55,19 +55,21 @@ const HomeworkUserSubmit: React.FC = () => { }, null); }, []); const handleSubmit = () => { - if (status != 2) + if (status != 2 && formData[0]) { post(`/task/submitted`, { urls: formData, assignedTaskID: selected, }) .then(() => { - if (formData[0]) message.success('提交成功').then(null, null); - else message.error('作业内容不能为空').then(null, null); + message.success('提交成功').then(null, null); handleSwitch(selected); }) .catch(() => { message.error(`提交失败`).then(null, null); }); + } else if (!formData[0]) { + message.error('作业内容不能为空').then(null, null); + } }; const handleChangeUpload = (e: UploadProps['fileList']) => { if (e && e[0]) {