From 05840159d0b38a5aef830c45c8af0fed4ce9c04f Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 23 Aug 2024 16:12:05 +0800 Subject: [PATCH] fix --- src/components/ueditorPlus/index.vue | 3 +- src/pages/ques/detail/index.vue | 20 +- src/pages/ques/list/index.vue | 27 +- src/pages/testPaper/detail/auto.vue | 68 +++-- src/pages/testPaper/detail/index.vue | 17 +- src/pages/testPaper/detail/manual.vue | 368 ++++++++++++++++++-------- src/pages/testPaperLibrary/index.vue | 2 +- src/router/permission.js | 1 + src/setting.js | 2 + 9 files changed, 351 insertions(+), 157 deletions(-) diff --git a/src/components/ueditorPlus/index.vue b/src/components/ueditorPlus/index.vue index 597a8d7..9703a9a 100644 --- a/src/components/ueditorPlus/index.vue +++ b/src/components/ueditorPlus/index.vue @@ -48,11 +48,12 @@ export default { }, methods: { initEditor () { + const host = Setting.isPro ? location.origin : `http://121.37.12.51` this.$nextTick(() => { // eslint-disable-next-line no-undef this.instance = UE.getEditor(this.randomId, { UEDITOR_HOME_URL: Setting.isDev ? '/static/ueditorPlus/' : '/examination/static/ueditorPlus/', - serverUrl: "http://121.37.12.51/exam/exam/upload/configAndUpload", + serverUrl: host + `/exam/exam/upload/configAndUpload`, plugins: 'gapfilling', ...this.config }) diff --git a/src/pages/ques/detail/index.vue b/src/pages/ques/detail/index.vue index 7cefa57..a5d8674 100644 --- a/src/pages/ques/detail/index.vue +++ b/src/pages/ques/detail/index.vue @@ -22,7 +22,7 @@ + filterable clearable>
@@ -155,10 +155,8 @@ 保存 @@ -166,7 +164,8 @@
- + +

系统已经识别出题库中有与本题相似的其他题目。如果您选择同步更新这些相似题目,那么所有关联的试卷将会自动更新。

@@ -299,12 +298,15 @@ export default { }, }, mounted () { + const { query } = this.$route this.crumbs = [ { name: '试题管理', route: 'list', query: { - id: this.questionBankId + questionBankId: query.questionBankId, + questionBankName: query.questionBankName, + questionBankCategory: query.questionBankCategory, } }, { @@ -636,7 +638,7 @@ export default { } else { // 仅更新此题 try { - await this.$confirm(`

确认仅更新此题吗?

${this.detailType === 4 ? '' : '

更新后,相关试卷自动同步

'}`, '提示', { + await this.$confirm(`

您确定要保存对本题所做的更改吗?

${this.detailType === 4 ? '' : '

保存后,所有关联的试卷将会自动更新

'}`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', @@ -669,7 +671,7 @@ export default { type === 4 && this.$emit('updateQues', this.tempForm, res.questionVersionId) Util.successMsg('保存成功') - !form.questionId && this.keep ? this.init() : this.back() + !form.questionId && this.keep ? '' : this.back() this.repeatVisible = false } finally { this.submiting = false diff --git a/src/pages/ques/list/index.vue b/src/pages/ques/list/index.vue index ee06627..c76ce4e 100644 --- a/src/pages/ques/list/index.vue +++ b/src/pages/ques/list/index.vue @@ -127,7 +127,7 @@ 移除 删除
@@ -247,7 +247,7 @@ export default { givenYearSort: '', difficultySort: '', correctRateSort: '', - updateTimeSort: 'desc', + updateTimeSort: '', referenceCountSort: '', }, list: [], @@ -324,7 +324,10 @@ export default { }, // 前往知识点 toSet () { - this.$router.push(`/knowledge?questionBankId=${this.questionBankId}&questionBankName=${this.questionBankName}`) + this.$router.push({ + path: '/knowledge', + query: this.$route.query + }) }, // 类型回调 typeChange () { @@ -419,11 +422,25 @@ export default { // 添加 add () { const knowledgeCheck = this.$refs.typeTree.getCurrentNode() - this.$router.push(`detail?questionBankId=${this.questionBankId}&questionBankName=${this.questionBankName}&questionBankCategory=${this.questionBankCategory}&path=${knowledgeCheck && knowledgeCheck.type ? knowledgeCheck.path : ''}`) + this.$router.push({ + path: 'detail', + query: { + ...this.$route.query, + path: knowledgeCheck && knowledgeCheck.type ? knowledgeCheck.path : '' + } + }) }, // 编辑/查看 type: 1复制,2查看,3编辑 toDetail (row, type) { - this.$router.push(`detail?questionId=${row.questionId}&version=${row.version}&questionBankId=${this.questionBankId}&questionBankName=${this.questionBankName}&questionBankCategory=${this.questionBankCategory}&detailType=${type}`) + this.$router.push({ + path: 'detail', + query: { + ...this.$route.query, + questionId: row.questionId, + version: row.version, + detailType: type + } + }) }, // 移除 async remove (row) { diff --git a/src/pages/testPaper/detail/auto.vue b/src/pages/testPaper/detail/auto.vue index 6994b99..f90d728 100644 --- a/src/pages/testPaper/detail/auto.vue +++ b/src/pages/testPaper/detail/auto.vue @@ -63,7 +63,7 @@ + @change="initQuesBank">
  • @@ -76,9 +76,9 @@ 题库名称 -
    -
    +
    +
    {{ i + 1 }}

    {{ item.questionBankName }}

    @@ -142,16 +142,18 @@

    -
    -
    - 题库:{{ item.quesBank.questionBankName }} - -
    -
    - {{ tag.name }} +
    @@ -194,7 +196,6 @@ export default { quesBankTypes: [], quesBankKeyword: '', - quesAllCheck: false, quesBanks: [], pageQuesBank: 1, pageSizeQuesBank: 10, @@ -209,6 +210,7 @@ export default { pageSizeKn: 10, totalKn: 0, + checkedKeyword: '', checked: [], list: [], years: ['暂无年份', '2024', '2023', '2022', '2021', '2020', '2019', '2018', '2017', '2016', '更早'], @@ -229,7 +231,7 @@ export default { watch: { 'quesBankKeyword': function (val) { clearTimeout(this.searchTimer) - this.searchTimer = setTimeout(this.getQuesBank, 500) + this.searchTimer = setTimeout(this.initQuesBank, 500) }, 'knowledgeKeyword': function (val) { clearTimeout(this.searchTimer) @@ -249,7 +251,7 @@ export default { this.yearCheck = this.years this.handleQuesList() this.getQuesBankType() - this.getQuesBank() + this.initQuesBank() this.difficult = this.$parent.form.difficult this.difficult && this.difficultChange(this.difficult) }, @@ -279,6 +281,11 @@ export default { this.totalQuesBank = res.message.total } catch (e) { } }, + initQuesBank () { + this.curQuesBank = {} + this.pageQuesBank = 1 + this.getQuesBank() + }, // 切换页码 currentChangeQuesBank (val) { this.pageQuesBank = val @@ -316,16 +323,19 @@ export default { // 获取知识点 async getKnowledge () { try { - const type = this.knowledgeTypeVal - const res = await this.$post(this.api.knowledgeHierarchyList, { - pageNum: this.pageKn, - pageSize: this.pageSizeKn, - questionBankId: this.curQuesBank.id, - knowledgePointCategoryId: type.length ? type[type.length - 1] : '', - name: this.knowledgeKeyword, - }) - this.knowledges = res.message.records - this.totalKn = res.message.total + const { id } = this.curQuesBank + if (id) { + const type = this.knowledgeTypeVal + const res = await this.$post(this.api.knowledgeHierarchyList, { + pageNum: this.pageKn, + pageSize: this.pageSizeKn, + questionBankId: id, + knowledgePointCategoryId: type.length ? type[type.length - 1] : '', + name: this.knowledgeKeyword, + }) + this.knowledges = res.message.records + this.totalKn = res.message.total + } } catch (e) { } }, // 切换页码 @@ -617,13 +627,15 @@ export default { margin-top: 10px; } - .line { display: flex; padding: 5px 0; color: #333; - &.able-check { + } + + .able-check { + .line { cursor: pointer; &:hover { diff --git a/src/pages/testPaper/detail/index.vue b/src/pages/testPaper/detail/index.vue index 8faa924..15651d4 100644 --- a/src/pages/testPaper/detail/index.vue +++ b/src/pages/testPaper/detail/index.vue @@ -165,7 +165,8 @@
    排序 - +
    编辑试题 更换试题 @@ -370,7 +371,8 @@ export default { const paper = r.paperOutline paper.map(e => { e.shrink = false - e.examQuestions.map(n => { + e.examQuestions.map((n, j) => { + n.originSort = j + 1 Object.assign(n, n.question) }) @@ -638,6 +640,17 @@ export default { this.$set(e, 'serialNumber', i + 1) }) }, + // 排序输入完回调 + sortChange (item, ques) { + item.examQuestions.sort((a, b) => { + if (a.serialNumber == b.serialNumber && (a.questionVersionId === ques.questionVersionId || b.questionVersionId === ques.questionVersionId)) return b.originSort - a.originSort + return a.serialNumber - b.serialNumber + }) + item.examQuestions.map((e, i) => { + e.originSort = i + 1 + e.serialNumber = i + 1 + }) + }, // 移除试题 async delQues (item, i) { try { diff --git a/src/pages/testPaper/detail/manual.vue b/src/pages/testPaper/detail/manual.vue index 2abc082..4aac8f0 100644 --- a/src/pages/testPaper/detail/manual.vue +++ b/src/pages/testPaper/detail/manual.vue @@ -6,33 +6,63 @@

    题库

    - - -
    - -
    -

    知识点框架

    - - - - - {{ data.name }} - - +
      +
    • + + +
    • +
    • + +
    • +
    + + +
    + +

    暂无数据

    +
    -

    {{ questionTypeName }}(共{{ ques.length }}道题)

    -
    +

    {{ questionTypeName }}(共{{ ques.length }}道题)

    + +
      +
    • + + +
    • +
    • + +
    • +
    + + +
    + +

    暂无数据

    @@ -57,30 +94,47 @@

    已选试题(共{{ checkedLen }}道题)

    批量移除
    -
    -
    - - 序号 - 题干 -
    -
    -
    - - {{ i + 1 }} - -

    {{ item.stemText }}

    -
    + + + +
    + +

    暂无数据

    -
    +

    未找到试题,去新增

    -

    已选题数/目标题数:{{ checkedLen }}/{{ $parent.curType.questionNum }}   - +

    已选题数/目标题数:{{ checkedLen }}/{{ $parent.curType.questionNum }} +

    @@ -101,17 +155,26 @@ export default { data () { return { selectQuesVisible: false, + searchTimer: null, quesBankKeyword: '', + curQuesBank: {}, + quesBankTypeVal: [], + quesBankTypes: [], + quesBanks: [], + pageQuesBank: 1, + pageSizeQuesBank: 10, + totalQuesBank: 0, + knowledgeKeyword: '', - searchTimer: null, key: 1, - quesBanks: [], + knowledgeVal: [], knowledges: [], quesAllCheck: false, ques: [], checkedAllCheck: false, checked: [], curCheckQues: [], + checkedKeyword: '', submiting: false, quesVisible: false, @@ -141,11 +204,11 @@ export default { watch: { 'quesBankKeyword': function (val) { clearTimeout(this.searchTimer) - this.searchTimer = setTimeout(this.getQuesBank, 500) + this.searchTimer = setTimeout(this.initQuesBank, 500) }, 'knowledgeKeyword': function (val) { clearTimeout(this.searchTimer) - this.searchTimer = setTimeout(this.getKnowledge, 500) + this.searchTimer = setTimeout(this.getQues, 500) }, visible () { this.selectQuesVisible = this.visible @@ -171,69 +234,109 @@ export default { const parent = this.$parent.curType this.curCheckQues = parent.examQuestions - this.getQuesBank() + this.getQuesBankType() + this.initQuesBank() + }, + // 获取题库分类 + async getQuesBankType () { + try { + const { data } = await this.$post(this.api.getAllQuestionBankCategories, { + createSource: 1, + status: 1, + }) + this.handleList(data) + this.quesBankTypes = data + } catch (e) { } }, // 获取题库 async getQuesBank () { try { - const { list } = await this.$post(this.api.questionBankStructureLevel, { - keyword: this.quesBankKeyword, - createSource: 1, + const type = this.quesBankTypeVal + const res = await this.$post(this.api.questionBankList, { status: 1, + pageNum: this.pageQuesBank, + pageSize: this.pageSizeQuesBank, + questionCategoryId: type.length ? type[type.length - 1] : '', + name: this.quesBankKeyword }) - this.quesBanks = list + const { records } = res.message + this.quesBanks = records + this.totalQuesBank = res.message.total + records.length && this.questionBankClick(records[0]) } catch (e) { } }, + initQuesBank () { + this.curQuesBank = {} + this.pageQuesBank = 1 + this.getQuesBank() + }, + // 切换页码 + currentChangeQuesBank (val) { + this.pageQuesBank = val + this.getQuesBank() + }, + // 题目多选回调 + questionBankClick (item) { + this.curQuesBank = item + this.knowledgeCheck = false + this.getKnowledge() + this.getQues() + this.quesAllCheck = false + }, + + // 处理树形 + handleList (list) { + list.map(e => { + if (e.children && e.children.length) { + this.handleList(e.children) + } else { + delete e.children + } + }) + }, + // 获取知识点 async getKnowledge () { try { - const id = this.$refs.quesBank.getCurrentKey() + const { id } = this.curQuesBank if (id) { const { data } = await this.$post(this.api.TreeStructure, { createSource: 1, questionBankId: id, - keyword: this.knowledgeKeyword, + keyword: '', }) + this.handleList(data) this.knowledges = data } } catch (e) { } }, // 获取试题 async getQues () { - let k = this.$refs.knowledge.getCurrentNode() // 选中的知识点 - // debugger - // 选中了知识点才能查询试题 - if (k && k.type) { + const { id } = this.curQuesBank + let k = this.knowledgeVal // 选中的知识点 + k = k.map(e => { + return e[e.length - 1] + }) + if (id) { const { list } = await this.$post(this.api.findAllByQuestionBank, { status: 1, - questionBankId: this.$refs.quesBank.getCurrentKey(), - knowledgePointIds: [k.id], + questionBankIds: [id], + knowledgePointIds: k, questionTypes: this.questionType ? [this.questionType] : [], + keyword: this.knowledgeKeyword, }) const data = list - const checked = this.curCheckQues + const { curCheckQues, checked } = this data.map(e => { const el = document.createElement('div') el.innerHTML = e.stem e.stemText = el.innerText - e.check = !!this.checked.find(n => n.questionVersionId === e.questionVersionId) - e.disabled = !!checked.find(n => n.questionVersionId === e.questionVersionId) + const quesChecked = !!curCheckQues.find(n => n.questionVersionId === e.questionVersionId) + e.disabled = quesChecked + e.check = !!checked.find(n => n.questionVersionId === e.questionVersionId) || quesChecked }) this.ques = data } - }, - // 题库勾选回调 - quesBankCheck (data, checked) { - // debugger - if (checked) { - // this.$refs.quesBank.setCurrentKey(data.id) - this.getKnowledge() - } - this.$refs.knowledge.setCheckedNodes(checked ? this.knowledges : []) - }, - // 知识点点击回调 - knowledgeClick (data) { - }, // 知识点勾选回调 knowledgeCheck () { @@ -242,8 +345,10 @@ export default { // 题目全选回调 quesAllCheckChange (val) { this.ques.map(e => { - e.check = val - this.quesChange(val, e) + if (!e.disabled) { + e.check = val + this.quesChange(val, e) + } }) }, // 题目多选回调 @@ -270,7 +375,7 @@ export default { try { const checked = this.checked.filter(e => e.check) if (checked.length) { - await this.$confirm(`确认要删除吗?`, '提示', { + await this.$confirm(`确认要移除吗?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', @@ -293,12 +398,12 @@ export default { // 已选试题单个删除 async delChecked (item) { try { - // await this.$confirm(`确认要删除吗?`, '提示', { - // confirmButtonText: '确定', - // cancelButtonText: '取消', - // type: 'warning', - // closeOnClickModal: false, - // }) + await this.$confirm(`确认要移除吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + closeOnClickModal: false, + }) const cur = this.ques.find(e => e.questionVersionId === item.questionVersionId) if (cur) cur.check = false this.checked.splice(this.checked.findIndex(e => e.questionVersionId === item.questionVersionId), 1) @@ -377,16 +482,28 @@ export default { margin-bottom: 10px; border: 1px solid #eee; + .filter { + margin-bottom: 15px; + + li { + display: flex; + align-items: center; + } + + label { + margin-right: 10px; + font-size: 14px; + color: #333; + white-space: nowrap; + } + } + .item { - width: 25%; - max-height: calc(100vh - 190px); + width: 38%; + height: calc(100vh - 173px); padding: 15px; border-right: 1px solid #eee; overflow: auto; - - &:last-child { - border-right: 0; - } } .total { @@ -394,40 +511,69 @@ export default { color: #333; } - .ques { - margin-top: 10px; + .line { + display: flex; + padding: 5px 0; + color: #333; + } + + .able-check { .line { - display: flex; - margin: 8px 0; - } + cursor: pointer; - .serial { - width: 32px; - margin: 0 12px; - text-align: center; - white-space: nowrap; - } + &:hover { + background-color: #f5f5f5; + } - .stem { - max-width: calc(100% - 71px); - @include ellipsis; + &.active { + background-color: #e5e5e5; + } } + } - .checked-stem { - max-width: 165px; - @include ellipsis; - } + .serial { + width: 32px; + margin: 0 12px; + text-align: center; + white-space: nowrap; + } - .check-left { - display: inline-flex; - align-items: center; - } + .quesBank { + width: calc(100% - 71px); + @include ellipsis; + } - .action-icon { - font-size: 14px; + .stem { + width: calc(100% - 210px); + margin-right: 20px; + @include ellipsis; + } + + .kl { + width: 120px; + @include ellipsis; + + &.checked-kl { + width: 90px; + margin-right: 10px; } } + + .checked-stem { + max-width: 165px; + margin-right: 20px; + @include ellipsis; + } + + .check-left { + display: inline-flex; + align-items: center; + } + + .action-icon { + font-size: 14px; + } } .link { diff --git a/src/pages/testPaperLibrary/index.vue b/src/pages/testPaperLibrary/index.vue index a5a9e3d..9876634 100644 --- a/src/pages/testPaperLibrary/index.vue +++ b/src/pages/testPaperLibrary/index.vue @@ -58,7 +58,7 @@ - +