|
|
@ -38,7 +38,7 @@ |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="difficult" label="试卷难度"> |
|
|
|
<el-form-item prop="difficult" label="试卷难度"> |
|
|
|
<el-select v-model="form.difficult" clearable placeholder="系统自动评估,也可手动选择"> |
|
|
|
<el-select v-model="form.difficult" placeholder="系统自动评估,也可手动选择" @change="difficultSelected = true"> |
|
|
|
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
<el-tooltip placement="top"> |
|
|
|
<el-tooltip placement="top"> |
|
|
@ -307,6 +307,8 @@ export default { |
|
|
|
quesVisible: false, |
|
|
|
quesVisible: false, |
|
|
|
curRow: {}, |
|
|
|
curRow: {}, |
|
|
|
detailType: '', |
|
|
|
detailType: '', |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
difficultSelected: false, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
@ -443,6 +445,29 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 自动计算试卷难度 |
|
|
|
|
|
|
|
calcDifficult () { |
|
|
|
|
|
|
|
// 如果试卷难度用户已经选择过了,则不用再计算;如果没选择过,则通过公式计算难度:所有试题的难度系数之和/总试题数 |
|
|
|
|
|
|
|
if (this.difficultSelected) return false |
|
|
|
|
|
|
|
let coefficient = 0 // 试题总系数 |
|
|
|
|
|
|
|
let len = 0 // 试题总数 |
|
|
|
|
|
|
|
const diffs = QuesConst.difficults |
|
|
|
|
|
|
|
this.form.paperOutline.map(e => { |
|
|
|
|
|
|
|
len += e.examQuestions.length |
|
|
|
|
|
|
|
coefficient += e.examQuestions.reduce((e, j) => { |
|
|
|
|
|
|
|
const val = diffs.find(n => n.id === j.difficulty) |
|
|
|
|
|
|
|
return e += val ? +val.coefficient : 0 |
|
|
|
|
|
|
|
}, 0) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const result = coefficient / len |
|
|
|
|
|
|
|
this.form.difficult = result <= 0.3 ? |
|
|
|
|
|
|
|
1 : |
|
|
|
|
|
|
|
result > 0.3 && result <= 0.4 ? |
|
|
|
|
|
|
|
2 : |
|
|
|
|
|
|
|
result > 0.4 && result <= 0.5 ? |
|
|
|
|
|
|
|
3 : |
|
|
|
|
|
|
|
4 |
|
|
|
|
|
|
|
}, |
|
|
|
// 自动选题 |
|
|
|
// 自动选题 |
|
|
|
showAuto () { |
|
|
|
showAuto () { |
|
|
|
this.autoVisible = true |
|
|
|
this.autoVisible = true |
|
|
@ -482,6 +507,7 @@ export default { |
|
|
|
delete ques.questionAnswerVersions |
|
|
|
delete ques.questionAnswerVersions |
|
|
|
ques.questionVersionId = id |
|
|
|
ques.questionVersionId = id |
|
|
|
this.curType.examQuestions[this.curQuesIndex] = Object.assign(this.curRow, ques) |
|
|
|
this.curType.examQuestions[this.curQuesIndex] = Object.assign(this.curRow, ques) |
|
|
|
|
|
|
|
this.calcDifficult() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 添加题目 |
|
|
|
// 添加题目 |
|
|
|
showManualDia (item, i, ques) { |
|
|
|
showManualDia (item, i, ques) { |
|
|
@ -505,6 +531,7 @@ export default { |
|
|
|
const cur = item.examQuestions.findIndex(n => n.questionVersionId === e.questionVersionId) |
|
|
|
const cur = item.examQuestions.findIndex(n => n.questionVersionId === e.questionVersionId) |
|
|
|
cur >= 0 && item.examQuestions.splice(cur, 1) |
|
|
|
cur >= 0 && item.examQuestions.splice(cur, 1) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
this.calcDifficult() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Util.warningMsg('请选择数据') |
|
|
|
Util.warningMsg('请选择数据') |
|
|
|
} |
|
|
|
} |
|
|
@ -532,6 +559,7 @@ export default { |
|
|
|
// 移除试题 |
|
|
|
// 移除试题 |
|
|
|
delQues (item, i) { |
|
|
|
delQues (item, i) { |
|
|
|
item.examQuestions.splice(i, 1) |
|
|
|
item.examQuestions.splice(i, 1) |
|
|
|
|
|
|
|
this.calcDifficult() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 提交 |
|
|
|
// 提交 |
|
|
|
async submit (status) { |
|
|
|
async submit (status) { |
|
|
|