Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

This commit is contained in:
Yjhon 2022-03-12 15:17:00 +08:00
commit 4c8f3c5df6
6 changed files with 80 additions and 74 deletions

View File

@ -29,8 +29,7 @@
<!-- 课时 --> <!-- 课时 -->
<a-col :span="9"> <a-col :span="9">
<a-form-item label="课时" :label-col="{ span: 4 }" :wrapper-col="{ span: 10 }"> <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%' }" /> <a-input-number id="hour" v-model="dataValue" :min="1" :max="1000" :style="{ display: 'ln', width: '100%' }" />
{{ dataValue }}分钟
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -42,7 +41,7 @@
</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-form-model-item label="所属行业" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
<a-select v-model="form.industryInvolved" placeholder="--请选择--"> <a-select v-model="form.industryInvolved" placeholder="--请选择--">
<a-select-option v-for="(item, index) in industry" :key="index" :value="item.value"> <a-select-option v-for="(item, index) in industry" :key="index" :value="item.value">
@ -50,20 +49,20 @@
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-model-item> </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-form-model-item label="是否为必修" :label-col="{ span: 6 }" :wrapper-col="{ span: 6 }">
<a-select v-model="form.isRequired" placeholder="--请选择--"> <a-select v-model="form.isRequired" placeholder="--请选择--">
<a-select-option value="1"> </a-select-option> <a-select-option value="1"> </a-select-option>
<a-select-option value="0"> </a-select-option> <a-select-option value="0"> </a-select-option>
</a-select> </a-select>
</a-form-model-item> </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-form-model-item label="选择岗位" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
<a-select v-model="form.job" placeholder="--请选择--"> <a-select v-model="form.job" placeholder="--请选择--">
<a-select-option v-for="(item, index) in dictPerson" :key="index" :value="item.value"> <a-select-option v-for="(item, index) in dictPerson" :key="index" :value="item.value">
@ -71,7 +70,7 @@
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col> -->
<!-- 备注 --> <!-- 备注 -->
<a-col :span="18" :offset="3"> <a-col :span="18" :offset="3">
@ -146,9 +145,6 @@ export default {
}, },
methods: { methods: {
//
onChange(dataValue) {},
// //
loadData() { loadData() {
if (this.$route.query.id) { if (this.$route.query.id) {

View File

@ -8,61 +8,62 @@
<a-tab-pane key="1" tab="文件上传"> <a-tab-pane key="1" tab="文件上传">
<a-tabs v-model="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 v-if="fileUpload.tabkey == 1" 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">
课件名称&nbsp; 课件名称&nbsp;
<a-input placeholder="课件名称" v-model="fileUpload.videoForm.name" style="width: 40%" /> <a-input placeholder="课件名称" v-model="fileUpload.videoForm.name" style="width: 40%" />
</div> </div>
<div style="margin-bottom: 30px; margin-top: 20px"> <!-- <div style="margin-bottom: 30px; margin-top: 20px">
课件分类&nbsp; 课件分类&nbsp;
<a-tree-select v-model="fileUpload.videoForm.classify" style="width: 300px" :tree-data="coursewareClassfiy" placeholder="请选择课程分类"></a-tree-select> <a-tree-select v-model="fileUpload.videoForm.classify" style="width: 300px" :tree-data="coursewareClassfiy" placeholder="请选择课程分类"></a-tree-select>
</div> </div> -->
<div>课件学时&nbsp; <div>课件学时&nbsp;
<a-input-number :min="0" :max="100" :step="1" v-model="fileUpload.videoForm.learnHours" style="width: 140px" /> <a-input-number :min="0" :max="100" :step="1" v-model="fileUpload.videoForm.learnHours" style="width: 140px" />
</div> </div>
<br /> <br />
<div>课件学分&nbsp; <!-- <div>课件学分&nbsp;
<a-input-number :min="0" :max="100" :step="1" v-model="fileUpload.videoForm.learnScore" style="width: 140px" /> <a-input-number :min="0" :max="100" :step="1" v-model="fileUpload.videoForm.learnScore" style="width: 140px" />
</div> </div>
<br /> <br /> -->
<div>课件大小&nbsp; <div>课件大小&nbsp;
<a-input :disabled="true" :value="fileUpload.videoForm.sizeStr" style="width: 140px" />&nbsp;&nbsp;&nbsp; MB <a-input :disabled="true" :value="fileUpload.videoForm.sizeStr" style="width: 140px" />&nbsp;&nbsp;&nbsp; MB
</div> </div>
<br /> <br />
<div> <div>
<span v-if="this.successOssFile.length < 1">视频上传</span>&nbsp; <a-upload list-type="picture" :default-file-list="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo" accept=".mp4" <span v-if="this.successOssFile.length < 1">视频上传
:disabled="this.uploadLoading"> </span>&nbsp; <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-button v-if="this.successOssFile.length <1">
<a-icon type="upload" /> {{this.uploadButtonText}} <a-icon type="upload" /> {{this.uploadButtonText}}
</a-button>&nbsp;&nbsp;&nbsp; </a-button>&nbsp;&nbsp;&nbsp;
</a-upload> </a-upload>
</div> </div>
<a-progress :percent="schedule" v-if="schedule > 0" />
</a-card> </a-card>
</div> </div>
</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">
<a-tab-pane key="2" tab="文本上传" :disabled="true"> <!-- <a-tab-pane key="2" tab="文本上传" :disabled="true"> -->
<div v-if="fileUpload.tabkey == 2" 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">
课件名称&nbsp; 课件名称&nbsp;
<a-input placeholder="课件名称" v-model="fileUpload.textForm.name" style="width: 40%" /> <a-input placeholder="课件名称" v-model="fileUpload.textForm.name" style="width: 40%" />
</div> </div>
<div style="margin-bottom: 30px; margin-top: 20px"> <!-- <div style="margin-bottom: 30px; margin-top: 20px">
课件分类&nbsp; 课件分类&nbsp;
<a-tree-select v-model="fileUpload.textForm.classify" style="width: 300px" :tree-data="coursewareClassfiy" placeholder="请选择课程分类"></a-tree-select> <a-tree-select v-model="fileUpload.textForm.classify" style="width: 300px" :tree-data="coursewareClassfiy" placeholder="请选择课程分类"></a-tree-select>
</div> </div> -->
<div>课件学时&nbsp; <div>课件学时&nbsp;
<a-input-number :min="0" :max="10" :step="0.1" v-model="fileUpload.textForm.learnHours" style="width: 140px" /> <a-input-number :min="0" :max="10" :step="0.1" v-model="fileUpload.textForm.learnHours" style="width: 140px" />
</div> </div>
<br /> <br />
<div>课件学分&nbsp; <!-- <div>课件学分&nbsp;
<a-input-number :min="0" :max="10" :step="0.1" v-model="fileUpload.textForm.learnScore" style="width: 140px" /> <a-input-number :min="0" :max="10" :step="0.1" v-model="fileUpload.textForm.learnScore" style="width: 140px" />
</div> </div>
<br /> <br /> -->
<div>课件大小&nbsp; <div>课件大小&nbsp;
<a-input-number :disabled="true" v-model="fileUpload.textForm.sizeStr" :min="0" style="width: 140px" />&nbsp;&nbsp;&nbsp; MB <a-input-number :disabled="true" v-model="fileUpload.textForm.sizeStr" :min="0" style="width: 140px" />&nbsp;&nbsp;&nbsp; MB
</div> </div>
@ -150,18 +151,19 @@ import { ossUpload } from '@/api/sys/oss';
import { coursewareAdd, coursewareClassList } from '@/api/course/courseware'; import { coursewareAdd, coursewareClassList } from '@/api/course/courseware';
// import { listToTree } from '@/utils/util' // import { listToTree } from '@/utils/util'
import { dictToTree } from '@/utils/util'; import { dictToTree } from '@/utils/util';
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'; // import { dictionaryDropDown } from '@/api/sys/dictionaryItem';
// const rootParentId = 0 // const rootParentId = 0
export default { export default {
data() { data() {
return { return {
isSave:false, schedule: 0, //
isSave: false,
pageName: '', pageName: '',
// treeData: [], // treeData: [],
ifResources: this.$route.query.ifResources, ifResources: this.$route.query.ifResources,
coursewareClassfiy: [], // coursewareClassfiy: [],
courseware: {}, // courseware: {}, //
queryParam: { coursewareId: this.$route.query.coursewareId }, // queryParam: { coursewareId: this.$route.query.coursewareId }, //
successOssFile: [], successOssFile: [],
@ -203,7 +205,7 @@ export default {
components: { STable }, components: { STable },
created() { created() {
// //
this.dictionaryDropDown(); // this.dictionaryDropDown();
// //
if (this.queryParam.coursewareId) this.load(); if (this.queryParam.coursewareId) this.load();
@ -227,13 +229,13 @@ export default {
// this.classfiy() // this.classfiy()
}, },
dictionaryDropDown() { // dictionaryDropDown() {
// // //
dictionaryDropDown({ dictionaryCode: '0009' }).then(res => { // dictionaryDropDown({ dictionaryCode: '0009' }).then(res => {
// // //
this.coursewareClassfiy = dictToTree(res.data, [], 0); // this.coursewareClassfiy = dictToTree(res.data, [], 0);
}); // });
}, // },
// //
goback() { goback() {
@ -277,18 +279,17 @@ export default {
}, },
beforeUpload(file) { beforeUpload(file) {
// () console.log('file', file);
// var suffix = file.name.substring(file.name.lastIndexOf('.') + 1); const _this = this;
// if (this.fileUpload.tabkey == '1' && suffix != 'mp4') {
// return this.$message.error('mp4'); console.log("fileSize",file.size)
// }
// //
this.uploadLoading = true; this.uploadLoading = true;
this.uploadButtonText = '上传中...'; this.uploadButtonText = '上传中...';
// //
this.isSave= true; this.isSave = true;
// //
const data = new FormData(); const data = new FormData();
@ -300,32 +301,50 @@ export default {
header['Content-Type'] = 'multipart/form-data'; header['Content-Type'] = 'multipart/form-data';
header[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN); header[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN);
var config = {
headers: header,
onUploadProgress: function (e) {
console.log(e);
//lengthComputable
//lengthComputablefalsee.totale.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 axios
.post(ossUpload(), data, { headers: header }) .post(ossUpload(), data, config)
.then(res => { .then(res => {
this.isSave = false; this.isSave = false;
this.uploadLoading = false; this.uploadLoading = false;
this.uploadButtonText = '选择文件'; this.uploadButtonText = '选择文件';
if (res.data.code === 200) { if (res.data.code === 200) {
this.$message.success('上传成功!'); this.$message.success('上传成功!');
this.schedule = 100;
res.data.uuid = file.uid; res.data.uuid = file.uid;
res.data.size = file.size; res.data.size = file.size;
this.successOssFile.push(res.data); this.successOssFile.push(res.data);
// //
this.refreshFileSize(); this.refreshFileSize();
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
this.$refs.inputFile.value = ''; this.$refs.inputFile.value = '';
} }
}) })
.catch(err => { .catch(err => {
this.$message.error(err); console.log("进来了!!!!!",err);
this.uploadButtonText = '选择文件'; // data.delete("file") //
// this.uploadButtonText = '';
this.$message.error("上传失败!视频超出可上传大小范围");
}); });
return false; return false;
}, },
@ -380,13 +399,12 @@ export default {
break; break;
} }
} }
this.schedule = 0;
this.refreshFileSize(); this.refreshFileSize();
}, },
// //
save() { save() {
// //
this.successOssFile.forEach((item, index) => { this.successOssFile.forEach((item, index) => {
this.videoPath.push(item.url); this.videoPath.push(item.url);
@ -509,7 +527,7 @@ export default {
this.fileUpload.textForm.disabled = true; this.fileUpload.textForm.disabled = true;
this.videoServerLink.disabled = true; this.videoServerLink.disabled = true;
this.thirdAddress.disabled = true; this.thirdAddress.disabled = true;
// //
if (this.courseware.type == '1' || this.courseware.type == '2') { if (this.courseware.type == '1' || this.courseware.type == '2') {
this.parentTabKey = '1'; this.parentTabKey = '1';
@ -525,7 +543,7 @@ 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); console.log('文件问见', this.successOssFile);
}); });
if (this.courseware.type == '1') { if (this.courseware.type == '1') {
@ -558,19 +576,6 @@ export default {
} }
}, },
//
// initialize(key){
// if(key == 1) {
// this.fileUpload.videoForm.sizeStr = 0
// this.fileUpload.videoForm.learnHours == 0
// this.fileUpload.videoForm.learnScore= 0
// }
// if(key == 2){
// this.fileUpload.textForm.sizeStr = 0
// this.fileUpload.textForm.learnHours = 0
// this.fileUpload.textForm.learnScore= 0.0
// }
// },
}, },
}; };
</script> </script>

View File

@ -58,14 +58,7 @@ export default {
}, },
columns: [ columns: [
{ title: '课件名称', width: '160px', align: 'center', dataIndex: 'name', key: 'name' }, { title: '课件名称', width: '160px', align: 'center', dataIndex: 'name', key: 'name' },
{ { title: '课件时长/分', width: '160px', align: 'center', dataIndex: 'duration', key: 'duration' },
title: '课件分类',
width: '300px',
align: 'center',
dataIndex: 'classifyName',
key: 'classifyName',
},
{ title: '课时/分', width: '160px', align: 'center', dataIndex: 'duration', key: 'duration' },
{ title: '课件大小(MB)', width: '160px', align: 'center', dataIndex: 'sizeStr', key: 'sizeStr' }, { title: '课件大小(MB)', width: '160px', align: 'center', dataIndex: 'sizeStr', key: 'sizeStr' },
{ title: '操作', key: 'operation', width: '200px', align: 'center', scopedSlots: { customRender: 'action' } }, { title: '操作', key: 'operation', width: '200px', align: 'center', scopedSlots: { customRender: 'action' } },
], ],

View File

@ -1,7 +1,7 @@
<template> <template>
<a-card :bordered="false" :title="pageName"> <a-card :bordered="false" :title="pageName">
<template slot="extra"> <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> <a-button v-if="!!!coursewareId" size="small" @click="goback">返回</a-button>
</template> </template>

View File

@ -79,6 +79,7 @@
<a-select-option :value="1">新闻资讯</a-select-option> <a-select-option :value="1">新闻资讯</a-select-option>
<a-select-option :value="2">公告详情</a-select-option> <a-select-option :value="2">公告详情</a-select-option>
<a-select-option :value="3">通知</a-select-option> <a-select-option :value="3">通知</a-select-option>
<a-select-option :value="4">必读文件</a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
@ -98,6 +99,13 @@
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item label="上传封面图">
<db-upload v-model="fileList2" type="img" max="1"></db-upload>
</a-form-model-item>
</a-col>
</a-row>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="上传附件"> <a-form-model-item label="上传附件">
@ -153,6 +161,7 @@ export default {
content: '' content: ''
}, },
fileList: [], fileList: [],
fileList2: [],
timeShow: true, timeShow: true,
classHourShow: true, classHourShow: true,
rules: { rules: {
@ -189,6 +198,7 @@ export default {
// form.publishTime = moment(form.publishTime) // form.publishTime = moment(form.publishTime)
this.form = form this.form = form
this.fileList = JSON.parse(res.data.file) this.fileList = JSON.parse(res.data.file)
this.fileList2 = JSON.parse(res.data.cover)
}) })
}, },
save() { save() {
@ -203,6 +213,7 @@ export default {
form.isNowPublish = 0 form.isNowPublish = 0
} }
form.file = JSON.stringify(this.fileList) form.file = JSON.stringify(this.fileList)
form.cover = JSON.stringify(this.fileList2)
noticeAdd(form).then(res => { noticeAdd(form).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.$message.success('操作成功') this.$message.success('操作成功')

View File

@ -175,7 +175,8 @@
const typeMap = { const typeMap = {
1: '新闻资讯', 1: '新闻资讯',
2: '公告详情', 2: '公告详情',
3: '通知' 3: '通知',
4: '必读公告'
} }
return typeMap[type] return typeMap[type]
}, },