课件文件分类型

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 { export default {
data() { data() {
return { return {
courseWay: 0, // 1: , 2: pdf
schedule: 0, // schedule: 0, //
isSave: false, isSave: false,
pageName: '', pageName: '',
@ -226,16 +227,8 @@ export default {
// //
showModal() { showModal() {
this.fileUpload.visible = true; this.fileUpload.visible = true;
// this.classfiy()
}, },
// dictionaryDropDown() {
// //
// dictionaryDropDown({ dictionaryCode: '0009' }).then(res => {
// //
// this.coursewareClassfiy = dictToTree(res.data, [], 0);
// });
// },
// //
goback() { goback() {
@ -279,10 +272,15 @@ export default {
}, },
beforeUpload(file) { beforeUpload(file) {
console.log('file', file);
const _this = this; 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; this.uploadLoading = true;
@ -304,13 +302,10 @@ export default {
var config = { var config = {
headers: header, headers: header,
onUploadProgress: function (e) { onUploadProgress: function (e) {
console.log(e);
//lengthComputable //lengthComputable
//lengthComputablefalsee.totale.loaded //lengthComputablefalsee.totale.loaded
if (e.lengthComputable) { if (e.lengthComputable) {
let a = ((e.loaded / e.total) * 100).toFixed(2); 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) _this.schedule = parseInt(a) > 99 ? 99 : parseInt(a)
} }
@ -340,7 +335,6 @@ export default {
} }
}) })
.catch(err => { .catch(err => {
console.log("进来了!!!!!",err);
// data.delete("file") // // data.delete("file") //
// this.uploadButtonText = ''; // this.uploadButtonText = '';
@ -462,6 +456,7 @@ export default {
this.fileUpload.videoForm.courseId = this.$route.query.courseId; this.fileUpload.videoForm.courseId = this.$route.query.courseId;
this.fileUpload.videoForm.videoPath = this.videoPath; this.fileUpload.videoForm.videoPath = this.videoPath;
this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0; this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0;
this.fileUpload.videoForm.courseWay = this.courseWay
let form = {}; let form = {};
form = this.fileUpload.videoForm; form = this.fileUpload.videoForm;
return form; return form;
@ -480,6 +475,7 @@ export default {
this.fileUpload.textForm.type = this.fileUpload.tabkey; this.fileUpload.textForm.type = this.fileUpload.tabkey;
this.fileUpload.textForm.videoPath = this.videoPath; this.fileUpload.textForm.videoPath = this.videoPath;
this.fileUpload.textForm.ifResources = this.$route.query.ifResources || 0; this.fileUpload.textForm.ifResources = this.$route.query.ifResources || 0;
this.fileUpload.textForm.courseWay = this.courseWay;
let form = {}; let form = {};
form = this.fileUpload.textForm; form = this.fileUpload.textForm;
return form; return form;
@ -547,7 +543,6 @@ export default {
successOssFile_['url'] = element.path; successOssFile_['url'] = element.path;
successOssFile_['size'] = element.size; successOssFile_['size'] = element.size;
this.successOssFile.push(successOssFile_); this.successOssFile.push(successOssFile_);
console.log('文件问见', this.successOssFile);
}); });
if (this.courseware.type == '1') { if (this.courseware.type == '1') {