From 36c9db596008c9006510d2d2d58270e946a0ff16 Mon Sep 17 00:00:00 2001 From: 18571350067 Date: Tue, 28 Dec 2021 16:15:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=87=AA=E4=B8=BB?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E8=B5=84=E6=BA=90=E5=BA=93=E3=80=81?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E4=B8=8A=E4=BC=A0=E3=80=81=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=BA=93=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course/courseware.js | 14 +- src/views/course/CourseAdd.vue | 2 +- src/views/course/CourseList.vue | 36 +++- src/views/course/CoursewareAddOrUpdate.vue | 195 +++++++++++---------- src/views/course/CoursewareList.vue | 6 +- src/views/course/CoursewarePreview.vue | 2 +- src/views/course/Resource.vue | 104 +++++++++++ 7 files changed, 249 insertions(+), 110 deletions(-) create mode 100644 src/views/course/Resource.vue diff --git a/src/api/course/courseware.js b/src/api/course/courseware.js index 38fa122..9381252 100644 --- a/src/api/course/courseware.js +++ b/src/api/course/courseware.js @@ -4,8 +4,8 @@ const coursewareApi = { add: '/courseManagement/xmCourseCourseware/addOrUpdate', get: '/courseManagement/xmCourseCourseware/details', del: 'courseManagement/xmCourseCourseware/delete', - classList: '/courseManagement/coursewareClassify/listPage' - + classList: '/courseManagement/coursewareClassify/listPage', + resource:'/courseManagement/xmCourseCourseware/resource' } @@ -45,4 +45,14 @@ export function coursewareDeatil(params) { method: 'get', params: params }) +} + + +// 资源库 +export function resource(params) { + return request({ + url: coursewareApi.resource, + method: 'get', + params: params + }) } \ No newline at end of file diff --git a/src/views/course/CourseAdd.vue b/src/views/course/CourseAdd.vue index 800c472..ecc6286 100644 --- a/src/views/course/CourseAdd.vue +++ b/src/views/course/CourseAdd.vue @@ -194,7 +194,7 @@ export default { //返回 goback() { this.$router.push({ - path: '/course/CourseList', + path: '/course/CourseList/'+this.$route.query.type, query: { courseName: this.$route.query.courseName, }, diff --git a/src/views/course/CourseList.vue b/src/views/course/CourseList.vue index 550496f..c4fd6cc 100644 --- a/src/views/course/CourseList.vue +++ b/src/views/course/CourseList.vue @@ -28,6 +28,7 @@ + \ No newline at end of file diff --git a/src/views/course/CoursewareAddOrUpdate.vue b/src/views/course/CoursewareAddOrUpdate.vue index 66dc950..a227c38 100644 --- a/src/views/course/CoursewareAddOrUpdate.vue +++ b/src/views/course/CoursewareAddOrUpdate.vue @@ -16,17 +16,20 @@
- 课件分类:  + 课件分类:  + + + + --> + +
课件大小:      MB @@ -66,38 +69,8 @@
- 课件分类:  - - {{ (i + 9).toString(36) + i }} - - - 添加分类 - - - + 课件分类:  +
课件大小:      MB @@ -235,14 +208,18 @@ import storage from 'store' import axios from 'axios' import { ossUpload } from '@/api/sys/oss' import { coursewareAdd, coursewareClassList } from '@/api/course/courseware' -import { listToTree } from '@/utils/util' +// import { listToTree } from '@/utils/util' +import { dictToTree } from '@/utils/util' +import { dictionaryDropDown } from '@/api/sys/dictionaryItem' -const rootParentId = 0 +// const rootParentId = 0 export default { data() { return { - treeData: [], + // treeData: [], + ifResources : this.$route.query.ifResources, + coursewareClassfiy: [], courseware: {}, //课件详情 queryParam: { coursewareId: this.$route.query.coursewareId }, //编辑传参 successOssFile: [], @@ -252,7 +229,7 @@ export default { videoPath: [], //用于存放视频路径 fileUpload: { visible: false, - tabkey: '1', + tabkey: this.$route.query.type ? this.$route.query.type : '1', videoForm: { //视频上传表单 sizeStr: '0', //视频大小 @@ -274,24 +251,26 @@ export default { sizeStr: '', type: '4', }, - columns: [ - { - title: '名称', - dataIndex: 'name', - key: 'name', - ellipsis: true, - }, - { - title: '操作', - dataIndex: 'action', - width: '200px', - scopedSlots: { customRender: 'action' }, - }, - ], + // columns: [ + // { + // title: '名称', + // dataIndex: 'name', + // key: 'name', + // ellipsis: true, + // }, + // { + // title: '操作', + // dataIndex: 'action', + // width: '200px', + // scopedSlots: { customRender: 'action' }, + // }, + // ], } }, - components: { STable, listToTree }, + components: { STable }, created() { + //数据字典加载 + this.dictionaryDropDown() //判断是否加载数据 if (this.queryParam.coursewareId) this.load() }, @@ -302,37 +281,44 @@ export default { // this.classfiy() }, - //加载分类标签数据 - classfiy() { - let parameter = {} - return coursewareClassList(Object.assign(parameter, this.queryParam)).then((res) => { - const list2tree1 = (list, parentId) => { - return list.filter((item) => { - // 默认选中第一个节点 - // if (this.treeDataOne) this.treeDataOne.push(item.id) - if (item.parentid === parentId) { - item.children = list2tree1(list, item.id) - return true - } - return false - }) - } - // const coursewareClassList = listToTree(res.data, [], rootParentId) - let coursewareClassList = list2tree1(res.data, 0) - console.log('coursewareClassList::::', coursewareClassList) - this.treeData = coursewareClassList - return coursewareClassList + dictionaryDropDown() { + // 课件分类 + dictionaryDropDown({ dictionaryCode: '0009' }).then((res) => { + // 词典转树结构 + this.coursewareClassfiy = dictToTree(res.data, [], 0) }) }, + //加载分类标签数据 + // classfiy() { + // let parameter = {} + // return coursewareClassList(Object.assign(parameter, this.queryParam)).then((res) => { + // const list2tree1 = (list, parentId) => { + // return list.filter((item) => { + // // 默认选中第一个节点 + // // if (this.treeDataOne) this.treeDataOne.push(item.id) + // if (item.parentid === parentId) { + // item.children = list2tree1(list, item.id) + // return true + // } + // return false + // }) + // } + // // const coursewareClassList = listToTree(res.data, [], rootParentId) + // let coursewareClassList = list2tree1(res.data, 0) + // console.log('coursewareClassList::::', coursewareClassList) + // this.treeData = coursewareClassList + // return coursewareClassList + // }) + // }, + //返回 goback() { - this.$router.push({ - path: '/course/CoursewareList', - query: { - id: this.$route.query.courseId, - }, - }) + if (this.$route.query.courseId) { + this.$router.push({ path: '/course/CoursewareList', query: { id: this.$route.query.courseId } }) + } else { + this.$router.push({ path: '/course/Resource', query: {} }) + } }, //顶级标签页 @@ -466,6 +452,9 @@ export default { //保存 save() { + + console.log("this.ifResources",this.ifResources); + //视频赋给表单里面的字段 this.successOssFile.forEach((item, index) => { this.videoPath.push(item.url) @@ -519,8 +508,10 @@ export default { //给课程ID this.fileUpload.videoForm.courseId = this.$route.query.courseId this.fileUpload.videoForm.videoPath = this.videoPath + this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0 let form = {} form = this.fileUpload.videoForm + console.log('FORM', form) return form }, @@ -536,6 +527,7 @@ export default { this.fileUpload.textForm.type = this.fileUpload.tabkey this.fileUpload.textForm.videoPath = this.videoPath console.log('aaaaaa', this.fileUpload.textForm) + this.fileUpload.textForm.ifResources = this.$route.query.ifResources || 0 let form = {} form = this.fileUpload.textForm return form @@ -582,6 +574,8 @@ 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 @@ -593,25 +587,32 @@ export default { //分配到各自的提交模块 if (this.courseware.type == '1' || this.courseware.type == '2') { this.parentTabKey = '1' + + //遍历文件 + this.courseware.videoList.forEach((element) => { + let successOssFile_ = {} + successOssFile_['id'] = element.id + successOssFile_['uid'] = element.id + successOssFile_['uuid'] = element.id + successOssFile_['code'] = 200 + successOssFile_['name'] = element.name + successOssFile_['url'] = element.path + successOssFile_['size'] = element.size + this.successOssFile.push(successOssFile_) + }) + if (this.courseware.type == '1') { this.fileUpload.tabkey = '1' this.fileUpload.videoForm = this.courseware + this.fileUpload.videoForm.ifResources = this.ifResources || 0; this.fileUpload.videoForm.disabled = false - this.courseware.videoList.forEach((element) => { - let successOssFile_ = {} - successOssFile_['id'] = element.id - successOssFile_['uid'] = element.id - successOssFile_['uuid'] = element.id - successOssFile_['code'] = 200 - successOssFile_['name'] = element.name - successOssFile_['url'] = element.path - successOssFile_['size'] = element.size - this.successOssFile.push(successOssFile_) - }) - console.log('11------', this.successOssFile) - } else { - this.fileUpload.tabkey = '2' + console.log("1111111",this.fileUpload.videoForm); + } + + if (this.courseware.type == '2') { + this.fileUpload.tabkey = this.courseware.type this.fileUpload.textForm = this.courseware + this.fileUpload.textForm.ifResources = this.ifResources || 0; this.fileUpload.textForm.disabled = false } } diff --git a/src/views/course/CoursewareList.vue b/src/views/course/CoursewareList.vue index 4811546..4a518e9 100644 --- a/src/views/course/CoursewareList.vue +++ b/src/views/course/CoursewareList.vue @@ -64,8 +64,8 @@ export default { title: '课件分类', width: '300px', align: 'center', - dataIndex: 'coursewareClassifyId', - key: 'coursewareClassifyId', + dataIndex: 'classifyName', + key: 'classifyName', }, { title: '课时/分', width: '160px', align: 'center', dataIndex: 'duration', key: 'duration' }, { title: '课件大小(MB)', width: '160px', align: 'center', dataIndex: 'sizeStr', key: 'sizeStr' }, @@ -80,7 +80,7 @@ export default { }, //新增课件 coursewareAdd() { - this.$router.push({ path: '/course/CoursewareAddOrUpdate', query: { courseId: this.$route.query.id } }) + this.$router.push({ path: '/course/CoursewareAddOrUpdate', query: { courseId: this.$route.query.id, ifResources: 0 } }) }, //编辑 diff --git a/src/views/course/CoursewarePreview.vue b/src/views/course/CoursewarePreview.vue index 8279c16..05e46b1 100644 --- a/src/views/course/CoursewarePreview.vue +++ b/src/views/course/CoursewarePreview.vue @@ -1,7 +1,7 @@