yujialong 4 months ago
parent 8fc87aa06a
commit 1af3178ea3
  1. 2
      public/static/ueditorPlus/ueditor.config.js
  2. 2
      src/components/ueditor/index.vue
  3. 12
      src/const/ques.js
  4. 1
      src/pages/testPaper/detail/auto.vue
  5. 30
      src/pages/testPaper/detail/index.vue
  6. 1
      src/pages/testPaper/detail/manual.vue

@ -50,7 +50,7 @@
// 服务器统一请求接口路径 // 服务器统一请求接口路径
serverUrl: "http://192.168.31.51:9000/exam/exam/upload/configAndUpload", serverUrl: "http://121.37.12.51/exam/exam/upload/configAndUpload",
imageActionName: "imgUpload", imageActionName: "imgUpload",
imageAllowFiles: [ imageAllowFiles: [
".png", ".png",

@ -46,7 +46,7 @@ export default {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
this.instance = UE.getEditor(this.randomId, { this.instance = UE.getEditor(this.randomId, {
UEDITOR_HOME_URL: '/static/ueditorPlus/', UEDITOR_HOME_URL: '/static/ueditorPlus/',
serverUrl: "http://192.168.31.51:9000/exam/exam/upload/configAndUpload", serverUrl: "http://121.37.12.51/exam/exam/upload/configAndUpload",
plugins: 'gapfilling' plugins: 'gapfilling'
}) })

@ -2,19 +2,23 @@ export default {
difficults: [ difficults: [
{ {
id: 'basic', id: 'basic',
name: '基础' name: '基础',
coefficient: 0.2 // 难度系数,试卷里计算试卷难度专用
}, },
{ {
id: 'easy', id: 'easy',
name: '普通' name: '普通',
coefficient: 0.4
}, },
{ {
id: 'medium', id: 'medium',
name: '较难' name: '较难',
coefficient: 0.6
}, },
{ {
id: 'hard', id: 'hard',
name: '难' name: '难',
coefficient: 0.8
}, },
], ],
questionTypes: [ questionTypes: [

@ -405,6 +405,7 @@ export default {
this.$parent.form.paperOutline[i].examQuestions = res.list[i].questions this.$parent.form.paperOutline[i].examQuestions = res.list[i].questions
}) })
this.quesVisible = false this.quesVisible = false
this.$parent.calcDifficult()
this.submiting = false this.submiting = false
} catch (e) { } catch (e) {
this.submiting = false this.submiting = false

@ -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) {

@ -348,6 +348,7 @@ export default {
this.$set(e, 'serialNumber', i + 1) this.$set(e, 'serialNumber', i + 1)
}) })
this.$parent.calcDifficult()
this.selectQuesVisible = false this.selectQuesVisible = false
this.submiting = false this.submiting = false
} catch (e) { } catch (e) {

Loading…
Cancel
Save