mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 03:46:44 +08:00
解决上传多个时的控制问题
This commit is contained in:
@@ -185,7 +185,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 文件个数超出
|
// 文件个数超出
|
||||||
handleExceed(res) {
|
handleExceed(res) {
|
||||||
this.$message({message:`只允许上传单个文件`,type:'error',offset:100});
|
this.$message({message:`一次性最多上传${this.limit}个文件`,type:'error',offset:100});
|
||||||
},
|
},
|
||||||
// 上传失败
|
// 上传失败
|
||||||
handleUploadError(err) {
|
handleUploadError(err) {
|
||||||
@@ -193,16 +193,31 @@ export default {
|
|||||||
this.$message({message:"上传失败, 请重试",type:'error',offset:100});
|
this.$message({message:"上传失败, 请重试",type:'error',offset:100});
|
||||||
},
|
},
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
handleUploadSuccess(res, file) {
|
handleUploadSuccess(res, file,fileList) {
|
||||||
if(res.status == 200) {
|
if(res.status == 200) {
|
||||||
this.fileList = [];
|
//this.fileList = [];
|
||||||
|
//console.log(file,'file');
|
||||||
|
//console.log(fileList,'fileList');
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.$message({message:"上传成功",type:'success',offset:100});
|
this.$message({message:"上传成功",type:'success',offset:100});
|
||||||
|
let delIdx=-1;
|
||||||
|
fileList.some((fl,flIndx)=>{
|
||||||
|
if(fl.uid==file.uid){
|
||||||
|
delIdx=flIndx;
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(delIdx>-1){
|
||||||
|
fileList.splice(delIdx,1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.fileList = [];
|
//this.fileList = [];
|
||||||
this.$message({message:"上传失败",type:'error',offset:100});
|
this.$message({message:"上传失败",type:'error',offset:100});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit("success", res);
|
this.$emit("success", res);
|
||||||
},
|
},
|
||||||
// 删除文件
|
// 删除文件
|
||||||
|
|||||||
@@ -415,9 +415,9 @@ export default {
|
|||||||
this.getLastStudy();
|
this.getLastStudy();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log(this.userInfo.loginName,'this.userInfo.loginName');
|
//console.log(this.userInfo.loginName,'this.userInfo.loginName');
|
||||||
let flag=testUser.isTest(this.userInfo.loginName);
|
let flag=testUser.isTest(this.userInfo.loginName);
|
||||||
console.log(flag,'this.isTest22');
|
//console.log(flag,'this.isTest22');
|
||||||
this.isTest=flag;
|
this.isTest=flag;
|
||||||
// if(testUser.isTest(this.userInfo.loginName)){
|
// if(testUser.isTest(this.userInfo.loginName)){
|
||||||
// console.log(this.isTest,'this.isTest');
|
// console.log(this.isTest,'this.isTest');
|
||||||
|
|||||||
@@ -363,15 +363,17 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.upload.orgId=this.userInfo.departId;
|
this.upload.orgId=this.userInfo.departId;
|
||||||
//console.log(this.upload.orgId,'this.upload.orgId')
|
this.upload.orgName=this.userInfo.departName;
|
||||||
if(this.upload.orgId){
|
|
||||||
apiUserBasic.getOrgInfo(this.upload.orgId).then(rs=>{
|
|
||||||
if(rs.status==200){
|
|
||||||
this.upload.orgName=rs.result.name;
|
|
||||||
this.needOrg='';
|
this.needOrg='';
|
||||||
}
|
//console.log(this.upload.orgId,'this.upload.orgId')
|
||||||
});
|
// if(this.upload.orgId){
|
||||||
}
|
// apiUserBasic.getOrgInfo(this.upload.orgId).then(rs=>{
|
||||||
|
// if(rs.status==200){
|
||||||
|
// this.upload.orgName=rs.result.name;
|
||||||
|
// this.needOrg='';
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
this.loadResOwners();
|
this.loadResOwners();
|
||||||
this.getResOwnerTree().then(rs => {
|
this.getResOwnerTree().then(rs => {
|
||||||
this.resOwnerListMap = rs;
|
this.resOwnerListMap = rs;
|
||||||
@@ -508,7 +510,7 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async handleUploadSuccess(rs) {
|
handleUploadSuccess(rs) {
|
||||||
if (rs.status === 200) {
|
if (rs.status === 200) {
|
||||||
let type = toContentType(rs.result.fileType);
|
let type = toContentType(rs.result.fileType);
|
||||||
// ["doc", "xls", "ppt","docx", "xlsx", "pptx","png","txt", "pdf","jpg","gif","bmp","mp4","mp3"]
|
// ["doc", "xls", "ppt","docx", "xlsx", "pptx","png","txt", "pdf","jpg","gif","bmp","mp4","mp3"]
|
||||||
@@ -516,6 +518,7 @@ export default {
|
|||||||
this.$message.error('文件名称请不要超过100个字符');
|
this.$message.error('文件名称请不要超过100个字符');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//console.log('上传文件:'+rs.result.displayName);
|
||||||
const data = {
|
const data = {
|
||||||
orgId:this.upload.orgId,
|
orgId:this.upload.orgId,
|
||||||
orgName:this.upload.orgName,
|
orgName:this.upload.orgName,
|
||||||
@@ -528,23 +531,41 @@ export default {
|
|||||||
resType: type //文件类型,10视频,20音频,30图片, 40 文档,50表图文,60表scrom包,90表其它,
|
resType: type //文件类型,10视频,20音频,30图片, 40 文档,50表图文,60表scrom包,90表其它,
|
||||||
// remark: 备注说明,可以为空,不填
|
// remark: 备注说明,可以为空,不填
|
||||||
};
|
};
|
||||||
try {
|
//try {
|
||||||
const { result, status } = await coueseFile.saveUpload(data);
|
coueseFile.saveUpload(data).then(res=>{
|
||||||
if (status === 200) {
|
if(res.status==200){
|
||||||
result.device1 = true;
|
//console.log('上传文件成功:'+rs.result.displayName);
|
||||||
result.device2 = true;
|
res.result.device1 = true;
|
||||||
result.minute='';
|
res.result.device2 = true;
|
||||||
if(result.duration){
|
res.result.minute='';
|
||||||
result.minute=Math.round(result.duration/60); //四舍五入
|
if(res.result.duration){
|
||||||
|
res.result.minute=Math.round(res.result.duration/60); //四舍五入
|
||||||
}
|
}
|
||||||
|
this.fileList.push(res.result);
|
||||||
|
}else{
|
||||||
|
this.$message.error(res.message);
|
||||||
|
}
|
||||||
|
}).catch (error=>{
|
||||||
|
console.log(error,'error')
|
||||||
|
//this.$message.error(error);
|
||||||
|
});
|
||||||
|
// const { result, status } = coueseFile.saveUpload(data);
|
||||||
|
// if (status === 200) {
|
||||||
|
// console.log('上传文件成功:'+rs.result.displayName);
|
||||||
|
// result.device1 = true;
|
||||||
|
// result.device2 = true;
|
||||||
|
// result.minute='';
|
||||||
|
// if(result.duration){
|
||||||
|
// result.minute=Math.round(result.duration/60); //四舍五入
|
||||||
|
// }
|
||||||
|
|
||||||
this.fileList.push(result);
|
// this.fileList.push(result);
|
||||||
} else {
|
// } else {
|
||||||
this.$message.error(error);
|
// this.$message.error(error);
|
||||||
}
|
// }
|
||||||
} catch (error) {
|
//} catch (error) {
|
||||||
this.$message.error(error);
|
// this.$message.error(error);
|
||||||
}
|
//}
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(rs.message);
|
this.$message.error(rs.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -394,7 +394,6 @@
|
|||||||
Teacherinfo(){
|
Teacherinfo(){
|
||||||
this.workname=[];
|
this.workname=[];
|
||||||
this.checkboxtearGroup=[];
|
this.checkboxtearGroup=[];
|
||||||
|
|
||||||
apiTeach.detailTeacher(this.userInfo.aid).then(res =>{
|
apiTeach.detailTeacher(this.userInfo.aid).then(res =>{
|
||||||
if(res.result.courses){
|
if(res.result.courses){
|
||||||
this.teachform.courses = res.result.courses;
|
this.teachform.courses = res.result.courses;
|
||||||
|
|||||||
Reference in New Issue
Block a user