diff --git a/src/components/Course/catalogCourseware.vue b/src/components/Course/catalogCourseware.vue index 623ee565..60bb7b2e 100644 --- a/src/components/Course/catalogCourseware.vue +++ b/src/components/Course/catalogCourseware.vue @@ -51,9 +51,6 @@
-
时长(分钟): - -
保存
@@ -80,9 +77,6 @@ 秒 --> -
时长(分钟): - -
保存
@@ -331,7 +325,6 @@ completeSetup:0, second:5, setupTage:0, - duration: 0, }, homework:{courseId: '', name:'', content:'', file:'', deadTime: '', submitMode: 3}, homeworkChange:{}, @@ -395,10 +388,8 @@ if(newVal.content!=''){ if(newVal.content.startsWith('\{')){ this.curriculumData =JSON.parse(newVal.content); - this.curriculumData.duration = Math.round(this.curriculumData.duration/60); }else{ this.curriculumData.url=newVal.content; - this.curriculumData.duration = Math.round(newVal.duration/60); } } } @@ -421,7 +412,6 @@ completeSetup:0, second:5, setupTage:0, - duration: 0, }; //this.assess }, @@ -513,12 +503,6 @@ this.content.content=JSON.stringify(this.linkInfo); } } else if(this.content.contentType==10 || this.content.contentType==20) { - if(!this.curriculumData.duration){ - this.$message.error("请手动输入课件时长"); - return; - } - this.curriculumData.duration = this.curriculumData.duration*60; - this.content.duration = this.curriculumData.duration; this.content.content=JSON.stringify(this.curriculumData); } let jsonData={ @@ -655,7 +639,6 @@ this.content.content=cfile.filePath; } } - this.curriculumData.duration = Math.round(cfile.duration/60); this.content.courseId=this.course.id; this.content.duration=cfile.duration;//时长 this.content.sortIndex=1; diff --git a/src/components/Course/chooseCourseFile.vue b/src/components/Course/chooseCourseFile.vue index f5e458c4..a7ead1d2 100644 --- a/src/components/Course/chooseCourseFile.vue +++ b/src/components/Course/chooseCourseFile.vue @@ -25,7 +25,7 @@ @@ -43,19 +43,30 @@ -
+
内容时长(分):
- +
将文件拖到此处,或点击上传
文件大小限制:{{curComType.maxSizeName}},支持的文件类型:{{curComType.fileTypes.join(',')}}
- +
+
+
名称:
+ +
+
+
时长:
+ +
分钟
+
+
确定
+
{{courseFile.fileName}} 上传成功
@@ -90,7 +101,7 @@ }, data(){ return { - successParams: {}, + courseWare: {}, uploadFileUrl: process.env.VUE_APP_BASE_API + "/xboe/sys/xuploader/file/upload", // 上传的图片服务器地址 data:{ dir:'course' @@ -119,6 +130,7 @@ }, mounted() { this.courseFile={}; + this.courseWare = {}; let $this=this; this.comTypes.some(ct=>{ if(ct.resType==$this.resType){ @@ -140,6 +152,9 @@ } }, methods:{ + handleExceed(){ + this.$message({message:`只允许一次性上传一个`,type:'error',offset:100}) + }, handleBeforeUpload(file) { if(file.name.lastIndexOf(".") ==-1) { this.$message({message:`文件格式不正确!`,type:'error',offset:100}) @@ -173,27 +188,28 @@ }, // 上传成功回调 handleUploadSuccess(res, file) { - console.log(res,file,'resfile') + // console.log(res,file,'xixixixiix'); if(res.status == 200) { //上传到课件库 //console.log(res.result); - let courseWare={ + this.courseWare={ fileName:res.result.displayName, fileType:res.result.fileType, filePath:res.result.filePath, resType:this.resType, orgId:this.orgId, orgName:this.orgName, - duration:this.duration, + duration:res.result.duration||this.duration, remark:'课程中直接上传' } - if(res.result.fileType == 'mp4'||res.result.fileType == 'mp3'){ - this.successParams = courseWare - this.courseFile = {fileName:res.result.displayName,id: '1',resType:'10'} - this.$message({message:"上传成功",type:'success',offset:100}); - return + this.$message({message:"上传成功",type:'success',offset:100}); + this.courseFile = { + id: res.result.filePath, + fileName:res.result.displayName.replace(/\.[^/.]+$/, ""), + duration:res.result.duration, } - apiCourseFile.saveUpload(courseWare).then(rs=>{ + return + apiCourseFile.saveUpload(this.courseWare).then(rs=>{ if(rs.status==200){ this.courseFile=rs.result; this.$message({message:"上传成功",type:'success',offset:100}); @@ -212,7 +228,8 @@ }, // 删除文件 handleDelete(index) { - this.fileList.splice(index, 1); + this.courseFile = {}; + // this.fileList.splice(index, 1); //注意删除处理 //this.$emit("remove", ''); }, @@ -255,24 +272,58 @@ }) }, - chooseCourseFile(ccfile,val=false){ - if(ccfile.resType == 10&&val){ - apiCourseFile.saveUpload(this.successParams).then(rs=>{ - if(rs.status==200){ - this.$emit('choose', rs.result); - }else{ - this.$message.error(rs.message); - } + chooseCourseFile(ccfile,isUpload){ + if(isUpload){ + if(this.resType == 10||this.resType == 20){ + if(!this.courseFile.fileName){ + this.$message({message:`${this.resType == 10?'视频':'音频'}名称不能为空`,type:'error',offset:100}); + return + } + if(!this.courseFile.duration){ + this.$message({message:"时长不能为空",type:'error',offset:100}); + return + } + this.courseWare.fileName = this.courseFile.fileName + '.' + this.courseWare.fileType + this.courseWare.duration = this.courseFile.duration + } + apiCourseFile.saveUpload(this.courseWare).then(rs=>{ + if(rs.status==200){ + this.courseFile=rs.result; + this.$message({message:"保存成功",type:'success',offset:100}); + this.$emit('choose', this.courseFile); + }else{ + this.$message.error(rs.message); + } }).catch(err=>{ - console.log(err,'errrrrr') + this.$message.error(err.message); }) - }else{ - this.$emit('choose', ccfile); + return } + this.$emit('choose', ccfile); } } } diff --git a/src/components/Course/weikeContent.vue b/src/components/Course/weikeContent.vue index a6f7bf38..168aa565 100644 --- a/src/components/Course/weikeContent.vue +++ b/src/components/Course/weikeContent.vue @@ -75,9 +75,6 @@ 秒 -->
-
时长(分钟): - -
保存
@@ -105,9 +102,6 @@
-
时长(分钟): - -
保存
@@ -663,7 +657,6 @@ completeSetup:0, second:5, setupTage:0, - duration: 0, }, }, pdfTip:'',//pdf文件的提示 @@ -842,13 +835,10 @@ } } if(con.contentType==10 || con.contentType==20){ - console.log(con.content,'con.content') if(con.content.startsWith('\{')){ $this.cware.curriculumData=JSON.parse(con.content); - $this.cware.curriculumData.duration = Math.round($this.cware.curriculumData.duration/60); }else{ $this.cware.curriculumData.url=con.content; - $this.cware.curriculumData.duration = Math.round(con.duration/60); } } $this.cwareChange = deepClone($this.cware); @@ -996,7 +986,6 @@ this.cware.content.contentName=row.name; this.cware.content.content=row.filePath; this.cware.curriculumData.url = row.filePath; - this.cware.curriculumData.duration=Math.round(row.duration/60); this.cware.content.duration=row.duration;//时长 this.cware.findShow=false; if(this.cware.content.contentType==40){ @@ -1078,13 +1067,6 @@ this.$message.error("请选择课件"); return; } - if(!this.cware.curriculumData.duration){ - this.$message.error("请手动输入课件时长"); - this.loading=false; - return; - } - this.cware.curriculumData.duration = Math.round(this.cware.curriculumData.duration*60); - postData.content.duration = this.cware.curriculumData.duration; postData.content.content=JSON.stringify(this.cware.curriculumData); this.cwareChange.curriculumData = deepClone(this.cware.curriculumData) } @@ -1151,7 +1133,6 @@ if(res.status==200){ if(index==1){ $this.cware.content=res.result.content; - this.cware.curriculumData.duration = Math.round(this.cware.curriculumData.duration/60); }else if(index==2){ $this.homework.content=res.result.content; $this.homework.info=res.result.homework; @@ -1169,6 +1150,7 @@ //if(res.result.homework) this.$message.success('保存成功'); //保存成功的统一处理 + }else{ this.$message.error(res.message); } @@ -1234,7 +1216,6 @@ this.cware.curriculumData.url = cfile.filePath; } } - this.cware.curriculumData.duration=Math.round(cfile.duration/60); this.cware.content.duration=cfile.duration;//时长 this.saveContent(1);