Commit fbd0e415 authored by 王飞龙's avatar 王飞龙

课程管理 课程资料添加

parent 8ee3176e
...@@ -147,6 +147,20 @@ export function uploadVideo(data) { ...@@ -147,6 +147,20 @@ export function uploadVideo(data) {
data data
}) })
} }
// 上传压缩包
export function uploadZip(data) {
return request({
url: '/bfile/uploadData',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
transformRequest: [(data) => {
return data
}],
data
})
}
// 课程管理-章节查询PDF信息 // 课程管理-章节查询PDF信息
export function findPdfInfo(data) { export function findPdfInfo(data) {
data = Qs.stringify(data) data = Qs.stringify(data)
...@@ -157,16 +171,16 @@ export function findPdfInfo(data) { ...@@ -157,16 +171,16 @@ export function findPdfInfo(data) {
headers: {} headers: {}
}) })
} }
export function findZIpInfo(data) {
data = Qs.stringify(data)
return request({
url: '/bfile/findDataUrl',
method: 'post',
data,
headers: {}
})
}
// 课程管理-根据章id查询节 // 课程管理-根据章id查询节
// export function findSection(data) {
// data = Qs.stringify(data)
// return request({
// url: '/bchapter/querySections',
// method: 'get',
// data,
// headers: {}
// })
// }
export function findSection(query) { export function findSection(query) {
return request({ return request({
url: '/bchapter/querySections', url: '/bchapter/querySections',
...@@ -192,6 +206,13 @@ export function delData(query) { ...@@ -192,6 +206,13 @@ export function delData(query) {
params: query params: query
}) })
} }
export function delZip(query) {
return request({
url: '/bfile/deleteDataFile',
method: 'delete',
params: query
})
}
// 课程管理 岗位分类查询 // 课程管理 岗位分类查询
export function queryTeaLessonJobs(query) { export function queryTeaLessonJobs(query) {
...@@ -219,3 +240,12 @@ export function updateCourseStatus(data) { ...@@ -219,3 +240,12 @@ export function updateCourseStatus(data) {
data data
}) })
} }
// 下载zip文件
export function downloadZip(params) {
return request({
url: '/bfile/download/',
method: 'post',
responseType: 'blob',
params
})
}
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<div class="btn-group"> <div class="btn-group">
<el-button type="info" icon="plus" size="small" @click="viewSwitch.chapterForm = true">添加章</el-button> <el-button type="info" icon="plus" size="small" @click="viewSwitch.chapterForm = true">添加章</el-button>
<el-button type="info" icon="plus" size="small" @click="viewSwitch.sectionForm = true">添加节</el-button> <el-button type="info" icon="plus" size="small" @click="viewSwitch.sectionForm = true">添加节</el-button>
<el-button type="info" icon="plus" size="small" @click="viewSwitch.subsegmentForm = true">添加子节</el-button> <el-button type="info" icon="plus" size="small" @click="openSubsegmentDialog()">添加子节</el-button>
</div> </div>
<!--弹出层--> <!--弹出层-->
<el-dialog title="添加章" :visible.sync="viewSwitch.chapterForm" @open="setCurrentForm('chapterForm')" @close="formClear"> <el-dialog title="添加章" :visible.sync="viewSwitch.chapterForm" @open="setCurrentForm('chapterForm')" @close="formClear">
...@@ -44,18 +44,18 @@ ...@@ -44,18 +44,18 @@
<el-form-item label="节标题" :label-width="formLabelWidth" prop="text"> <el-form-item label="节标题" :label-width="formLabelWidth" prop="text">
<el-input v-model="sectionForm.text" auto-complete="off" placeholder="最多输入50个字符" :maxlength="50" /> <el-input v-model="sectionForm.text" auto-complete="off" placeholder="最多输入50个字符" :maxlength="50" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="学时" :label-width="formLabelWidth" prop="classHours">--> <!-- <el-form-item label="学时" :label-width="formLabelWidth" prop="classHours">-->
<!-- <el-radio-group v-model="sectionForm.classHours" fill="#F7BA2A">--> <!-- <el-radio-group v-model="sectionForm.classHours" fill="#F7BA2A">-->
<!-- <el-radio :label="1">1学时</el-radio>--> <!-- <el-radio :label="1">1学时</el-radio>-->
<!-- <el-radio :label="0">0学时</el-radio>--> <!-- <el-radio :label="0">0学时</el-radio>-->
<!-- </el-radio-group>--> <!-- </el-radio-group>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="教学手段" :label-width="formLabelWidth" prop="stuMeans">--> <!-- <el-form-item label="教学手段" :label-width="formLabelWidth" prop="stuMeans">-->
<!-- <el-checkbox-group v-model="sectionForm.stuMeans">--> <!-- <el-checkbox-group v-model="sectionForm.stuMeans">-->
<!-- <el-checkbox label="视频" name="stuMeans" />--> <!-- <el-checkbox label="视频" name="stuMeans" />-->
<!-- &lt;!&ndash; <el-checkbox label="PDF" name="stuMeans" />&ndash;&gt;--> <!-- &lt;!&ndash; <el-checkbox label="PDF" name="stuMeans" />&ndash;&gt;-->
<!-- </el-checkbox-group>--> <!-- </el-checkbox-group>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="warning" :plain="true" @click="viewSwitch.sectionForm = false">取 消</el-button> <el-button type="warning" :plain="true" @click="viewSwitch.sectionForm = false">取 消</el-button>
...@@ -262,16 +262,16 @@ ...@@ -262,16 +262,16 @@
<i class="close" title="删除该节" @click="delSec(itemChild.businessId)" /> <i class="close" title="删除该节" @click="delSec(itemChild.businessId)" />
<!-- 资源按钮组 --> <!-- 资源按钮组 -->
<div style="display:inline-block;float:right"> <!-- <div style="display:inline-block;float:right">-->
<span v-show="processRes(2,itemChild.isTest)"> <!-- <span v-show="processRes(2,itemChild.isTest)">-->
<i v-show="itemChild.videoUrl!==''" class="chapter-icon videoBtn" title="视频" @click="openUploadDialog('视频维护',itemChild,0,'只能上传以.mp4格式/.rmvb格式/.avi结尾的文件')" /> <!-- 视频 --> <!-- <i v-show="itemChild.videoUrl!==''" class="chapter-icon videoBtn" title="视频" @click="openUploadDialog('视频维护',itemChild,0,'只能上传以.mp4格式/.rmvb格式/.avi结尾的文件')" /> &lt;!&ndash; 视频 &ndash;&gt;-->
<i v-show="itemChild.videoUrl===''" class="chapter-icon videoBtnNo" title="视频未上传" @click="openUploadDialog('视频上传',itemChild,0,'只能上传以.mp4格式/.rmvb格式/.avi结尾的文件')" /> <!-- 视频未添加 --> <!-- <i v-show="itemChild.videoUrl===''" class="chapter-icon videoBtnNo" title="视频未上传" @click="openUploadDialog('视频上传',itemChild,0,'只能上传以.mp4格式/.rmvb格式/.avi结尾的文件')" /> &lt;!&ndash; 视频未添加 &ndash;&gt;-->
</span> <!-- </span>-->
<span v-show="processRes(4,itemChild.isTest)"> <!-- <span v-show="processRes(4,itemChild.isTest)">-->
<i v-show="itemChild.pdfUrl!==''" class="chapter-icon pdfBtn" title="PDF" @click="openUploadDialog('PDF维护',itemChild,1,'只能上传以.pdf结尾的文件')" /> <!-- PDF --> <!-- <i v-show="itemChild.pdfUrl!==''" class="chapter-icon pdfBtn" title="PDF" @click="openUploadDialog('PDF维护',itemChild,1,'只能上传以.pdf结尾的文件')" /> &lt;!&ndash; PDF &ndash;&gt;-->
<i v-show="itemChild.pdfUrl===''" class="chapter-icon pdfBtnNo" title="PDF未上传" @click="openUploadDialog('PDF上传',itemChild,3,'只能上传以.pdf结尾的文件')" /> <!-- PDF未添加 --> <!-- <i v-show="itemChild.pdfUrl===''" class="chapter-icon pdfBtnNo" title="PDF未上传" @click="openUploadDialog('PDF上传',itemChild,3,'只能上传以.pdf结尾的文件')" /> &lt;!&ndash; PDF未添加 &ndash;&gt;-->
</span> <!-- </span>-->
</div> <!-- </div>-->
<dl> <dl>
<dt v-for="(subItem, subIndex) in itemChild.childList" class="sub-section"> <dt v-for="(subItem, subIndex) in itemChild.childList" class="sub-section">
<span>{{ index+1 }}.{{ indexChild+1 }}.{{ subIndex+1 }}小节</span> <span>{{ index+1 }}.{{ indexChild+1 }}.{{ subIndex+1 }}小节</span>
...@@ -338,7 +338,15 @@ import { ...@@ -338,7 +338,15 @@ import {
blessonAdd, blessonAdd,
bchapterAdd, bchapterAdd,
bchapterRemove, bchapterRemove,
updateTopChapter, updateDownChapter, uploadVideo, findVideoUrl, findPdfInfo, findPdfUrl, delData, findSection updateTopChapter,
updateDownChapter,
uploadVideo,
findVideoUrl,
findPdfInfo,
findPdfUrl,
delData,
findSection,
uploadZip
} from '@/api/courseManagement/indexApi' } from '@/api/courseManagement/indexApi'
export default { export default {
name: 'CourseCatalogues', name: 'CourseCatalogues',
...@@ -872,7 +880,6 @@ export default { ...@@ -872,7 +880,6 @@ export default {
// 添加子节 // 添加子节
addSubsegment(formName) { addSubsegment(formName) {
const _this = this const _this = this
console.log('111', formName)
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
// 把旧值清空 // 把旧值清空
...@@ -976,6 +983,7 @@ export default { ...@@ -976,6 +983,7 @@ export default {
message: '网络错误5', message: '网络错误5',
type: 'error' type: 'error'
}) })
_this.subsegmentClear()
_this.viewSwitch.subsegmentForm = false _this.viewSwitch.subsegmentForm = false
}) })
} }
...@@ -1000,6 +1008,28 @@ export default { ...@@ -1000,6 +1008,28 @@ export default {
setCurrentForm(formName) { setCurrentForm(formName) {
this.currentForm = formName this.currentForm = formName
}, },
// 打开子节对话框
openSubsegmentDialog(item) {
this.viewSwitch.subsegmentForm = true
this.subsegmentClear()
},
// 子节列表清空
subsegmentClear() {
this.$refs.subsegmentForm.resetFields()
// 数据清空
this.subsegmentForm = {
stuHourRadio: '', // 学时单选按钮
text: '',
chapterId: '',
chapterName: '',
stuMeans: [],
stuMeansValue: '',
stuMeansFile: '',
classHours: 1,
stuMeansOpt: false,
sectionId: ''
}
},
// 表单对话框关闭 // 表单对话框关闭
formClear() { formClear() {
this.$refs[this.currentForm].resetFields() this.$refs[this.currentForm].resetFields()
...@@ -1496,6 +1526,7 @@ export default { ...@@ -1496,6 +1526,7 @@ export default {
background: 'rgba(0, 0, 0, 0.5)', background: 'rgba(0, 0, 0, 0.5)',
customClass: 'myLoading' customClass: 'myLoading'
}) })
console.log('this.resForm.filelist11111111111111', this.resForm.filelist)
const fileList = this.resForm.filelist.map(item => item.raw) const fileList = this.resForm.filelist.map(item => item.raw)
var formData = new FormData() // 当前为空 var formData = new FormData() // 当前为空
formData.append('type', type) formData.append('type', type)
...@@ -1506,6 +1537,7 @@ export default { ...@@ -1506,6 +1537,7 @@ export default {
}) })
formData.append('lessonId', _this.lessonId) formData.append('lessonId', _this.lessonId)
formData.append('temp', 'pdf') formData.append('temp', 'pdf')
console.log('formData1111', formData)
uploadVideo(formData).then(res => { uploadVideo(formData).then(res => {
loading.close() loading.close()
if (res.code === 200) { if (res.code === 200) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4"> <div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true"> <el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="课程名称" prop="lessonName"> <el-form-item label="课程名称" prop="lessonName">
<el-input v-model="queryParams.lessonName" placeholder="课程名称" :maxlength="15" style="width: 210px" /> <el-input v-model="queryParams.lessonName" placeholder="课程名称" :maxlength="15" style="width: 200px" />
</el-form-item> </el-form-item>
<!-- 课程方案--> <!-- 课程方案-->
<el-form-item label="课程方案" prop="classPlan"> <el-form-item label="课程方案" prop="classPlan">
...@@ -386,7 +386,7 @@ ...@@ -386,7 +386,7 @@
:class="commonField.updateClass" :class="commonField.updateClass"
:type="commonField.typeParent" :type="commonField.typeParent"
:size="commonField.size" :size="commonField.size"
@click="handleProfile(scope.$index)" @click="handleProfile(scope.row)"
>课程资料</el-button> >课程资料</el-button>
<el-button <el-button
:class="commonField.updateClass" :class="commonField.updateClass"
...@@ -439,7 +439,7 @@ ...@@ -439,7 +439,7 @@
</el-upload> </el-upload>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="resForm.resView=false">取 消</el-button> <el-button @click="resForm.resView=false">取 消</el-button>
<el-button type="primary" @click="uploadZip">保 存</el-button> <el-button type="primary" @click="uploadFile">保 存</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
...@@ -477,14 +477,45 @@ ...@@ -477,14 +477,45 @@
@close="clearCoverFileList" @close="clearCoverFileList"
> >
<el-button <el-button
@click="resForm.resView = true" type="primary"
@click="openUploadZip"
>上 传</el-button> >上 传</el-button>
<!-- <el-table--> <el-table
<!-- v-loading="fullscreenLoading"--> v-loading="fullscreenLoading"
<!-- :data="profileData"--> style="margin-top: 20px"
<!-- border--> :data="zipList"
<!-- sortable="true"--> border
<!-- >--> sortable="true"
>
<el-table-column align="center" prop="id" label="序号" width="65px">
<template slot-scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="文件名" prop="fileName" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.originalName }}</span>
</template>
</el-table-column>
<!-- 操作-->
<el-table-column align="center" label="操作" width="150">
<template slot-scope="scope">
<el-button
:class="commonField.updateClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="removeFile(scope.row)"
>删除</el-button>
<!-- 下载-->
<el-button
:class="commonField.updateClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="downloadFile(scope.row)"
>下载</el-button>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogProfile=false">取 消</el-button> <el-button @click="dialogProfile=false">取 消</el-button>
...@@ -510,7 +541,7 @@ import { ...@@ -510,7 +541,7 @@ import {
blessonAdd, blessonAdd,
blessonRemove, blessonRemove,
excelImport, excelImport,
defaultUrl, picImport, updateCourseStatus defaultUrl, picImport, updateCourseStatus, uploadVideo, uploadZip, findZIpInfo, delZip, downloadZip
} from '@/api/courseManagement/indexApi' } from '@/api/courseManagement/indexApi'
import commonField from '@/utils/commonField' import commonField from '@/utils/commonField'
import { getDict } from '@/api/system/dict/data' import { getDict } from '@/api/system/dict/data'
...@@ -585,6 +616,7 @@ export default { ...@@ -585,6 +616,7 @@ export default {
// {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, // {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'},
// {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'} // {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}
], ],
lessonId: '',
// 上传用的节id // 上传用的节id
businessId: '', businessId: '',
// 章id // 章id
...@@ -636,7 +668,7 @@ export default { ...@@ -636,7 +668,7 @@ export default {
formLabelWidth: '90px', formLabelWidth: '90px',
// 表格 // 表格
tableData: [], tableData: [],
zipList: [],
lineindex: 0, lineindex: 0,
teacode: '', teacode: '',
...@@ -853,8 +885,11 @@ export default { ...@@ -853,8 +885,11 @@ export default {
}) })
}, },
// 打开课程资料对话框 // 打开课程资料对话框
handleProfile() { handleProfile(data) {
console.log('data', data)
this.dialogProfile = true this.dialogProfile = true
this.lessonId = data.businessId
this.getZipList(this.lessonId)
}, },
// 修改是否企业精品课 // 修改是否企业精品课
handleEntQualityChange(row) { handleEntQualityChange(row) {
...@@ -1405,7 +1440,7 @@ export default { ...@@ -1405,7 +1440,7 @@ export default {
// $("#pic").remove(); // $("#pic").remove();
}, },
// 司马上传压缩包文件 // 司马上传压缩包文件
uploadZip() { uploadFile() {
const file = this.resForm.filelist const file = this.resForm.filelist
const _this = this const _this = this
if (file.length <= 0) { if (file.length <= 0) {
...@@ -1416,23 +1451,138 @@ export default { ...@@ -1416,23 +1451,138 @@ export default {
}) })
} else { } else {
const typeName = file.map(item => item.name.split('.').splice(-1)[0]) const typeName = file.map(item => item.name.split('.').splice(-1)[0])
if (typeName.filter(item => item !== 'pdf').length > 0) { if (typeName.filter(item => item !== 'zip').length > 0) {
_this.$notify({ _this.$notify({
title: '提示', title: '提示',
message: 'PDF只能上传以.pdf结尾的文件', message: '只能上传.zip格式的文件',
type: 'warning' type: 'warning'
}) })
_this.viewSwitch.isLoading = false _this.viewSwitch.isLoading = false
} else { } else {
this.uploadIngPDF(1) this.uploadIngPDF(1)
if (this.firstUpload === false) { // if (this.firstUpload === false) {
setTimeout(() => { // setTimeout(() => {
this.openUploadDialog('PDF维护', this.saveItem, 1, '只能上传以.pdf结尾的文件', this.getUploadVideoPdfUrl) // this.openUploadDialog('PDF维护', this.saveItem, 1, '只能上传以.pdf结尾的文件', this.getUploadVideoPdfUrl)
}, 1500) // }, 1500)
} // }
} }
} }
}, },
uploadIngPDF(type) {
const _this = this
const loading = _this.$loading({
lock: true,
text: '正在上传...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)',
customClass: 'myLoading'
})
const fileList = this.resForm.filelist.map(item => item.raw)
var formData = new FormData() // 当前为空
formData.append('type', type)
formData.append('chapterId', _this.resForm.businessId)
formData.append('file', fileList)
fileList.forEach((file, index) => {
formData.append(`file`, file)
})
formData.append('lessonId', _this.lessonId)
formData.append('temp', 'zip')
uploadZip(formData).then(res => {
loading.close()
if (res.code === 200) {
_this.$message({
message: '上传成功',
type: 'success'
})
_this.resForm.resView = false
_this.resForm.filelist = []
_this.getUploadVideoPdfUrl = res.data
this.dialogProfile = true
this.getZipList()
_this.loadCatalog(_this.lessonId)
} else {
_this.warning(res)
}
}).catch((err) => {
loading.close()
_this.error(err)
})
},
// 打开上传对话框
openUploadZip() {
// 判断已经上传过zip文件数量 如果大于5个则不能上传
if (this.zipList.length >= 5) {
this.$message({
message: '最多上传5个zip文件',
type: 'warning'
})
return
}
this.resForm.resView = true
},
// 查询zip文件
getZipList() {
const _this = this
const params = {
lessonId: _this.lessonId
}
findZIpInfo(params).then(res => {
console.log('res', res)
if (res.code === 200) {
_this.zipList = res.data.ossInfoList
}
}).catch((err) => {
_this.error(err)
})
},
// 删除zip文件
removeFile(data) {
// 二次确认
this.$confirm('是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const _this = this
const params = {
lessonId: _this.lessonId,
ossId: data.businessId
}
console.log('params', params)
delZip(params).then(res => {
if (res.code === 200) {
// _this.success(res)
this.$message({
message: '删除成功',
type: 'success'
})
_this.getZipList()
} else {
_this.warning(res)
}
}).catch((err) => {
_this.error(err)
})
}).catch(() => {
})
},
downloadFile(data) {
console.log('data', data)
const _this = this
const params = {
businessId: data.businessId
}
downloadZip(params).then(res => {
if (res.code === 200) {
// _this.success(res)
window.open(res.data)
} else {
_this.warning(res)
}
}).catch((err) => {
_this.error(err)
})
},
// 上传资源 // 上传资源
handleChange(file, fileList) { handleChange(file, fileList) {
this.resForm.filelist = fileList this.resForm.filelist = fileList
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment