smith_du 2 년 전
부모
커밋
df2d96a33b
3개의 변경된 파일78개의 추가작업 그리고 39개의 파일을 삭제
  1. 38 19
      src/views/menu3/menu3-1/index.vue
  2. 38 18
      src/views/menu3/menu3-2/index.vue
  3. 2 2
      src/views/menu8/menu8-2/index.vue

+ 38 - 19
src/views/menu3/menu3-1/index.vue

@@ -432,7 +432,7 @@ export default {
     this.getRoles();
   },
   methods: {
-    getRoles(){
+    getRoles() {
       DictsApi.roles({ platform: "teacher" }).then((res) => {
         this.metaData["roles"] = res.data;
       });
@@ -480,25 +480,25 @@ export default {
             };
             this.dialogForm = form;
             this.$refs.dialog.open((cancel) => {
-              this.$refs["form"].validate((valid)=>{
-                if(valid){
+              this.$refs["form"].validate((valid) => {
+                if (valid) {
                   TeacherApi.edit(this.dialogForm).then((res) => {
-                    if(res.mess="success"){
+                    if ((res.mess = "success")) {
                       this.$message({
-                        type:"success",
-                        message:"修改成功!"
-                      })
+                        type: "success",
+                        message: "修改成功!",
+                      });
                       this.getList();
                       cancel();
-                    }else{
+                    } else {
                       Message({
-                        type:"error",
-                        message:res.message
-                      })
+                        type: "error",
+                        message: res.message,
+                      });
                     }
                   });
                 }
-              })
+              });
             });
           });
           break;
@@ -583,8 +583,16 @@ export default {
         .open((cancel) => {
           var token = _this.Cookies.get("www-authenticate");
           _this.upHeader.Authorization = `Bearer ${token}`;
-          _this.$refs.upload.submit();
-          console.log("点击提交按钮了");
+          if (_this.$refs.upload.uploadFiles.length > 0) {
+            _this.$refs.upload.submit();
+          } else {
+            this.$message({
+              type: "warning",
+              message: `请选择文件上传!`,
+            });
+          }
+
+          // console.log("点击提交按钮了");
         })
         .then(() => {
           console.log(this.$refs.span);
@@ -597,11 +605,22 @@ export default {
     handleSuccess(res, file) {
       if (res.mess == "success") {
         this.$refs.dialog2.cancel();
-
-        this.$message({
-          type: "success",
-          message: "上传成功!",
-        });
+        if (res.data.errors.length > 0) {
+          this.$message({
+            dangerouslyUseHTMLString: true,
+            type: "warning",
+            message: `
+             <div>成功:${res.data.success}个,失败:${res.data.fail}个</div>
+            ${res.data.errors.map((item) => {
+              return `<div>${item}</div>`;
+            }).join("")}`,
+          });
+        } else {
+          this.$message({
+            type: "success",
+            message: "上传成功!",
+          });
+        }
         this.getList();
       }
     },

+ 38 - 18
src/views/menu3/menu3-2/index.vue

@@ -414,17 +414,17 @@ export default {
             };
             this.dialogForm = form;
             this.$refs.dialog.open((cancel) => {
-              this.$refs["form"].validate((valid)=>{
-                if(valid){
+              this.$refs["form"].validate((valid) => {
+                if (valid) {
                   StudentApi.edit(this.dialogForm).then((res) => {
-                    if(res.mess="success"){
-                        this.$message({
-                          type:"success",
-                          message:"修改成功!"
-                        })
-                        this.getList()
-                        cancel()
-                    }else{
+                    if ((res.mess = "success")) {
+                      this.$message({
+                        type: "success",
+                        message: "修改成功!",
+                      });
+                      this.getList();
+                      cancel();
+                    } else {
                       Message({
                         message: res.message,
                         type: "error",
@@ -432,7 +432,7 @@ export default {
                     }
                   });
                 }
-              })
+              });
             });
           });
           break;
@@ -508,7 +508,7 @@ export default {
                   message: "成功!",
                 });
                 this.getList();
-                cancel()
+                cancel();
               } else {
                 Message({
                   message: res.message,
@@ -531,7 +531,15 @@ export default {
         .open((cancel) => {
           var token = _this.Cookies.get("www-authenticate");
           _this.upHeader.Authorization = `Bearer ${token}`;
-          _this.$refs.upload.submit();
+          if (_this.$refs.upload.uploadFiles.length > 0) {
+            _this.$refs.upload.submit();
+          } else {
+            this.$message({
+              type: "warning",
+              message: `请选择文件上传!`,
+            });
+          }
+
           console.log("点击提交按钮了");
         })
         .then(() => {
@@ -547,11 +555,23 @@ export default {
     handleSuccess(res, file) {
       if (res.mess == "success") {
         this.$refs.dialog2.cancel();
-
-        this.$message({
-          type: "success",
-          message: "上传成功!",
-        });
+        if (res.data.errors.length > 0) {
+          this.$message({
+            dangerouslyUseHTMLString: true,
+            type: "warning",
+            message: `
+            <div>成功:${res.data.success}个,失败:${res.data.fail}个</div>
+            ${res.data.errors.map((item) => {
+              return `<div>${item}</div>`;
+            }).join("")}
+            `,
+          });
+        } else {
+          this.$message({
+            type: "success",
+            message: "上传成功!",
+          });
+        }
         this.getList();
       }
     },

+ 2 - 2
src/views/menu8/menu8-2/index.vue

@@ -185,7 +185,7 @@
       <el-upload
         class="upload-demo"
         ref="upload"
-        action="/v1/admin/resource/categories/work/bulk"
+        action="/v1/admin/resource/categories/exam/bulk"
         :name="'datafile'"
         :headers="upHeader"
         :on-success="handleSuccess"
@@ -441,7 +441,7 @@ export default {
         });
       } else {
         params = _this[`treeData_level${level}`][_this[`index_level${level}`]];
-        params.ctype = "work";
+        params.ctype = "exam";
         delete params.isAdd;
         resourceApi.edit(params).then((res) => {
           if (res.mess == "success") {