Procházet zdrojové kódy

解决新增作业时可以啥也不填

chenjiayao před 1 rokem
rodič
revize
fea187aa07

+ 22 - 0
src/views/CourseSquare/component/CourseDetails/component/CourseHomeworkTable.vue

@@ -411,6 +411,28 @@ const openEditor = (url: string, title: string) => {
 
 
   const handleSubmit = async () => {
+
+    if(newAssignmentInfo.assignmentName === '') {
+      ElNotification({title: '作业名称不得为空',type: 'error',})
+      return
+    }
+    if(newAssignmentInfo.description === '') {
+      ElNotification({title: '作业描述不得为空',type: 'error',})
+      return
+    }
+
+    if(newAssignmentInfo.startTime === '') {
+      ElNotification({title: '开始时间不得为空',type: 'error',})
+      return
+    }
+    if(newAssignmentInfo.endTime === '') {
+      ElNotification({title: '结束时间不得为空',type: 'error',})
+      return
+    }
+    if(newAssignmentInfo.startTime >= newAssignmentInfo.endTime) {
+      ElNotification({title: '结束时间不得在起始时间之前',type: 'error',})
+      return
+    }
     // console.log("提交方法最开始",newAssignmentInfo)
     newAssignmentInfo.endTime = formatDate(newAssignmentInfo.endTime);
     newAssignmentInfo.startTime = formatDate(newAssignmentInfo.startTime);