|
|
@ -2,6 +2,7 @@ |
|
|
|
<div class="page h-full"> |
|
|
|
<div class="page h-full"> |
|
|
|
<Breadcrumb v-if="!paperType" :data="crumbs" /> |
|
|
|
<Breadcrumb v-if="!paperType" :data="crumbs" /> |
|
|
|
<p class="page-name mb">试题</p> |
|
|
|
<p class="page-name mb">试题</p> |
|
|
|
|
|
|
|
<div v-loading="loading"> |
|
|
|
<el-form :model="form" :rules="rules" :class="['input-form model', { paper: paperType }]" ref="form" |
|
|
|
<el-form :model="form" :rules="rules" :class="['input-form model', { paper: paperType }]" ref="form" |
|
|
|
label-width="110px" :disabled="detailType === 2"> |
|
|
|
label-width="110px" :disabled="detailType === 2"> |
|
|
|
<div class="item-line"> |
|
|
|
<div class="item-line"> |
|
|
@ -170,7 +171,8 @@ |
|
|
|
v-model="answerAnalysis" /> |
|
|
|
v-model="answerAnalysis" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</el-form> |
|
|
|
<div v-if="detailType !== 2" class="btns"> |
|
|
|
<div class="btns"> |
|
|
|
|
|
|
|
<template v-if="detailType !== 2"> |
|
|
|
<el-button v-if="detailType === 1" type="primary" :loading="submiting && keep === 0" |
|
|
|
<el-button v-if="detailType === 1" type="primary" :loading="submiting && keep === 0" |
|
|
|
@click="submit(1)">保存</el-button> |
|
|
|
@click="submit(1)">保存</el-button> |
|
|
|
<template v-else> |
|
|
|
<template v-else> |
|
|
@ -179,7 +181,9 @@ |
|
|
|
: |
|
|
|
: |
|
|
|
'保存并继续新增' }}</el-button> |
|
|
|
'保存并继续新增' }}</el-button> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<el-button @click="back">取消</el-button> |
|
|
|
</template> |
|
|
|
|
|
|
|
<el-button @click="back">{{ detailType !== 2 ? '取消' : '返回' }}</el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="提示" :visible.sync="repeatVisible" width="800px" :close-on-click-modal="false"> |
|
|
|
<el-dialog title="提示" :visible.sync="repeatVisible" width="800px" :close-on-click-modal="false"> |
|
|
@ -216,6 +220,7 @@ import Oss from '@/components/upload/upload.js' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import _ from 'lodash' |
|
|
|
import _ from 'lodash' |
|
|
|
import Const from '@/const/ques' |
|
|
|
import Const from '@/const/ques' |
|
|
|
|
|
|
|
import Decimal from 'decimal.js' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
props: ['paperType', 'curQues'], // 会接收父组件传值的场景都是组卷里新增或者编辑试题进来的 |
|
|
|
props: ['paperType', 'curQues'], // 会接收父组件传值的场景都是组卷里新增或者编辑试题进来的 |
|
|
|
components: { Breadcrumb, UeditorPlus, Upload }, |
|
|
|
components: { Breadcrumb, UeditorPlus, Upload }, |
|
|
@ -229,6 +234,7 @@ export default { |
|
|
|
questionBankCategory: this.$route.query.questionBankCategory, |
|
|
|
questionBankCategory: this.$route.query.questionBankCategory, |
|
|
|
detailType: +this.$route.query.detailType, |
|
|
|
detailType: +this.$route.query.detailType, |
|
|
|
numToLetter: Util.numToLetter, |
|
|
|
numToLetter: Util.numToLetter, |
|
|
|
|
|
|
|
loading: false, |
|
|
|
questionBankTypes: [], |
|
|
|
questionBankTypes: [], |
|
|
|
questionBanks: [], |
|
|
|
questionBanks: [], |
|
|
|
professionals: [], |
|
|
|
professionals: [], |
|
|
@ -328,6 +334,7 @@ export default { |
|
|
|
} else if (this.curQues) { |
|
|
|
} else if (this.curQues) { |
|
|
|
this.questionId = this.curQues.questionId |
|
|
|
this.questionId = this.curQues.questionId |
|
|
|
this.version = this.curQues.version |
|
|
|
this.version = this.curQues.version |
|
|
|
|
|
|
|
if (this.paperType === 3) this.detailType = 2 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.editorConfig = this.paperType ? { |
|
|
|
this.editorConfig = this.paperType ? { |
|
|
@ -342,6 +349,7 @@ export default { |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
// 初始化 |
|
|
|
// 初始化 |
|
|
|
init (v) { |
|
|
|
init (v) { |
|
|
|
|
|
|
|
this.loading = true |
|
|
|
this.form = _.cloneDeep(this.originForm) |
|
|
|
this.form = _.cloneDeep(this.originForm) |
|
|
|
|
|
|
|
|
|
|
|
const type = this.detailType |
|
|
|
const type = this.detailType |
|
|
@ -419,16 +427,19 @@ export default { |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
|
} |
|
|
|
// 试卷里点击编辑试题进来的 |
|
|
|
// 试卷里点击编辑试题进来的 |
|
|
|
if (this.paperType === 2) { |
|
|
|
if (this.paperType > 1) { |
|
|
|
this.questionBankName = r.questionBankName |
|
|
|
this.questionBankName = r.questionBankName |
|
|
|
console.log("🚀 ~ getKnowledge ~ id:", this.form) |
|
|
|
|
|
|
|
// this.questionBankCategory = r.questionBankCategory |
|
|
|
// this.questionBankCategory = r.questionBankCategory |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.getKnowledge() |
|
|
|
this.getKnowledge() |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.loading = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
this.loading = false |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { } |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取知识点 |
|
|
|
// 获取知识点 |
|
|
|
async getKnowledge () { |
|
|
|
async getKnowledge () { |
|
|
@ -595,9 +606,10 @@ export default { |
|
|
|
let gapfillingItems = content.match(spanRegex) |
|
|
|
let gapfillingItems = content.match(spanRegex) |
|
|
|
if (gapfillingItems !== null) { |
|
|
|
if (gapfillingItems !== null) { |
|
|
|
gapfillingItems.forEach(function (span, index) { |
|
|
|
gapfillingItems.forEach(function (span, index) { |
|
|
|
const pairRegex = /<span class="gapfilling-span" (.*?)">(.*?)______(.*?)<\/span>/ |
|
|
|
let pairRegex = /<span class="gapfilling-span" data-id="(.*?)">(.*?)______(.*?)<\/span>/ |
|
|
|
|
|
|
|
if (span.includes('data-id')) pairRegex = /<span class="gapfilling-span" (.*?)">(.*?)______(.*?)<\/span>/ |
|
|
|
pairRegex.test(span) |
|
|
|
pairRegex.test(span) |
|
|
|
newFormItem.push({ fills: [{ val: '' }], uuid: RegExp.$1, scoreProportion: '0' }) |
|
|
|
newFormItem.push({ fills: [{ val: '' }], uuid: RegExp.$1, scoreProportion: '' }) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
newFormItem.forEach(e => { |
|
|
|
newFormItem.forEach(e => { |
|
|
@ -650,13 +662,17 @@ export default { |
|
|
|
if (invalid) return false |
|
|
|
if (invalid) return false |
|
|
|
if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案') |
|
|
|
if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案') |
|
|
|
} else if (form.questionType === 'fill_blank') { |
|
|
|
} else if (form.questionType === 'fill_blank') { |
|
|
|
|
|
|
|
let scorePro = 0 |
|
|
|
for (const e of blanks) { |
|
|
|
for (const e of blanks) { |
|
|
|
if (e.fills.every(n => !n.val)) { |
|
|
|
if (e.fills.every(n => !n.val)) { |
|
|
|
Util.warningMsg('请输入填空项正确答案') |
|
|
|
Util.warningMsg('请输入填空项正确答案') |
|
|
|
invalid = 1 |
|
|
|
invalid = 1 |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const pro = e.scoreProportion |
|
|
|
|
|
|
|
if (pro && !isNaN(pro)) scorePro = Decimal(scorePro).add(pro || 0).toNumber() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (scorePro && scorePro !== 100) return Util.warningMsg('分值占比不满100,请重新调整') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.submiting = true |
|
|
|
this.submiting = true |
|
|
|