diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index 42dc21f..50e7f2c 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -124,6 +124,9 @@ export default { diff --git a/src/views/course/content/index.vue b/src/views/course/content/index.vue index 461f027..26416c4 100644 --- a/src/views/course/content/index.vue +++ b/src/views/course/content/index.vue @@ -86,7 +86,7 @@ - @@ -199,6 +199,13 @@ + + + + @@ -224,11 +231,11 @@ export default { uploading: false, uploadList: [], chapterVisible: false, - chapterId: "", - chapterName: "", + chapterId: '', + chapterName: '', sectionVisible: false, - sectionName: "", - sectionId: "", + sectionName: '', + sectionId: '', switchVisible: false, sectionNameVisible: false, @@ -242,16 +249,16 @@ export default { }, keyword: '', searchTimer: null, - fileId: "", - fileName: "", - fileUrl: "", - originalFileName: "", - fileType: "", + fileId: '', + fileName: '', + fileUrl: '', + originalFileName: '', + fileType: '', videoSrc: '', - playAuth: "", + playAuth: '', player: null, - previewImg: "", - iframeSrc: "", + previewImg: '', + iframeSrc: '', curSection: {}, isAddSection: false, isWord: false, @@ -262,7 +269,7 @@ export default { showMask2: false, loadIns: null, pdfVisible: false, - pdfSrc: "", + pdfSrc: '', previewing: false, showProgress: false, progressPercent: 0, @@ -284,6 +291,8 @@ export default { }, sourceVisible: false, sections: [], + + switchTypeVisible: false, }; }, mounted () { @@ -443,8 +452,8 @@ export default { // 批量移除小节 batchDelSection () { const list = this.sections.filter(e => e.check) - this.$confirm(list.length ? '此删除操作不可逆,是否确认删除选中项?' : '此删除操作不可逆,是否确认全部资源?', "提示", { - type: "warning" + this.$confirm(list.length ? '此删除操作不可逆,是否确认删除选中项?' : '此删除操作不可逆,是否确认删除全部资源?', "提示", { + type: 'warning' }).then(async () => { await this.$post(this.api.deleteSubsectionBatch, { chapterId: this.chapterId, @@ -556,7 +565,7 @@ export default { }).catch(() => { }) }, closeSection () { - this.isAddSection = false; + this.isAddSection = false this.progressPercent = 0 }, @@ -565,7 +574,8 @@ export default { this.curSection = {} this.sourceVisible = true }, - addSection (id) { + // 本地上传新增资源 + addSection () { this.sectionForm.sectionName = '' this.fileUrl = '' this.uploadList = [] @@ -573,14 +583,22 @@ export default { this.isAddSection = true this.sectionVisible = true }, + // 本地上传编辑资源 + editSection () { + this.sectionForm.sectionName = this.curSection.name + this.fileUrl = '' + this.uploadList = [] + this.isAddSection = false + this.sectionVisible = true + }, chapterSubmit () { if (!this.chapterName) return this.$message.warning("请填写章节名称"); - let data = { + const data = { cid: this.id, name: this.chapterName } if (this.chapterId) { - data.id = this.chapterId; + data.id = this.chapterId this.$put(this.api.editChapter, data).then(res => { this.$message.success("修改成功") this.chapterVisible = false @@ -594,11 +612,11 @@ export default { }).catch(err => { }) } }, - sectionSubmit (e) { - if (!this.sectionForm.sectionName) return this.$message.warning("请填写小节名称") - if (this.uploading) return this.$message.warning("资源正在上传中,请稍候") - if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源") - let data = { + async sectionSubmit (e) { + if (!this.sectionForm.sectionName) return this.$message.warning('请填写小节名称') + if (this.uploading) return this.$message.warning('资源正在上传中,请稍候') + if (!this.fileUrl && !this.fileId) return this.$message.warning('请上传资源') + const data = { id: this.sectionId, cid: this.id, chapterId: this.chapterId, @@ -609,11 +627,16 @@ export default { fileType: this.fileType, originalFileName: this.originalFileName } - this.$post(this.api.addSubsection, data).then(res => { - this.$message.success("添加成功") - this.sectionVisible = false - this.getData() - }).catch(err => { }) + if (this.sectionId) { + await this.$put(this.api.editSubsection, data) + } else { + await this.$post(this.api.addSubsection, data) + } + + this.$message.success('添加成功') + this.sectionVisible = false + this.switchTypeVisible = false + this.getData() }, closeSwitch () { this.fileId = '' @@ -713,10 +736,10 @@ export default { switchFile (row) { this.curSection = row this.sectionId = row.id - this.sourceVisible = true + this.switchTypeVisible = true }, switchSubmitFile () { - let data = { + this.$put(this.api.editSubsection, { id: this.sectionId, cid: this.id, chapterId: this.chapterId, @@ -726,30 +749,27 @@ export default { fileType: this.fileType, fileUrl: this.fileUrl, originalFileName: this.originalFileName - }; - this.$put(this.api.editSubsection, data).then(res => { - this.$message.success("更换成功"); - this.switchVisible = false; - this.getData(); + }).then(res => { + this.$message.success("更换成功") + this.switchVisible = false + this.getData() }).catch(err => { }) }, switchSubmit () { - if (this.uploading) return this.$message.warning("资源正在上传中,请稍候"); - if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源"); - this.switchSubmitFile(); + if (this.uploading) return this.$message.warning("资源正在上传中,请稍候") + if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源") + this.switchSubmitFile() }, delSection (row) { this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { type: "warning" - }) - .then(() => { - this.$del(`${this.api.deleteSubsection}/${row.id}`).then(res => { - row.fileUrl && Oss.del(row.fileUrl) - this.$message.success("删除成功"); - this.getData(); - }).catch(res => { - }); - }).catch(() => { }) + }).then(() => { + this.$del(`${this.api.deleteSubsection}/${row.id}`).then(res => { + row.fileUrl && Oss.del(row.fileUrl) + this.$message.success("删除成功") + this.getData() + }).catch(res => { }) + }).catch(() => { }) }, sortChapter (row, type, disabled, index) { if (!disabled) { @@ -1016,4 +1036,25 @@ export default { } } } + +/deep/.source-list { + display: flex; + gap: 10px; + + li { + flex: 1; + line-height: 80px; + font-size: 16px; + text-align: center; + color: #333; + border-radius: 8px; + background-color: #f6f8fa; + border: 1px solid transparent; + cursor: pointer; + + &:hover { + border-color: #062c87; + } + } +} \ No newline at end of file diff --git a/src/views/course/content/source.vue b/src/views/course/content/source.vue index b130410..d469533 100644 --- a/src/views/course/content/source.vue +++ b/src/views/course/content/source.vue @@ -270,8 +270,24 @@ export default { type: e.cid ? 0 : 1, } }) - await this.$post(this.api.combinationResource, result) + + const old = this.$parent.curSection // 需要更换的资源 + if (old.id) { + // 更换资源 + await this.$post(this.api.replaceResource, { + chapterId: old.chapterId, + cid: +id, + subsectionId: old.id, + newResource: result + }) + + } else { + // 批量新增资源 + await this.$post(this.api.combinationResource, result) + } + this.sourceVisible = false + this.$parent.switchTypeVisible = false this.$parent.getData() this.submiting = false } else { diff --git a/src/views/course/detail.vue b/src/views/course/detail.vue index 8405a79..a031472 100644 --- a/src/views/course/detail.vue +++ b/src/views/course/detail.vue @@ -307,6 +307,7 @@ import Util from '@/libs/util' import Editor from '@tinymce/tinymce-vue' import editorConfig from '@/utils/editor' import Oss from '@/components/upload/upload.js' +import _ from 'lodash' export default { components: { Editor, @@ -383,7 +384,6 @@ export default { submiting: false, // 新增编辑防抖标识 loadIns: null, updateTime: 0, - systemAll: [], systems: [], systemsAll: [], systemChecked: [], @@ -458,7 +458,6 @@ export default { }) this.assessmentData = aList - this.form.curriculumDisciplines.forEach(e => { this.$set(e, 'professionalClassList', []) this.$set(e, 'professionalList', []) @@ -468,9 +467,8 @@ export default { if (!e.professionalCategoryId) this.$set(e, 'professionalCategoryId', '') if (!e.professionalId) this.$set(e, 'professionalId', '') }) - }); - }).catch(err => { - }); + }) + }).catch(err => { }) }, // 获取供应厂商 getSupplier () { @@ -597,7 +595,6 @@ export default { supplierId: sid ? sid.supplierId : '' }).then(res => { const list = res.serviceList.records - this.systemAll = JSON.parse(JSON.stringify(list)) // 全部系统,另外保存 const result = [] list.map(e => { // 如果选中的项目里有该系统的项目,则隐藏 @@ -749,12 +746,12 @@ export default { this.systemKeyword = '' this.projectKeyword = '' this.checkedKeyword = '' - this.permissions = type; - this.configVisible = true; - this.pageNo = 1; - this.getConfig(); - this.checkeds = JSON.parse(JSON.stringify(type == 1 ? this.assessmentData : type == 2 ? this.matches : this.practiceData)) - this.checkedAll = JSON.parse(JSON.stringify(this.checkeds)) + this.permissions = type + this.configVisible = true + this.pageNo = 1 + this.getConfig() + this.checkeds = _.cloneDeep(type == 1 ? this.assessmentData : this.practiceData) + this.checkedAll = _.cloneDeep(this.checkeds) }, handleBatchDelete (type) { // 批量移除 if (type == 1 && !this.multipleAssessment.length) { diff --git a/src/views/course/list.vue b/src/views/course/list.vue index 336c7bd..c891b60 100644 --- a/src/views/course/list.vue +++ b/src/views/course/list.vue @@ -37,8 +37,7 @@ - - + @@ -112,8 +111,9 @@ export default { data () { return { courseTypeStatus: { - 0: "理论课程", - 1: "实训课程" + 0: '理论课程', + 1: '实训课程', + 2: '理实课程', }, name: localStorage.getItem("ms_username"), courseData: [], @@ -121,7 +121,7 @@ export default { categoryId: +this.$route.query.categoryId || '', professionalCategoryId: +this.$route.query.professionalCategoryId || '', professionalId: +this.$route.query.professionalId || '', - curriculumType: this.$route.query.curriculumType ? +this.$route.query.curriculumType : '', + curriculumType: this.$route.query.curriculumType || '', curriculumName: this.$route.query.curriculumName || '' }, page: +this.$route.query.page || 1, diff --git a/src/views/shop/add.vue b/src/views/shop/add.vue index 24d084f..6517c7b 100644 --- a/src/views/shop/add.vue +++ b/src/views/shop/add.vue @@ -6,7 +6,7 @@ - + @@ -308,8 +308,57 @@ + + + +
+
+
+

+ 大赛项目配置 +
+
+ 批量移除 + +
+
+
+ + + + + + + + + + + + + + + + + +
+ + - + + + + + +
+
+
+

+ 系统列表 +
+ + +
    +
  • + +
    + {{ item.systemName }} + +
    +
  • +
+
+ +
+
+

+ 项目列表 +
+ + +
    + +
  • + +
  • +
+
+ +
+
+

+ 已选择项目({{ checkeds.length }}个) +
+ + + + + + + + + + + + + + + +
+
+ + + 取 消 + 确 定 + +