|
@@ -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();
|
|
|
}
|
|
|
},
|