-
-
-
或
+
新增答案
@@ -256,7 +258,7 @@ export default {
questionAnswerVersions: [],
questionBankId: '',
questionType: 'single_choice',
- specialtyIds: [],
+ specialtyIds: [1],
stem: '',
allowAttachment: 0,
stemAttachment: '',
@@ -333,19 +335,22 @@ export default {
} else if (type === 4) {
// this.questionBankId = this.row.questionBankId
}
- const { stem, answerAnalysis } = this.$refs
+ const { stem, answerAnalysis, referenceAnswer, uploadInstructions } = this.$refs
stem && stem.instance && stem.setText('')
answerAnalysis && answerAnalysis.instance && answerAnalysis.setText('')
+ referenceAnswer && referenceAnswer.instance && referenceAnswer.setText('')
+ uploadInstructions && uploadInstructions.instance && uploadInstructions.setText('')
this.answerAnalysis = ''
+ this.uploadList = []
// 点击了保存并继续新增则恢复题干以上的字段(不包括题干)
if (v) {
- const { form } = this
+ const { form, beforeSubmitForm: before } = this
form.difficulty = v.difficulty
form.givenYear = v.givenYear
form.knowledgePointIds = this.beforeSubmitForm.knowledgePointIds
form.questionType = v.questionType
- form.specialtyIds = v.specialtyIds
+ form.specialtyIds = before.specialtyIds
this.questionTypeChange(v.questionType)
} else {
this.handleSingleMultiple()
@@ -423,7 +428,7 @@ export default {
pageSize: 1000,
})
this.professionals = res.pageList.records
- if (!this.questionId) this.form.specialtyIds = [1]
+ // if (!this.questionId) this.form.specialtyIds = [1]
} catch (e) { }
},
// 处理树形
@@ -605,6 +610,7 @@ export default {
const opt = form.questionAnswerVersions
if (!stem) return Util.warningMsg('请输入题干')
+ const blanks = this.fillBlanks
if (form.questionType !== 'fill_blank' && form.questionType !== 'essay') {
let invalid = 0
for (const e of opt) {
@@ -614,9 +620,17 @@ export default {
break
}
}
- // debugger
+
if (invalid) return false
if (!opt.find(e => e.answerIsCorrect)) return Util.warningMsg('请设置正确答案')
+ } else if (form.questionType === 'fill_blank') {
+ for (const e of blanks) {
+ if (e.fills.every(n => !n.val)) {
+ Util.warningMsg('请输入填空项正确答案')
+ invalid = 1
+ break
+ }
+ }
}
this.submiting = true
@@ -634,7 +648,6 @@ export default {
// 填空题的答案数据,直接把fillBlanks转化成字符串存
if (form.questionType === 'fill_blank') {
- const blanks = this.fillBlanks
blanks.map((e, i) => e.serial = i + 1) // 全部加个序号
form.questionAnswerVersions[0].answerData = JSON.stringify(blanks)
} else if (form.questionType === 'essay' && this.$refs.referenceAnswer) {
@@ -652,11 +665,11 @@ export default {
// 判断是否有重复试题,如果有,则弹出重复的试题
await this.$post(this.api.checkQuestion, form)
// 没有重复的试题,直接保存
- this.saveQues()
- } else {
- // 仅更新此题
+ form.questionId || this.saveQues()
+ }
+ if (form.questionId) {
try {
- await this.$confirm(`
您确定要保存对本题所做的更改吗?
${this.detailType === 4 ? '' : '
保存后,所有关联的试卷将会自动更新
'}`, '提示', {
+ await this.$confirm(`
您确定要保存对本题所做的更改吗?
${this.detailType === 4 ? '' : '
保存后,所有关联的试卷将会自动更新
'}${keep ? '
系统未识别到与本题相似的题目
' : ''}`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@@ -725,6 +738,10 @@ export default {
font-size: 13px;
}
+ /deep/img {
+ max-width: 100%;
+ }
+
.sum {
margin: 15px 0;
font-size: 13px;
@@ -735,18 +752,32 @@ export default {
.fill-blanks {
.fills {
display: inline-flex;
- align-items: center;
+ align-items: flex-start;
+ flex-wrap: wrap;
+ flex: 1;
+ }
+
+ .fill-items {
+ width: calc(100% - 215px);
+ margin-right: 40px;
}
.fill-item {
- display: inline-flex;
+ display: flex;
align-items: center;
- margin-right: 10px;
+ margin-bottom: 10px;
- .el-input {
- width: 100px;
+ .el-textarea {
+ width: 100%;
margin-right: 10px;
}
+
+ &:first-child,
+ &:last-child {
+ .el-textarea {
+ width: calc(100% - 52px);
+ }
+ }
}
.add-fill {
@@ -767,7 +798,7 @@ export default {
.opts {
.opt {
display: flex;
- align-items: center;
+ align-items: flex-start;
margin-bottom: 15px;
}
diff --git a/src/pages/ques/list/index.vue b/src/pages/ques/list/index.vue
index 1e1ace0..f26e56c 100644
--- a/src/pages/ques/list/index.vue
+++ b/src/pages/ques/list/index.vue
@@ -45,7 +45,8 @@
-
+
@@ -64,7 +65,7 @@
-
diff --git a/src/pages/quesBank/index.vue b/src/pages/quesBank/index.vue
index e5e99fd..9d379ac 100644
--- a/src/pages/quesBank/index.vue
+++ b/src/pages/quesBank/index.vue
@@ -197,7 +197,6 @@ export default {
handleNodeClick () {
this.isNotJoin = ''
this.initData()
- this.$refs.table.clearSelection()
},
// 题库列表
async getList () {
diff --git a/src/pages/testPaper/detail/auto.vue b/src/pages/testPaper/detail/auto.vue
index d418175..d258e49 100644
--- a/src/pages/testPaper/detail/auto.vue
+++ b/src/pages/testPaper/detail/auto.vue
@@ -94,18 +94,13 @@
题库名称