课件文件分类型
This commit is contained in:
parent
9447a05919
commit
c9c2828a20
|
@ -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') {
|
||||
|
|
Loading…
Reference in New Issue