课件文件分类型

This commit is contained in:
18571350067 2022-03-12 16:05:48 +08:00
parent 9447a05919
commit c9c2828a20
1 changed files with 10 additions and 15 deletions

View File

@ -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
//lengthComputablefalsee.totale.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') {