Skip to content

Commit

Permalink
fix: 修改提交作业可以为空的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
konodioda727 committed Sep 12, 2023
1 parent f86e768 commit ad5cdff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/homework/pages/userMode/submit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down

0 comments on commit ad5cdff

Please sign in to comment.