From 499ff582759f39963f1c58246b87c4a3dee41085 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 3 Sep 2024 11:27:24 +0800 Subject: [PATCH] fix --- src/layouts/navbar/index.vue | 16 +++++++--------- src/pages/ques/detail/index.vue | 6 +++--- src/pages/testPaper/detail/index.vue | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue index 5b35975..fcf3f3f 100644 --- a/src/layouts/navbar/index.vue +++ b/src/layouts/navbar/index.vue @@ -53,7 +53,6 @@ export default { // title: '首页' // }, { - icon: 'user', index: 'ques', title: '题库管理', subs: [ @@ -68,7 +67,6 @@ export default { ] }, { - icon: 'annex', index: 'testPaper', title: '试卷管理', subs: [ @@ -91,6 +89,12 @@ export default { ]) }, created () { + const { path } = this.$route + if (path.includes('ques/') || path.includes('knowledge')) { + this.active = '/quesBank' + } else if (path.includes('testPaper/')) { + this.active = '/testPaperLibrary' + } this.initMenu() }, methods: { @@ -100,13 +104,7 @@ export default { // 菜单选择 menuSelect (index) { this.collapse = false - // 用户管理只需展开导航,其他的则跳转 - if (index.includes('/')) { - this.$router.push(index) - } else { - this.active = '/user/list' - this.$router.push('/user/list') - } + this.$router.push(index) }, // 初始化菜单 initMenu () { diff --git a/src/pages/ques/detail/index.vue b/src/pages/ques/detail/index.vue index 181589a..c07fa52 100644 --- a/src/pages/ques/detail/index.vue +++ b/src/pages/ques/detail/index.vue @@ -796,18 +796,18 @@ export default { paperEdit && this.$emit('updateQues', form) Util.successMsg('保存成功') - !form.questionId && this.keep ? this.init(form) : this.back() + !form.questionId && this.keep ? this.init(form) : this.back(form.questionId) this.repeatVisible = false } finally { this.submiting = false } }, - back () { + back (cache) { if (this.paperType) { // 从试卷里进来的,则直接关闭弹框 this.$emit('closeAdd') } else { - this.questionId ? this.$router.push(this.$store.state.user.referrer2 || 'list') : this.$router.back() + cache ? this.$router.push(this.$store.state.user.referrer2 || 'list') : this.$router.back() } }, } diff --git a/src/pages/testPaper/detail/index.vue b/src/pages/testPaper/detail/index.vue index 73d8ae3..1ce8048 100644 --- a/src/pages/testPaper/detail/index.vue +++ b/src/pages/testPaper/detail/index.vue @@ -766,6 +766,7 @@ export default { cur >= 0 && item.examQuestions.splice(cur, 1) }) item.checkAll = false + this.afterDelQues() this.calcDifficult() } else { Util.warningMsg('请选择数据') @@ -790,6 +791,17 @@ export default { e.serialNumber = i + 1 }) }, + // 移除试题后判断重复试题(展示过重复试题后才需要判断) + afterDelQues () { + if (this.repeatQues.length) { + const result = [] + this.form.paperOutline.forEach(e => { + result.push(...e.examQuestions) + }) + result.map(e => e.repeat = false) + this.hasRepeatQues(result) + } + }, // 移除试题 async delQues (item, i, noConfirm) { try { @@ -803,6 +815,7 @@ export default { } item.examQuestions.splice(i, 1) item.checkAll = false + this.afterDelQues() this.calcDifficult() } catch (e) { } }, @@ -1029,7 +1042,7 @@ export default { }, // 返回 back () { - this.$router.push(this.$store.state.user.referrer || 'list') + this.$router.push(this.$store.state.user.referrer2 || 'list') }, // 拖拽面板 drag () {