课件设置为一个文件上传
This commit is contained in:
parent
fb6aecd22c
commit
542c0bba40
|
@ -6,10 +6,10 @@
|
||||||
</template>
|
</template>
|
||||||
<a-tabs type="card" :default-active-key="parentTabKey" @change="parentcallback">
|
<a-tabs type="card" :default-active-key="parentTabKey" @change="parentcallback">
|
||||||
<a-tab-pane key="1" tab="文件上传">
|
<a-tab-pane key="1" tab="文件上传">
|
||||||
<a-tabs :default-active-key="fileUpload.tabkey" @change="callback">
|
<a-tabs v-model="fileUpload.tabkey" @change="callback">
|
||||||
|
|
||||||
<a-tab-pane key="1" tab="视频上传" :disabled="fileUpload.videoForm.disabled">
|
<a-tab-pane key="1" tab="视频上传" :disabled="fileUpload.videoForm.disabled">
|
||||||
<div style="background: #ececec; padding: 30px">
|
<div v-if="fileUpload.tabkey == 1" style="background: #ececec; padding: 30px">
|
||||||
<a-card title="视频上传" :bordered="false" style="width: 100%">
|
<a-card title="视频上传" :bordered="false" style="width: 100%">
|
||||||
<div style="margin-bottom: 30px">
|
<div style="margin-bottom: 30px">
|
||||||
课件名称:
|
课件名称:
|
||||||
|
@ -32,8 +32,9 @@
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
视频上传: <a-upload list-type="picture" :default-file-list="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo" :disabled="this.uploadLoading">
|
<span v-show="this.successOssFile.length < 1">视频上传:</span> <a-upload list-type="picture" v-model="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo" accept=".mp4"
|
||||||
<a-button>
|
:disabled="this.uploadLoading">
|
||||||
|
<a-button v-show="this.successOssFile.length <1">
|
||||||
<a-icon type="upload" /> {{this.uploadButtonText}}
|
<a-icon type="upload" /> {{this.uploadButtonText}}
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
|
@ -43,7 +44,7 @@
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
|
|
||||||
<a-tab-pane key="2" tab="文本上传" :disabled="fileUpload.textForm.disabled">
|
<a-tab-pane key="2" tab="文本上传" :disabled="fileUpload.textForm.disabled">
|
||||||
<div style="background: #ececec; padding: 30px">
|
<div v-if="fileUpload.tabkey == 2" style="background: #ececec; padding: 30px">
|
||||||
<a-card title="文本上传" :bordered="false" style="width: 100%">
|
<a-card title="文本上传" :bordered="false" style="width: 100%">
|
||||||
<div style="margin-bottom: 30px">
|
<div style="margin-bottom: 30px">
|
||||||
课件名称:
|
课件名称:
|
||||||
|
@ -66,8 +67,9 @@
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
文件上传: <a-upload list-type="picture" :default-file-list="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo" :disabled="this.uploadLoading">
|
<span v-show="this.successOssFile.length < 1">文件上传:</span> <a-upload list-type="picture" :default-file-list="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo"
|
||||||
<a-button>
|
:disabled="this.uploadLoading">
|
||||||
|
<a-button v-show="this.successOssFile.length < 1">
|
||||||
<a-icon type="upload" /> {{this.uploadButtonText}}
|
<a-icon type="upload" /> {{this.uploadButtonText}}
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
|
@ -204,21 +206,18 @@ export default {
|
||||||
if (this.queryParam.coursewareId) this.load();
|
if (this.queryParam.coursewareId) this.load();
|
||||||
|
|
||||||
// 是否资源库ifResources
|
// 是否资源库ifResources
|
||||||
console.log("资源库标号"+this.$route.query.ifResources+"课件ID:"+this.$route.query.coursewareId)
|
if (this.$route.query.coursewareId && this.$route.query.ifResources == 1) {
|
||||||
|
this.pageName = '资源库编辑';
|
||||||
if(this.$route.query.coursewareId && this.$route.query.ifResources == 1 ) {
|
} else if (!this.$route.query.coursewareId && this.$route.query.ifResources == 1) {
|
||||||
this.pageName = '资源库编辑'
|
this.pageName = '资源库新增';
|
||||||
}else if(!this.$route.query.coursewareId && this.$route.query.ifResources == 1){
|
|
||||||
this.pageName = '资源库新增'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.$route.query.coursewareId && this.$route.query.ifResources == 0) {
|
if (this.$route.query.coursewareId && this.$route.query.ifResources == 0) {
|
||||||
this.pageName = '课件编辑'
|
this.pageName = '课件编辑';
|
||||||
}else if(!this.$route.query.coursewareId && this.$route.query.ifResources == 0){
|
} else if (!this.$route.query.coursewareId && this.$route.query.ifResources == 0) {
|
||||||
this.pageName = '课件新增'
|
this.pageName = '课件新增';
|
||||||
}
|
}
|
||||||
|
},
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
//弹框
|
//弹框
|
||||||
showModal() {
|
showModal() {
|
||||||
|
@ -248,7 +247,6 @@ export default {
|
||||||
|
|
||||||
//顶级标签页
|
//顶级标签页
|
||||||
parentcallback(key) {
|
parentcallback(key) {
|
||||||
console.log(key);
|
|
||||||
this.fileUpload.videoForm = {};
|
this.fileUpload.videoForm = {};
|
||||||
this.fileUpload.textForm = {};
|
this.fileUpload.textForm = {};
|
||||||
this.videoPath = []; //置空文件
|
this.videoPath = []; //置空文件
|
||||||
|
@ -258,16 +256,15 @@ export default {
|
||||||
callback(key) {
|
callback(key) {
|
||||||
this.fileUpload.videoForm = {};
|
this.fileUpload.videoForm = {};
|
||||||
this.fileUpload.textForm = {};
|
this.fileUpload.textForm = {};
|
||||||
console.log('aaaaaaa ', this.fileUpload.videoForm);
|
|
||||||
console.log('aaaaaaa ', this.fileUpload.textForm);
|
|
||||||
this.videoPath = []; //置空文件
|
this.videoPath = []; //置空文件
|
||||||
|
|
||||||
this.successOssFile = this.successOssFile.splice(this.successOssFile.length, 0); //清空数组
|
// this.successOssFile = this.successOssFile.splice(this.successOssFile.length, 0); //清空数组
|
||||||
console.log('清除后的文件', this.successOssFile);
|
|
||||||
this.fileUpload.tabkey = key; //等于当前的Key
|
this.fileUpload.tabkey = key; //等于当前的Key
|
||||||
|
|
||||||
// 数据初始化
|
for (let i = 0; i < this.successOssFile.length; i++) {
|
||||||
// this.initialize(key)
|
this.deleteVideo(this.successOssFile[i]);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//获取Tonken
|
//获取Tonken
|
||||||
|
@ -308,13 +305,11 @@ export default {
|
||||||
|
|
||||||
res.data.uuid = file.uid;
|
res.data.uuid = file.uid;
|
||||||
res.data.size = file.size;
|
res.data.size = file.size;
|
||||||
console.log('文件大小---', file.size);
|
|
||||||
this.successOssFile.push(res.data);
|
this.successOssFile.push(res.data);
|
||||||
|
|
||||||
//刷新文件大小
|
//刷新文件大小
|
||||||
this.refreshFileSize();
|
this.refreshFileSize();
|
||||||
|
|
||||||
console.log('上传之后的文件', this.successOssFile);
|
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(res.data.msg);
|
this.$message.error(res.data.msg);
|
||||||
this.$refs.inputFile.value = '';
|
this.$refs.inputFile.value = '';
|
||||||
|
@ -372,10 +367,9 @@ export default {
|
||||||
|
|
||||||
//删除已上传的视频
|
//删除已上传的视频
|
||||||
deleteVideo(file) {
|
deleteVideo(file) {
|
||||||
console.log('deleteVideo - file:{}', file);
|
|
||||||
// 删除元素
|
// 删除元素
|
||||||
for (let i = 0; i < this.successOssFile.length; i++) {
|
for (let i = 0; i < this.successOssFile.length; i++) {
|
||||||
if (this.successOssFile[i].uuid == file.uid) {
|
if (this.successOssFile[i].uuid == file.uid || this.successOssFile[i].uuid == file.uuid) {
|
||||||
this.successOssFile.splice(i, 1);
|
this.successOssFile.splice(i, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -386,7 +380,6 @@ export default {
|
||||||
|
|
||||||
//保存
|
//保存
|
||||||
save() {
|
save() {
|
||||||
console.log('this.ifResources', this.ifResources);
|
|
||||||
|
|
||||||
//视频赋给表单里面的字段
|
//视频赋给表单里面的字段
|
||||||
this.successOssFile.forEach((item, index) => {
|
this.successOssFile.forEach((item, index) => {
|
||||||
|
@ -407,7 +400,6 @@ export default {
|
||||||
from = this.textFormV();
|
from = this.textFormV();
|
||||||
if (typeof from == 'boolean' && !from) return;
|
if (typeof from == 'boolean' && !from) return;
|
||||||
} else if (this.parentTabKey == '2') {
|
} else if (this.parentTabKey == '2') {
|
||||||
console.log(this.videoServerLink);
|
|
||||||
from = this.videoServerLinkV();
|
from = this.videoServerLinkV();
|
||||||
if (typeof from == 'boolean' && !from) return;
|
if (typeof from == 'boolean' && !from) return;
|
||||||
} else if (this.parentTabKey == '3') {
|
} else if (this.parentTabKey == '3') {
|
||||||
|
@ -417,7 +409,6 @@ export default {
|
||||||
|
|
||||||
//提交保存请求
|
//提交保存请求
|
||||||
coursewareAdd(from).then(res => {
|
coursewareAdd(from).then(res => {
|
||||||
console.log(res);
|
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.$message.success('课件保存成功!');
|
this.$message.success('课件保存成功!');
|
||||||
this.goback();
|
this.goback();
|
||||||
|
@ -445,7 +436,6 @@ export default {
|
||||||
this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0;
|
this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0;
|
||||||
let form = {};
|
let form = {};
|
||||||
form = this.fileUpload.videoForm;
|
form = this.fileUpload.videoForm;
|
||||||
console.log('FORM', form);
|
|
||||||
return form;
|
return form;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -477,7 +467,6 @@ export default {
|
||||||
//给课程ID
|
//给课程ID
|
||||||
this.videoServerLink.courseId = this.$route.query.courseId;
|
this.videoServerLink.courseId = this.$route.query.courseId;
|
||||||
this.videoServerLink.videoPath = this.videoPath;
|
this.videoServerLink.videoPath = this.videoPath;
|
||||||
console.log(this.videoServerLink);
|
|
||||||
|
|
||||||
let form = {};
|
let form = {};
|
||||||
form = this.videoServerLink;
|
form = this.videoServerLink;
|
||||||
|
@ -495,7 +484,6 @@ export default {
|
||||||
this.thirdAddress.courseId = this.$route.query.courseId;
|
this.thirdAddress.courseId = this.$route.query.courseId;
|
||||||
this.thirdAddress.videoPath = this.videoPath;
|
this.thirdAddress.videoPath = this.videoPath;
|
||||||
|
|
||||||
console.log(this.thirdAddress);
|
|
||||||
let form = {};
|
let form = {};
|
||||||
form = this.thirdAddress;
|
form = this.thirdAddress;
|
||||||
return form;
|
return form;
|
||||||
|
@ -508,8 +496,6 @@ export default {
|
||||||
let parameter = {};
|
let parameter = {};
|
||||||
coursewareDeatil(Object.assign(parameter, this.queryParam)).then(res => {
|
coursewareDeatil(Object.assign(parameter, this.queryParam)).then(res => {
|
||||||
this.courseware = res.data;
|
this.courseware = res.data;
|
||||||
console.log('加载数据了');
|
|
||||||
console.log('courseware:', this.courseware);
|
|
||||||
|
|
||||||
//编辑只能更改所在的位置的
|
//编辑只能更改所在的位置的
|
||||||
this.fileUpload.disabled = true;
|
this.fileUpload.disabled = true;
|
||||||
|
|
Loading…
Reference in New Issue