Browse Source

修改已提交作业但不会提示覆盖问题

zengyicheng 2 years ago
parent
commit
6a8916f3f9
1 changed files with 30 additions and 15 deletions
  1. 30 15
      src/components/liveProjectDetail.vue

+ 30 - 15
src/components/liveProjectDetail.vue

@@ -339,7 +339,7 @@
               <div
                 class="nextStepOne"
                 style="float: right"
-                @click="addWork(4)"
+                @click="addJtWork(4)"
                 v-if="toolCount == 1 || toolCount == 3 || toolCount == 7"
               >
                 截图
@@ -985,6 +985,27 @@ export default {
           });
       }
     },
+    addJtWork(type) {
+      if (this.isNoHomeWork == true || this.isAnswer == true) {
+        this.$confirm(
+          "您已经提交了该作业了,如果您再提交将覆盖上次提交的作业!",
+          "提示",
+          {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          }
+        )
+          .then(() => {
+            this.getImg();
+            this.addSWork(type);
+          })
+          .catch(() => {});
+      } else {
+        this.getImg();
+        this.addSWork(type);
+      }
+    },
     addWork(type) {
       if (type == 5) {
         if (this.tkAnswer.length == 0) {
@@ -1011,16 +1032,10 @@ export default {
           }
         )
           .then(() => {
-            if (type == 4) {
-              this.getImg();
-            }
             this.addSWork(type);
           })
           .catch(() => {});
       } else {
-        if (type == 4) {
-          this.getImg();
-        }
         this.addSWork(type);
       }
     },
@@ -1075,15 +1090,15 @@ export default {
             if (res.data[0][0].type == 1) {
               this.isAnswer = true;
               this.typeC = JSON.parse(res.data[0][0].upload);
-            } else {
+            } else if (res.data[0][0].type == 5) {
               this.isNoHomeWork = true;
-              if (res.data[0][0].type == 5) {
-                this.tkAnswer = JSON.parse(res.data[0][0].upload);
-              } else if (res.data[0][0].type == 4) {
-                this.upload[0].url = res.data[0][0].upload;
-              } else if (res.data[0][0].type == 6) {
-                this.rateList = JSON.parse(res.data[0][0].upload);
-              }
+              this.tkAnswer = JSON.parse(res.data[0][0].upload);
+            } else if (res.data[0][0].type == 4) {
+              this.isNoHomeWork = true;
+              this.upload[0].url = res.data[0][0].upload;
+            } else if (res.data[0][0].type == 6) {
+              this.isNoHomeWork = true;
+              this.rateList = JSON.parse(res.data[0][0].upload);
             }
           }
         })