删除课程中不要的字段,课件增加上传进度条、取消课件分类,课件预览课件类别取消显示
This commit is contained in:
parent
8f4387f5cc
commit
88f253cff9
|
@ -29,8 +29,7 @@
|
|||
<!-- 课时 -->
|
||||
<a-col :span="9">
|
||||
<a-form-item label="课时" :label-col="{ span: 4 }" :wrapper-col="{ span: 10 }">
|
||||
<a-input-number id="hour" v-model="dataValue" :min="1" :max="1000" @change="onChange" :style="{ display: 'ln', width: '100%' }" />
|
||||
{{ dataValue }}分钟
|
||||
<a-input-number id="hour" v-model="dataValue" :min="1" :max="1000" :style="{ display: 'ln', width: '100%' }" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
|
@ -42,7 +41,7 @@
|
|||
</a-col>
|
||||
|
||||
<!-- 所属行业 -->
|
||||
<a-col :span="9" :offset="3">
|
||||
<!-- <a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="所属行业" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<a-select v-model="form.industryInvolved" placeholder="--请选择--">
|
||||
<a-select-option v-for="(item, index) in industry" :key="index" :value="item.value">
|
||||
|
@ -50,20 +49,20 @@
|
|||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-col> -->
|
||||
|
||||
<!-- 是否为必修课程 -->
|
||||
<a-col :span="9">
|
||||
<!-- <a-col :span="9">
|
||||
<a-form-model-item label="是否为必修" :label-col="{ span: 6 }" :wrapper-col="{ span: 6 }">
|
||||
<a-select v-model="form.isRequired" placeholder="--请选择--">
|
||||
<a-select-option value="1"> 是 </a-select-option>
|
||||
<a-select-option value="0"> 否 </a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-col> -->
|
||||
|
||||
<!-- 选择岗位-人员类型 -->
|
||||
<a-col :span="9" :offset="3">
|
||||
<!-- <a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="选择岗位" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<a-select v-model="form.job" placeholder="--请选择--">
|
||||
<a-select-option v-for="(item, index) in dictPerson" :key="index" :value="item.value">
|
||||
|
@ -71,7 +70,7 @@
|
|||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-col> -->
|
||||
|
||||
<!-- 备注 -->
|
||||
<a-col :span="18" :offset="3">
|
||||
|
@ -146,9 +145,6 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
//显示页面上的数字
|
||||
onChange(dataValue) {},
|
||||
|
||||
//加载数据
|
||||
loadData() {
|
||||
if (this.$route.query.id) {
|
||||
|
|
|
@ -15,54 +15,55 @@
|
|||
课件名称:
|
||||
<a-input placeholder="课件名称" v-model="fileUpload.videoForm.name" style="width: 40%" />
|
||||
</div>
|
||||
<div style="margin-bottom: 30px; margin-top: 20px">
|
||||
<!-- <div style="margin-bottom: 30px; margin-top: 20px">
|
||||
课件分类:
|
||||
<a-tree-select v-model="fileUpload.videoForm.classify" style="width: 300px" :tree-data="coursewareClassfiy" placeholder="请选择课程分类"></a-tree-select>
|
||||
</div>
|
||||
</div> -->
|
||||
<div>课件学时:
|
||||
<a-input-number :min="0" :max="100" :step="1" v-model="fileUpload.videoForm.learnHours" style="width: 140px" />
|
||||
</div>
|
||||
<br />
|
||||
<div>课件学分:
|
||||
<!-- <div>课件学分:
|
||||
<a-input-number :min="0" :max="100" :step="1" v-model="fileUpload.videoForm.learnScore" style="width: 140px" />
|
||||
</div>
|
||||
<br />
|
||||
<br /> -->
|
||||
<div>课件大小:
|
||||
<a-input :disabled="true" :value="fileUpload.videoForm.sizeStr" style="width: 140px" /> MB
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<span v-if="this.successOssFile.length < 1">视频上传:</span> <a-upload list-type="picture" :default-file-list="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo" accept=".mp4"
|
||||
:disabled="this.uploadLoading">
|
||||
<span v-if="this.successOssFile.length < 1">视频上传:
|
||||
</span> <a-upload list-type="picture" event="true" :default-file-list="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo" accept=".mp4" :disabled="this.uploadLoading">
|
||||
<a-button v-if="this.successOssFile.length <1">
|
||||
<a-icon type="upload" /> {{this.uploadButtonText}}
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</div>
|
||||
<a-progress :percent="schedule" v-if="schedule > 0" />
|
||||
</a-card>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
|
||||
<!-- <a-tab-pane key="2" tab="文本上传" :disabled="fileUpload.textForm.disabled"> -->
|
||||
<a-tab-pane key="2" tab="文本上传" :disabled="true">
|
||||
<a-tab-pane key="2" tab="文本上传" :disabled="fileUpload.textForm.disabled">
|
||||
<!-- <a-tab-pane key="2" tab="文本上传" :disabled="true"> -->
|
||||
<div v-if="fileUpload.tabkey == 2" style="background: #ececec; padding: 30px">
|
||||
<a-card title="文本上传" :bordered="false" style="width: 100%">
|
||||
<div style="margin-bottom: 30px">
|
||||
课件名称:
|
||||
<a-input placeholder="课件名称" v-model="fileUpload.textForm.name" style="width: 40%" />
|
||||
</div>
|
||||
<div style="margin-bottom: 30px; margin-top: 20px">
|
||||
<!-- <div style="margin-bottom: 30px; margin-top: 20px">
|
||||
课件分类:
|
||||
<a-tree-select v-model="fileUpload.textForm.classify" style="width: 300px" :tree-data="coursewareClassfiy" placeholder="请选择课程分类"></a-tree-select>
|
||||
</div>
|
||||
</div> -->
|
||||
<div>课件学时:
|
||||
<a-input-number :min="0" :max="10" :step="0.1" v-model="fileUpload.textForm.learnHours" style="width: 140px" />
|
||||
</div>
|
||||
<br />
|
||||
<div>课件学分:
|
||||
<!-- <div>课件学分:
|
||||
<a-input-number :min="0" :max="10" :step="0.1" v-model="fileUpload.textForm.learnScore" style="width: 140px" />
|
||||
</div>
|
||||
<br />
|
||||
<br /> -->
|
||||
<div>课件大小:
|
||||
<a-input-number :disabled="true" v-model="fileUpload.textForm.sizeStr" :min="0" style="width: 140px" /> MB
|
||||
</div>
|
||||
|
@ -150,18 +151,19 @@ import { ossUpload } from '@/api/sys/oss';
|
|||
import { coursewareAdd, coursewareClassList } from '@/api/course/courseware';
|
||||
// import { listToTree } from '@/utils/util'
|
||||
import { dictToTree } from '@/utils/util';
|
||||
import { dictionaryDropDown } from '@/api/sys/dictionaryItem';
|
||||
// import { dictionaryDropDown } from '@/api/sys/dictionaryItem';
|
||||
|
||||
// const rootParentId = 0
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
schedule: 0, //进度
|
||||
isSave: false,
|
||||
pageName: '',
|
||||
// treeData: [],
|
||||
ifResources: this.$route.query.ifResources,
|
||||
coursewareClassfiy: [],
|
||||
// coursewareClassfiy: [],
|
||||
courseware: {}, //课件详情
|
||||
queryParam: { coursewareId: this.$route.query.coursewareId }, //编辑传参
|
||||
successOssFile: [],
|
||||
|
@ -203,7 +205,7 @@ export default {
|
|||
components: { STable },
|
||||
created() {
|
||||
//数据字典加载
|
||||
this.dictionaryDropDown();
|
||||
// this.dictionaryDropDown();
|
||||
//判断是否加载数据
|
||||
if (this.queryParam.coursewareId) this.load();
|
||||
|
||||
|
@ -227,13 +229,13 @@ export default {
|
|||
// this.classfiy()
|
||||
},
|
||||
|
||||
dictionaryDropDown() {
|
||||
// 课件分类
|
||||
dictionaryDropDown({ dictionaryCode: '0009' }).then(res => {
|
||||
// 词典转树结构
|
||||
this.coursewareClassfiy = dictToTree(res.data, [], 0);
|
||||
});
|
||||
},
|
||||
// dictionaryDropDown() {
|
||||
// // 课件分类
|
||||
// dictionaryDropDown({ dictionaryCode: '0009' }).then(res => {
|
||||
// // 词典转树结构
|
||||
// this.coursewareClassfiy = dictToTree(res.data, [], 0);
|
||||
// });
|
||||
// },
|
||||
|
||||
//返回
|
||||
goback() {
|
||||
|
@ -277,11 +279,10 @@ export default {
|
|||
},
|
||||
|
||||
beforeUpload(file) {
|
||||
//文件类型 (后缀)
|
||||
// var suffix = file.name.substring(file.name.lastIndexOf('.') + 1);
|
||||
// if (this.fileUpload.tabkey == '1' && suffix != 'mp4') {
|
||||
// return this.$message.error('文件类型必须是mp4');
|
||||
// }
|
||||
console.log('file', file);
|
||||
const _this = this;
|
||||
|
||||
console.log("fileSize",file.size)
|
||||
|
||||
//告知用户是否正在上传
|
||||
this.uploadLoading = true;
|
||||
|
@ -300,8 +301,25 @@ export default {
|
|||
header['Content-Type'] = 'multipart/form-data';
|
||||
header[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN);
|
||||
|
||||
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)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// { headers: header }
|
||||
axios
|
||||
.post(ossUpload(), data, { headers: header })
|
||||
.post(ossUpload(), data, config)
|
||||
.then(res => {
|
||||
this.isSave = false;
|
||||
this.uploadLoading = false;
|
||||
|
@ -309,23 +327,23 @@ export default {
|
|||
if (res.data.code === 200) {
|
||||
this.$message.success('上传成功!');
|
||||
|
||||
this.schedule = 100;
|
||||
res.data.uuid = file.uid;
|
||||
res.data.size = file.size;
|
||||
this.successOssFile.push(res.data);
|
||||
|
||||
//刷新文件大小
|
||||
this.refreshFileSize();
|
||||
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
this.$refs.inputFile.value = '';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.log("进来了!!!!!",err);
|
||||
this.$message.error(err);
|
||||
this.uploadButtonText = '选择文件';
|
||||
});
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
@ -380,13 +398,12 @@ export default {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.schedule = 0;
|
||||
this.refreshFileSize();
|
||||
},
|
||||
|
||||
//保存
|
||||
save() {
|
||||
|
||||
//视频赋给表单里面的字段
|
||||
this.successOssFile.forEach((item, index) => {
|
||||
this.videoPath.push(item.url);
|
||||
|
@ -525,7 +542,7 @@ export default {
|
|||
successOssFile_['url'] = element.path;
|
||||
successOssFile_['size'] = element.size;
|
||||
this.successOssFile.push(successOssFile_);
|
||||
console.log("文件问见",this.successOssFile);
|
||||
console.log('文件问见', this.successOssFile);
|
||||
});
|
||||
|
||||
if (this.courseware.type == '1') {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<a-card :bordered="false" :title="pageName">
|
||||
<template slot="extra">
|
||||
<h4 style="margin-right: 15px; display:inline-block">{{ courseware.classifyName }}</h4>
|
||||
<!-- <h4 style="margin-right: 15px; display:inline-block">{{ courseware.classifyName }}</h4> -->
|
||||
<a-button v-if="!!!coursewareId" size="small" @click="goback">返回</a-button>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue