xiatian 2 жил өмнө
parent
commit
5a9bc0601f

+ 20 - 33
src/modules/questions/views/BluePaperStructure.vue

@@ -249,28 +249,20 @@ export default {
         confirmButtonText: "确定",
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         cancelButtonText: "取消",
         type: "error",
         type: "error",
-      }).then(() => {
-        this.loading = true;
-        var url = QUESTION_API + "/paperStruct/" + this.selectedIds;
-        this.$http
-          .delete(url)
-          .then(() => {
+      })
+        .then(() => {
+          this.loading = true;
+          var url = QUESTION_API + "/paperStruct/" + this.selectedIds;
+          this.$httpWithMsg.delete(url).then(() => {
             this.$notify({
             this.$notify({
               type: "success",
               type: "success",
               message: "删除成功!",
               message: "删除成功!",
             });
             });
             this.searchAll();
             this.searchAll();
             this.selectedList = [];
             this.selectedList = [];
-          })
-          .catch(() => {
-            this.$notify({
-              type: "error",
-              message: "删除失败!",
-            });
-            this.selectedList = [];
           });
           });
-      });
-      this.loading = false;
+        })
+        .finally(() => (this.loading = false));
     },
     },
     //得到难度
     //得到难度
     getDifficulty(val) {
     getDifficulty(val) {
@@ -309,25 +301,20 @@ export default {
     deleteStruct(row) {
     deleteStruct(row) {
       this.$confirm("是否删除试卷结构?", "提示", {
       this.$confirm("是否删除试卷结构?", "提示", {
         type: "warning",
         type: "warning",
-      }).then(() => {
-        this.loading = true;
-        this.$http
-          .delete(QUESTION_API + "/paperStruct/" + row.id)
-          .then(() => {
-            this.$notify({
-              message: "删除成功",
-              type: "success",
+      })
+        .then(() => {
+          this.loading = true;
+          this.$httpWithMsg
+            .delete(QUESTION_API + "/paperStruct/" + row.id)
+            .then(() => {
+              this.$notify({
+                message: "删除成功",
+                type: "success",
+              });
+              this.searchAll();
             });
             });
-            this.searchAll();
-          })
-          .catch(() => {
-            this.$notify({
-              type: "error",
-              message: "删除失败",
-            });
-          });
-      });
-      this.loading = false;
+        })
+        .finally(() => (this.loading = false));
     },
     },
     //清理缓存试卷结构
     //清理缓存试卷结构
     removeItem() {
     removeItem() {

+ 17 - 39
src/modules/questions/views/EditPaper.vue

@@ -1671,22 +1671,11 @@ export default {
                 "/" +
                 "/" +
                 this.quesModel.id
                 this.quesModel.id
             )
             )
-            .then((response) => {
-              if (response.data.length > 0) {
-                var deleteInfo =
-                  "该试题被试卷:" +
-                  response.data.join(" , ") +
-                  "使用,不能删除";
-                this.$notify({
-                  message: deleteInfo,
-                  type: "error",
-                });
-              } else {
-                this.$notify({
-                  message: "保存成功",
-                  type: "success",
-                });
-              }
+            .then(() => {
+              this.$notify({
+                message: "保存成功",
+                type: "success",
+              });
             })
             })
             .finally(() => (this.loading = false));
             .finally(() => (this.loading = false));
         });
         });
@@ -1822,7 +1811,7 @@ export default {
         callback: (action) => {
         callback: (action) => {
           if (action == "confirm") {
           if (action == "confirm") {
             this.loading = true;
             this.loading = true;
-            this.$http
+            this.$httpWithMsg
               .delete(
               .delete(
                 QUESTION_API +
                 QUESTION_API +
                   "/paper/deleteQuestion/" +
                   "/paper/deleteQuestion/" +
@@ -1830,28 +1819,17 @@ export default {
                   "/" +
                   "/" +
                   questionId
                   questionId
               )
               )
-              .then((response) => {
-                if (response.data.length > 0) {
-                  var deleteInfo =
-                    "该试题被试卷:" +
-                    response.data.join(" , ") +
-                    "使用,不能删除";
-                  this.$notify({
-                    message: deleteInfo,
-                    type: "error",
-                  });
-                } else {
-                  this.initPaper();
-                  this.getreduplicateQuestions();
-                  this.reduplicateGroup = [];
-                  this.loading = true;
-                  this.$notify({
-                    message: "保存成功",
-                    type: "success",
-                  });
-                }
-                this.loading = false;
-              });
+              .then(() => {
+                this.initPaper();
+                this.getreduplicateQuestions();
+                this.reduplicateGroup = [];
+                this.loading = true;
+                this.$notify({
+                  message: "保存成功",
+                  type: "success",
+                });
+              })
+              .finally(() => (this.loading = false));
           }
           }
         },
         },
       });
       });

+ 8 - 16
src/modules/questions/views/EditSelectQuestion.vue

@@ -392,27 +392,19 @@ export default {
         })
         })
           .then(() => {
           .then(() => {
             this.fullscreenLoading = true;
             this.fullscreenLoading = true;
-            this.$http
+            this.$httpWithMsg
               .delete(
               .delete(
                 QUESTION_API + "/paper/deleteQuestion/" + this.quesModel.id
                 QUESTION_API + "/paper/deleteQuestion/" + this.quesModel.id
               )
               )
-              .then((response) => {
-                if (response.data.length > 0) {
-                  this.deleteInfo =
-                    "该试题被试卷:" +
-                    response.data.join(" , ") +
-                    "使用,不能删除";
-                  this.deleteDialogVisible = true;
-                } else {
-                  this.$notify({
-                    message: "删除成功",
-                    type: "success",
-                  });
-                  this.$router.push({ path: "/questions/question_list/0" });
-                }
+              .then(() => {
+                this.$notify({
+                  message: "删除成功",
+                  type: "success",
+                });
+                this.$router.push({ path: "/questions/question_list/0" });
               });
               });
           })
           })
-          .catch(() => {});
+          .finally(() => (this.fullscreenLoading = false));
       } else {
       } else {
         this.fullscreenLoading = true;
         this.fullscreenLoading = true;
         this.$httpWithMsg
         this.$httpWithMsg

+ 15 - 30
src/modules/questions/views/PaperStructure.vue

@@ -283,26 +283,19 @@ export default {
         confirmButtonText: "确定",
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         cancelButtonText: "取消",
         type: "warning",
         type: "warning",
-      }).then(() => {
-        var url = QUESTION_API + "/paperStruct/" + row.id;
-        this.loading = true;
-        this.$http.delete(url).then(
-          () => {
+      })
+        .then(() => {
+          var url = QUESTION_API + "/paperStruct/" + row.id;
+          this.loading = true;
+          this.$httpWithMsg.delete(url).then(() => {
             this.$notify({
             this.$notify({
               type: "success",
               type: "success",
               message: "删除成功!",
               message: "删除成功!",
             });
             });
             this.searchPaperStructs();
             this.searchPaperStructs();
-          },
-          () => {
-            this.$notify({
-              type: "error",
-              message: "删除失败!",
-            });
-          }
-        );
-      });
-      this.loading = false;
+          });
+        })
+        .finally(() => (this.loading = false));
     },
     },
     //删除多条数据
     //删除多条数据
     deletePapers() {
     deletePapers() {
@@ -310,28 +303,20 @@ export default {
         confirmButtonText: "确定",
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         cancelButtonText: "取消",
         type: "error",
         type: "error",
-      }).then(() => {
-        this.loading = true;
-        var url = QUESTION_API + "/paperStruct/" + this.selectedIds;
-        this.$http
-          .delete(url)
-          .then(() => {
+      })
+        .then(() => {
+          this.loading = true;
+          var url = QUESTION_API + "/paperStruct/" + this.selectedIds;
+          this.$httpWithMsg.delete(url).then(() => {
             this.$notify({
             this.$notify({
               type: "success",
               type: "success",
               message: "删除成功!",
               message: "删除成功!",
             });
             });
             this.searchPaperStructs();
             this.searchPaperStructs();
             this.selectedList = [];
             this.selectedList = [];
-          })
-          .catch(() => {
-            this.$notify({
-              type: "error",
-              message: "删除失败!",
-            });
-            this.selectedList = [];
           });
           });
-      });
-      this.loading = false;
+        })
+        .finally(() => (this.loading = false));
     },
     },
 
 
     //新增
     //新增

+ 9 - 26
src/modules/questions/views/Question.vue

@@ -515,33 +515,16 @@ export default {
         type: "warning",
         type: "warning",
       }).then(() => {
       }).then(() => {
         this.loading = true;
         this.loading = true;
-        this.$http
+        this.$httpWithMsg
           .delete(QUESTION_API + "/paper/deleteQuestion/" + row.id)
           .delete(QUESTION_API + "/paper/deleteQuestion/" + row.id)
-          .then(
-            (response) => {
-              if (response.data.length > 0) {
-                this.loading = false;
-                this.deleteInfo =
-                  "该试题被试卷:" +
-                  response.data.join(" , ") +
-                  "使用,不能删除";
-                this.deleteDialogVisible = true;
-              } else {
-                this.$notify({
-                  message: "删除成功",
-                  type: "success",
-                });
-                this.searchQues();
-              }
-            },
-            () => {
-              this.$notify({
-                message: "删除失败",
-                type: "error",
-              });
-              this.loading = false;
-            }
-          );
+          .then(() => {
+            this.$notify({
+              message: "删除成功",
+              type: "success",
+            });
+            this.searchQues();
+          })
+          .finally(() => (this.loading = false));
       });
       });
     },
     },
     //打开弹窗
     //打开弹窗