|
|
@ -24,7 +24,7 @@ |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="suggestTime" label="估计用时"> |
|
|
|
<el-form-item prop="suggestTime" label="估计用时"> |
|
|
|
<el-input placeholder="请输入估计用时" v-model="form.suggestTime"> |
|
|
|
<el-input placeholder="请输入估计用时" v-model.number="form.suggestTime"> |
|
|
|
<template slot="append">分钟</template> |
|
|
|
<template slot="append">分钟</template> |
|
|
|
</el-input> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
@ -59,7 +59,7 @@ |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="name" label="题型" align="center" min-width="120"> |
|
|
|
<el-table-column prop="name" label="题型" align="center" min-width="120"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-select v-model="scope.row.questionType" placeholder="请选择题型"> |
|
|
|
<el-select v-model="scope.row.questionType" placeholder="请选择题型" @change="questionTypeChange(scope.row)"> |
|
|
|
<el-option v-for="(item, i) in questionTypes" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
<el-option v-for="(item, i) in questionTypes" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -76,7 +76,7 @@ |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" align="center" width="120"> |
|
|
|
<el-table-column label="操作" align="center" width="120"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<i class="el-icon-circle-plus-outline action-icon" @click="addLine(scope.$index)"></i> |
|
|
|
<i class="el-icon-circle-plus-outline action-icon m-r-10" @click="addLine(scope.$index)"></i> |
|
|
|
<i class="el-icon-remove-outline action-icon" @click="delLine(scope.$index)"></i> |
|
|
|
<i class="el-icon-remove-outline action-icon" @click="delLine(scope.$index)"></i> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
@ -88,7 +88,7 @@ |
|
|
|
<div class="flex j-between a-center"> |
|
|
|
<div class="flex j-between a-center"> |
|
|
|
<p>选择试题</p> |
|
|
|
<p>选择试题</p> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-button type="primary">一键分配分值</el-button> |
|
|
|
<el-button type="primary" @click="allocationAll">一键分配分值</el-button> |
|
|
|
<el-button type="primary">自动选题</el-button> |
|
|
|
<el-button type="primary">自动选题</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -104,16 +104,20 @@ |
|
|
|
<el-button type="primary" @click="allocation(item)">一键分配分值</el-button> |
|
|
|
<el-button type="primary" @click="allocation(item)">一键分配分值</el-button> |
|
|
|
<el-button type="primary" @click="showQuesDia(item)">批量添加</el-button> |
|
|
|
<el-button type="primary" @click="showQuesDia(item)">批量添加</el-button> |
|
|
|
<el-button type="danger" @click="batchDelQues(item)">批量删除试题</el-button> |
|
|
|
<el-button type="danger" @click="batchDelQues(item)">批量删除试题</el-button> |
|
|
|
|
|
|
|
{{ item.shrink }} |
|
|
|
|
|
|
|
<i class="arrow el-icon-arrow-down" @click="item.shrink = !item.shrink"></i> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<p class="sum">本大题共{{ item.questionNum }}小题,共{{ item.targetScore }}分</p> |
|
|
|
<p class="sum">本大题共{{ item.questionNum }}小题,共{{ item.targetScore }}分</p> |
|
|
|
<div v-for="(ques, j) in item.examQuestions" :key="j" class="ques-wrap"> |
|
|
|
|
|
|
|
|
|
|
|
<div :class="['ques-wrap', { hide: item.shrink }]"> |
|
|
|
|
|
|
|
<div v-for="(ques, j) in item.examQuestions" :key="j" class="ques-item"> |
|
|
|
<el-checkbox v-model="ques.check"></el-checkbox> |
|
|
|
<el-checkbox v-model="ques.check"></el-checkbox> |
|
|
|
<div class="ques-info"> |
|
|
|
<div class="ques-info"> |
|
|
|
<div class="top-line"> |
|
|
|
<div class="top-line"> |
|
|
|
<span class="label">{{ j + 1 }} / 10</span> |
|
|
|
<span class="label">{{ j + 1 }} / 10</span> |
|
|
|
<span class="label">{{ item.questionType }}</span> |
|
|
|
<span class="label">{{ questionTypes.find(e => e.id === item.questionType).name }}</span> |
|
|
|
<div v-html="ques.stem"></div>{{ ques.score }} |
|
|
|
<div v-html="ques.stem"></div> |
|
|
|
<p>(<el-input class="score" placeholder="请输入" v-model="ques.score" />分)</p> |
|
|
|
<p>(<el-input class="score" placeholder="请输入" v-model="ques.score" />分)</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- <div v-for="(opt, j) in ques.examQuestions" :key="j" class="opts"> |
|
|
|
<!-- <div v-for="(opt, j) in ques.examQuestions" :key="j" class="opts"> |
|
|
@ -127,13 +131,14 @@ |
|
|
|
<el-input class="score" v-model="ques.sort" /> |
|
|
|
<el-input class="score" v-model="ques.sort" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-button type="text">编辑试题</el-button> |
|
|
|
<el-button type="text">编辑试题</el-button> |
|
|
|
<el-button type="text">更换试题</el-button> |
|
|
|
<el-button type="text" @click="showQuesDia(item, j, ques)">更换试题</el-button> |
|
|
|
<el-button type="text" @click="showQuesDia(item, j)">添加试题</el-button> |
|
|
|
<el-button type="text" @click="showQuesDia(item, j)">添加试题</el-button> |
|
|
|
<el-button type="text" @click="delQues(item, j)">移除试题</el-button> |
|
|
|
<el-button type="text" @click="delQues(item, j)">移除试题</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
|
|
|
|
|
|
|
@ -206,36 +211,41 @@ export default { |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
|
outlineName: '单选题', |
|
|
|
outlineName: '单选题', |
|
|
|
questionNum: '10', |
|
|
|
questionNum: '10', |
|
|
|
questionType: '单选题', |
|
|
|
questionType: 'single_choice', |
|
|
|
targetScore: '20.0', |
|
|
|
targetScore: '20.0', |
|
|
|
|
|
|
|
shrink: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
|
outlineName: '多选题', |
|
|
|
outlineName: '多选题', |
|
|
|
questionNum: '5', |
|
|
|
questionNum: '5', |
|
|
|
questionType: '多选题', |
|
|
|
questionType: 'multiple_choice', |
|
|
|
targetScore: '15.0', |
|
|
|
targetScore: '15.0', |
|
|
|
|
|
|
|
shrink: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
|
outlineName: '判断题', |
|
|
|
outlineName: '判断题', |
|
|
|
questionNum: '5', |
|
|
|
questionNum: '5', |
|
|
|
questionType: '判断题', |
|
|
|
questionType: 'judgement', |
|
|
|
targetScore: '10.0', |
|
|
|
targetScore: '10.0', |
|
|
|
|
|
|
|
shrink: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
|
outlineName: '填空题', |
|
|
|
outlineName: '填空题', |
|
|
|
questionNum: '5', |
|
|
|
questionNum: '5', |
|
|
|
questionType: '填空题', |
|
|
|
questionType: 'fill_blank', |
|
|
|
targetScore: '15.0', |
|
|
|
targetScore: '15.0', |
|
|
|
|
|
|
|
shrink: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
|
outlineName: '问答题', |
|
|
|
outlineName: '问答题', |
|
|
|
questionNum: '3', |
|
|
|
questionNum: '3', |
|
|
|
questionType: '问答题', |
|
|
|
questionType: 'essay', |
|
|
|
targetScore: '40.0', |
|
|
|
targetScore: '40.0', |
|
|
|
|
|
|
|
shrink: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
@ -260,6 +270,7 @@ export default { |
|
|
|
quesVisible: false, |
|
|
|
quesVisible: false, |
|
|
|
curType: {}, |
|
|
|
curType: {}, |
|
|
|
curQuesIndex: 0, |
|
|
|
curQuesIndex: 0, |
|
|
|
|
|
|
|
curQues: null, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
@ -316,6 +327,12 @@ export default { |
|
|
|
showTemplate () { |
|
|
|
showTemplate () { |
|
|
|
this.templateVisible = true |
|
|
|
this.templateVisible = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 大纲题型选择回调 |
|
|
|
|
|
|
|
questionTypeChange (row) { |
|
|
|
|
|
|
|
// 如果大题名称还是默认的名字(即5个题型的名字),那么修改了题型后需要同步修改大题名称,用户自定义了大题名称,则不修改 |
|
|
|
|
|
|
|
if (this.questionTypes.find(e => e.name === row.outlineName)) row.outlineName = this.questionTypes.find(e => e.id === row.questionType).name |
|
|
|
|
|
|
|
}, |
|
|
|
// 试卷大纲添加行 |
|
|
|
// 试卷大纲添加行 |
|
|
|
addLine (i) { |
|
|
|
addLine (i) { |
|
|
|
this.form.paperOutline.splice(i + 1, 0, { |
|
|
|
this.form.paperOutline.splice(i + 1, 0, { |
|
|
@ -324,17 +341,40 @@ export default { |
|
|
|
questionNum: '', |
|
|
|
questionNum: '', |
|
|
|
questionType: '', |
|
|
|
questionType: '', |
|
|
|
targetScore: '', |
|
|
|
targetScore: '', |
|
|
|
|
|
|
|
shrink: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 试卷大纲移除行 |
|
|
|
// 试卷大纲移除行 |
|
|
|
delLine (i) { |
|
|
|
delLine (i) { |
|
|
|
this.form.paperOutline.length > 1 && this.form.paperOutline.splice(i, 1) |
|
|
|
this.form.paperOutline.length > 1 && this.form.paperOutline.splice(i, 1) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 一键分配所有题目的分值 |
|
|
|
|
|
|
|
async allocationAll () { |
|
|
|
|
|
|
|
const paper = this.form.paperOutline |
|
|
|
|
|
|
|
const { data } = await this.$post(this.api.avgValues, { |
|
|
|
|
|
|
|
avgValueList: paper.map(e => { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
questionNum: e.examQuestions.length, |
|
|
|
|
|
|
|
targetScore: e.targetScore, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if (data && data.avgValueList && data.avgValueList.length) { |
|
|
|
|
|
|
|
data.avgValueList.map((e, i) => { |
|
|
|
|
|
|
|
// scores里有-1则不用循环 |
|
|
|
|
|
|
|
e.scores.includes(-1) || e.scores.map((n, j) => { |
|
|
|
|
|
|
|
paper[i].examQuestions[j].score = n |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
// 添加题目 |
|
|
|
// 添加题目 |
|
|
|
showQuesDia (item, i) { |
|
|
|
showQuesDia (item, i, ques) { |
|
|
|
// debugger |
|
|
|
|
|
|
|
this.curType = item |
|
|
|
this.curType = item |
|
|
|
this.curQuesIndex = i |
|
|
|
this.curQuesIndex = i |
|
|
|
|
|
|
|
this.curQues = ques |
|
|
|
this.quesVisible = true |
|
|
|
this.quesVisible = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 批量删除试题 |
|
|
|
// 批量删除试题 |
|
|
@ -382,11 +422,51 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 提交 |
|
|
|
// 提交 |
|
|
|
async submit (status) { |
|
|
|
async submit (status) { |
|
|
|
|
|
|
|
// this.form.paperOutline[0].examQuestions.reduce((prev, curr) => { |
|
|
|
|
|
|
|
// console.log(111, prev, curr) |
|
|
|
|
|
|
|
// // + prev.score + +curr.score |
|
|
|
|
|
|
|
// }, 0) |
|
|
|
|
|
|
|
// return console.log(44,) |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.submiting) return false |
|
|
|
this.$refs.form.validate(async (valid) => { |
|
|
|
this.$refs.form.validate(async (valid) => { |
|
|
|
if (valid) { |
|
|
|
if (valid) { |
|
|
|
const form = _.cloneDeep(this.form) |
|
|
|
const form = _.cloneDeep(this.form) |
|
|
|
// if (!form.categoryIds.length) return Util.warningMsg('请选择分类') |
|
|
|
if (isNaN(form.suggestTime) || form.suggestTime < 1 || form.suggestTime % 1) return Util.warningMsg('估计用时请输入正整数') |
|
|
|
|
|
|
|
const paper = form.paperOutline |
|
|
|
|
|
|
|
let invalid = 0 |
|
|
|
|
|
|
|
for (const i in paper) { |
|
|
|
|
|
|
|
const e = paper[i] |
|
|
|
|
|
|
|
if (!e.questionType) { |
|
|
|
|
|
|
|
Util.warningMsg('请选择题型') |
|
|
|
|
|
|
|
invalid = 1 |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!e.questionNum) { |
|
|
|
|
|
|
|
Util.warningMsg('请输入目标题数') |
|
|
|
|
|
|
|
invalid = 1 |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!e.targetScore) { |
|
|
|
|
|
|
|
Util.warningMsg('请输入目标分值') |
|
|
|
|
|
|
|
invalid = 1 |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 该大题里的小题总数需等于目标题数 |
|
|
|
|
|
|
|
if (+e.questionNum !== e.examQuestions.length) { |
|
|
|
|
|
|
|
Util.warningMsg(`第${this.arabicToChinese(i + 1)}大题的小题总数跟目标题数不一致,请重新修改`) |
|
|
|
|
|
|
|
invalid = 1 |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 该大题里的小题总分需等于目标分值 |
|
|
|
|
|
|
|
// if (+e.targetScore !== e.examQuestions.length) { |
|
|
|
|
|
|
|
// Util.warningMsg(`第${this.arabicToChinese(i + 1)}大题的小题总分跟目标分值不一致,请重新修改`) |
|
|
|
|
|
|
|
// invalid = 1 |
|
|
|
|
|
|
|
// break |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (invalid) return false |
|
|
|
|
|
|
|
|
|
|
|
this.submiting = true |
|
|
|
this.submiting = true |
|
|
|
form.particularYear = +(dayjs(form.particularYear).format('YYYY')) |
|
|
|
form.particularYear = +(dayjs(form.particularYear).format('YYYY')) |
|
|
|
form.libraryId = this.libraryId |
|
|
|
form.libraryId = this.libraryId |
|
|
@ -394,7 +474,8 @@ export default { |
|
|
|
form.remarks = this.$refs.remarks.getUEContent() |
|
|
|
form.remarks = this.$refs.remarks.getUEContent() |
|
|
|
form.score = this.score |
|
|
|
form.score = this.score |
|
|
|
form.status = status |
|
|
|
form.status = status |
|
|
|
form.paperOutline.map(e => { |
|
|
|
|
|
|
|
|
|
|
|
paper.map(e => { |
|
|
|
e.targetScore = +e.targetScore |
|
|
|
e.targetScore = +e.targetScore |
|
|
|
e.examQuestions = e.examQuestions.map(n => { |
|
|
|
e.examQuestions = e.examQuestions.map(n => { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -403,9 +484,9 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
debugger |
|
|
|
if (typeof form.classificationId === 'object') form.classificationId = form.classificationId[form.classificationId.length - 1] |
|
|
|
if (typeof form.classificationId === 'object') form.classificationId = form.classificationId[form.classificationId.length - 1] |
|
|
|
form.questionType = [...new Set(form.paperOutline.map(e => e.questionType))].join('、') |
|
|
|
form.questionType = [...new Set(paper.map(e => e.questionType))].join('、') |
|
|
|
form.createSource = 1 |
|
|
|
form.createSource = 1 |
|
|
|
try { |
|
|
|
try { |
|
|
|
await this.$post(this.api.saveExamPaper, form) |
|
|
|
await this.$post(this.api.saveExamPaper, form) |
|
|
@ -427,10 +508,6 @@ export default { |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.action-icon { |
|
|
|
|
|
|
|
margin-right: 10px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ques { |
|
|
|
.ques { |
|
|
|
li { |
|
|
|
li { |
|
|
|
padding: 15px; |
|
|
|
padding: 15px; |
|
|
@ -449,6 +526,13 @@ export default { |
|
|
|
font-size: 13px; |
|
|
|
font-size: 13px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.arrow { |
|
|
|
|
|
|
|
margin-left: 10px; |
|
|
|
|
|
|
|
font-size: 16px; |
|
|
|
|
|
|
|
color: #a9a9a9; |
|
|
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.sum { |
|
|
|
.sum { |
|
|
|
margin: 15px 0; |
|
|
|
margin: 15px 0; |
|
|
|
font-size: 13px; |
|
|
|
font-size: 13px; |
|
|
@ -456,6 +540,16 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.ques-wrap { |
|
|
|
.ques-wrap { |
|
|
|
|
|
|
|
// transition: 2s; |
|
|
|
|
|
|
|
transition-property: height; |
|
|
|
|
|
|
|
transition-duration: .25s, 1s; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&.hide { |
|
|
|
|
|
|
|
height: 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ques-item { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
align-items: flex-start; |
|
|
|
align-items: flex-start; |
|
|
|
|
|
|
|
|
|
|
|