From 4b25e1152fe853d420fd5a0b732bb74d85c45906 Mon Sep 17 00:00:00 2001 From: 18571350067 Date: Fri, 11 Mar 2022 18:15:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?PDF=E8=AF=BE=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/course/CoursewareAddOrUpdate.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/course/CoursewareAddOrUpdate.vue b/src/views/course/CoursewareAddOrUpdate.vue index 516093a..4157458 100644 --- a/src/views/course/CoursewareAddOrUpdate.vue +++ b/src/views/course/CoursewareAddOrUpdate.vue @@ -69,9 +69,9 @@
- 文件上传:  文件上传:  - + {{this.uploadButtonText}}     @@ -294,7 +294,7 @@ export default { //处理视频上传 const data = new FormData(); data.append('file', file); - data.append('fileType', 'mp4'); + data.append('fileType', this.fileUpload.tabkey == '1' ? 'mp4' : 'pdf'); //设置请求头和token const header = {}; @@ -343,7 +343,11 @@ export default { console.log("进来了!!!!!",err); // data.delete("file") // 清空文件 // this.uploadButtonText = '选择文件'; - this.$message.error("上传失败!视频超出可上传大小范围"); + + for (let i = 0; i < this.successOssFile.length; i++) { + this.deleteVideo(this.successOssFile[i]); + } + this.$message.error("上传失败!"+this.fileUpload.tabkey == '1' ? "视频":"文件"+"超出可上传大小范围或文件已损坏!"); }); return false; }, From c9c2828a20366f12eb4fdebce1ed486616d89479 Mon Sep 17 00:00:00 2001 From: 18571350067 Date: Sat, 12 Mar 2022 16:05:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/course/CoursewareAddOrUpdate.vue | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/views/course/CoursewareAddOrUpdate.vue b/src/views/course/CoursewareAddOrUpdate.vue index 4157458..ee810b6 100644 --- a/src/views/course/CoursewareAddOrUpdate.vue +++ b/src/views/course/CoursewareAddOrUpdate.vue @@ -158,6 +158,7 @@ import { dictToTree } from '@/utils/util'; export default { data() { return { + courseWay: 0, //文件类型 1: 视频, 2: pdf schedule: 0, //进度 isSave: false, pageName: '', @@ -226,16 +227,8 @@ export default { //弹框 showModal() { this.fileUpload.visible = true; - // this.classfiy() }, - // dictionaryDropDown() { - // // 课件分类 - // dictionaryDropDown({ dictionaryCode: '0009' }).then(res => { - // // 词典转树结构 - // this.coursewareClassfiy = dictToTree(res.data, [], 0); - // }); - // }, //返回 goback() { @@ -279,10 +272,15 @@ export default { }, beforeUpload(file) { - console.log('file', file); const _this = this; - console.log("fileSize",file.size) + + let fileName = file.name; + + let fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1); + + if(fileExtension == 'mp4' || fileExtension == 'MP4') this.courseWay = 1; + if(fileExtension == 'pdf' || fileExtension == 'PDF') this.courseWay = 2; //告知用户是否正在上传 this.uploadLoading = true; @@ -304,13 +302,10 @@ export default { var config = { headers: header, onUploadProgress: function (e) { - console.log(e); //属性lengthComputable主要表明总共需要完成的工作量和已经完成的工作是否可以被测量 //如果lengthComputable为false,就获取不到e.total和e.loaded if (e.lengthComputable) { let a = ((e.loaded / e.total) * 100).toFixed(2); - // _this.schedule = ((e.loaded / e.total) * 100).toFixed(2) ; //已上传的比例 - console.log('进度', a); _this.schedule = parseInt(a) > 99 ? 99 : parseInt(a) } @@ -340,7 +335,6 @@ export default { } }) .catch(err => { - console.log("进来了!!!!!",err); // data.delete("file") // 清空文件 // this.uploadButtonText = '选择文件'; @@ -462,6 +456,7 @@ export default { this.fileUpload.videoForm.courseId = this.$route.query.courseId; this.fileUpload.videoForm.videoPath = this.videoPath; this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0; + this.fileUpload.videoForm.courseWay = this.courseWay let form = {}; form = this.fileUpload.videoForm; return form; @@ -480,6 +475,7 @@ export default { this.fileUpload.textForm.type = this.fileUpload.tabkey; this.fileUpload.textForm.videoPath = this.videoPath; this.fileUpload.textForm.ifResources = this.$route.query.ifResources || 0; + this.fileUpload.textForm.courseWay = this.courseWay; let form = {}; form = this.fileUpload.textForm; return form; @@ -547,7 +543,6 @@ export default { successOssFile_['url'] = element.path; successOssFile_['size'] = element.size; this.successOssFile.push(successOssFile_); - console.log('文件问见', this.successOssFile); }); if (this.courseware.type == '1') { From 2aad29c848cac424532efa8be4ee3a52df2e51ae Mon Sep 17 00:00:00 2001 From: QuAoLi Date: Sat, 12 Mar 2022 17:28:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BA=BA=E5=91=98=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/archives/user/Index.vue | 156 ++++++++++++++++++++++-------- 1 file changed, 116 insertions(+), 40 deletions(-) diff --git a/src/views/archives/user/Index.vue b/src/views/archives/user/Index.vue index dbe3f2a..a14dfbe 100644 --- a/src/views/archives/user/Index.vue +++ b/src/views/archives/user/Index.vue @@ -1,51 +1,78 @@