From 200dd525bfae54e481584f015ad8b7ee81880616 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 10 May 2022 18:03:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/setting.js | 4 +- src/views/course/contentSettings.vue | 131 +++++++++++++++------------ src/views/order/AddOrder.vue | 2 +- 3 files changed, 74 insertions(+), 63 deletions(-) diff --git a/src/setting.js b/src/setting.js index 63a150f..913910d 100644 --- a/src/setting.js +++ b/src/setting.js @@ -9,8 +9,8 @@ let jumpPath = `${location.origin}/judgmentPoint` let host = `${location.origin}:9000/` if (isDev) { jumpPath = "http://192.168.31.125:8087/"; // 本地调试-需要启动本地判分点系统 - // host = 'http://39.108.250.202:9000/' - host = 'http://192.168.31.151:9000/'// 榕 + host = 'http://39.108.250.202:9000/' + // host = 'http://192.168.31.151:9000/'// 榕 // host = 'http://192.168.31.137:9000/'// 赓 } else if (isPro) { jumpPath = "http://www.huorantech.cn/judgmentPoint/"; diff --git a/src/views/course/contentSettings.vue b/src/views/course/contentSettings.vue index a010042..20bd7b4 100644 --- a/src/views/course/contentSettings.vue +++ b/src/views/course/contentSettings.vue @@ -2,7 +2,7 @@
- +
@@ -40,8 +40,12 @@
- - + + + + @@ -80,7 +84,7 @@ - + { + this.saveSort() + this.moved = false + }).catch(() => { + this.sorting = false + this.chapters = JSON.parse(JSON.stringify(this.originChapters)) + }) } else { - this.$router.back() + this.sorting = false } + } else { + this.$router.back() } + } }, iframeOnload() { document.querySelector("#fileIframe").onload = e => { @@ -419,11 +441,20 @@ export default { this.chapterVisible = true; }, sort() { - this.sorting = true; + this.originChapters = JSON.parse(JSON.stringify(this.chapters)) + this.sorting = true; }, // 批量移动 move() { - if (this.multipleSelection.length) { + const list = this.chapters + const checkList = [] + list.map(e => { + e.subsectionList.map(n => { + n.check && checkList.push(n) + }) + }) + this.checkList = checkList + if (checkList.length) { this.moveForm = { id: '', sort: 'bottom' @@ -466,62 +497,40 @@ export default { } ] }, - // 资源移动保存 - moveSubmit() { - const { moveForm } = this - let { id, sort } = moveForm - if (typeof sort === 'string') sort = sort === 'top' ? 0 : this.sortList.length - 2 // 置顶和置末直接给排序 - const list = this.multipleSelection - const promises = [] - // 多选,所以循环调编辑接口 - list.map(e => { - promises.push(new Promise((resolve, reject) => { - this.$put(this.api.editSubsection, { - id: e.id, - cid: this.id, - chapterId: id, - sort - }).then(res => { - resolve() - }).catch(err => { - reject() - }) - })) - }) - // 编辑完后再获取列表,重新排sort,然后再调排序接口 - Promise.all(promises).then(() => { - this.$get(`${this.api.queryChaptersAndSubsections}/${this.id}`).then(({ chapterList }) => { - chapterList.forEach((n, k) => { - n.sort = k + 1 - n.subsectionList.forEach((j, i) => { - j.sort = i + 1 - }) - }) - this.$post(this.api.reorder, { - chapterVOList: chapterList - }).then(res => { - this.$message.success('移动成功!') - this.getData() - }).catch(res => {}) - }).catch(err => {}) - }) - }, // 资源移动校验 moveConfirm() { - const { moveForm } = this - let { id, sort } = moveForm + let { id, sort } = this.moveForm if (!id) return this.$message.warning('请选择目标章节') if (sort === '') return this.$message.warning('请选择目标排序') + if (typeof sort === 'string') sort = sort === 'top' ? 0 : this.sortList.length - 2 // 置顶和置末直接给排序 this.moveVisible = false + const list = this.checkList + list.map(e => e.check = false) + const ids = list.map(e => e.id) + const { chapters } = this + chapters.map(e => { + e.children = [] + e.subsectionList.map(n => { + if (!ids.includes(n.id)) { + e.children.push(n) + } + }) + e.subsectionList = e.children + delete e.children + if (e.id === id) e.subsectionList.splice(sort, 0, ...list) + }) + this.moved = true }, cancelSort() { - this.sorting = false; + this.chapters = JSON.parse(JSON.stringify(this.originChapters)) + this.sorting = false; }, saveSort() { this.chapters.forEach((n, k) => { n.sort = k + 1; n.subsectionList.forEach((j, i) => { - j.sort = i + 1; + j.sort = i + 1 + j.chapterId = n.id }); }); let data = { @@ -529,7 +538,6 @@ export default { }; this.$post(this.api.reorder, data).then(res => { this.sorting = false; - this.moveSubmit() }).catch(res => {}) }, editChapter(item) { @@ -781,6 +789,7 @@ export default { }, sortSection(chapterIndex, type, disabled, index) { if (!disabled) { + this.moved = true let list = this.chapters[chapterIndex].subsectionList; if (type == "up") { let tempItem = list.splice(index - 1, 1)[0]; @@ -790,7 +799,6 @@ export default { list.splice(index, 0, tempItem); } this.chapters[chapterIndex].subsectionList = list; - } }, sectionNameSubmit() { @@ -852,7 +860,10 @@ export default { cursor: not-allowed } } - +/deep/.el-progress-bar { + padding-right: 70px; + margin-right: -70px; +} .el-image-viewer__wrapper { transform: translateY(-10px); transition: transform .5s; diff --git a/src/views/order/AddOrder.vue b/src/views/order/AddOrder.vue index 4816b82..8938230 100644 --- a/src/views/order/AddOrder.vue +++ b/src/views/order/AddOrder.vue @@ -65,7 +65,7 @@ v-model="form.customerName" placeholder="请选择客户"> -