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