|
|
|
@ -160,14 +160,18 @@ |
|
|
|
|
<p class="fill-title">每空分值</p> |
|
|
|
|
<div v-for="(score, k) in ques.fillScores" :key="k" class="input-wrap"> |
|
|
|
|
<el-input class="l-input" placeholder="请输入分值" v-model="score.val" |
|
|
|
|
@change="fillScoreChange(ques)" />分 填空项{{ k + 1 }} |
|
|
|
|
@change="fillScoreChange(ques)" /> |
|
|
|
|
分 填空项{{ k + 1 }} |
|
|
|
|
<span |
|
|
|
|
v-if="ques.answerData && ques.answerData.length && ques.answerData[k]"> 建议分值占比:{{ |
|
|
|
|
ques.answerData[k].scoreProportion }}%</span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div slot="reference" class="input-wrap"> |
|
|
|
|
查看每空分值<el-input class="l-input" placeholder="请输入分值" v-model="ques.score" readonly /> |
|
|
|
|
</div> |
|
|
|
|
</el-popover> |
|
|
|
|
<el-button v-if="!ques.isDel" type="text" @click="toQues(item, j, ques)">编辑试题</el-button> |
|
|
|
|
<el-button v-if="!ques.isDel" type="text" @click="toQues(item, j, ques, 1)">编辑试题</el-button> |
|
|
|
|
<el-button type="text" @click="showManualDia(item, j, ques)">更换试题</el-button> |
|
|
|
|
<el-button type="text" @click="showManualDia(item, j)">添加试题</el-button> |
|
|
|
|
<el-button type="text" @click="delQues(item, j)">移除试题</el-button> |
|
|
|
@ -178,20 +182,20 @@ |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="stem" :id="'stem' + ques.questionVersionId" v-html="ques.stem"></div> |
|
|
|
|
<div class="stem html-parse" :id="'stem' + ques.questionVersionId" v-html="ques.stem"></div> |
|
|
|
|
|
|
|
|
|
<!-- 单选、多选、判断的选项 --> |
|
|
|
|
<template |
|
|
|
|
v-if="item.questionType !== 'fill_blank' && item.questionType !== 'essay' && ques.questionAnswerVersionsList"> |
|
|
|
|
<div v-for="(opt, j) in ques.questionAnswerVersionsList" :key="j" class="opt"> |
|
|
|
|
<span>{{ numToLetter(j) }}. </span> |
|
|
|
|
<div class="text" v-html="opt.optionText"></div> |
|
|
|
|
<div class="text html-parse" v-html="opt.optionText"></div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<div class="bottom-line"> |
|
|
|
|
【{{ item.questionType === 'essay' ? '参考答案' : '正确答案' }}】: |
|
|
|
|
<div v-html="getCorrectAnswer(ques)" class="ans"></div> |
|
|
|
|
<div v-html="getCorrectAnswer(ques)" class="ans html-parse"></div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div v-if="ques.knowledgePointList && ques.knowledgePointList.length" class="bottom-line"> |
|
|
|
@ -200,6 +204,10 @@ |
|
|
|
|
effect="plain">{{ |
|
|
|
|
kp.name }}</el-tag> |
|
|
|
|
</div> |
|
|
|
|
<div v-if="ques.questionBankName" class="bottom-line"> |
|
|
|
|
<span>来自:</span> |
|
|
|
|
<div>{{ ques.questionBankName }}</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</draggable> |
|
|
|
@ -215,30 +223,33 @@ |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div v-if="form.paperOutline && form.paperOutline.length" class="layer"> |
|
|
|
|
<table class="table"> |
|
|
|
|
<thead> |
|
|
|
|
<tr> |
|
|
|
|
<th width="30%">大题</th> |
|
|
|
|
<th width="35%">已添加题数/目标题数</th> |
|
|
|
|
<th width="35%">已分配分值/目标分值</th> |
|
|
|
|
</tr> |
|
|
|
|
</thead> |
|
|
|
|
<tbody> |
|
|
|
|
<tr v-for="(item, i) in form.paperOutline" :key="i"> |
|
|
|
|
<td>第{{ arabicToChinese(i + 1) }}大题</td> |
|
|
|
|
<td>{{ item.examQuestions.length }}/{{ item.questionNum }}</td> |
|
|
|
|
<td>{{ item.examQuestions.reduce((e, j) => (e += +j.score), 0) }}/{{ item.targetScore }}</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr> |
|
|
|
|
<td>总计</td> |
|
|
|
|
<td>{{ overview.alreadyQuesCount }}/{{ overview.questionCount }}</td> |
|
|
|
|
<td>{{ overview.alreadyScore }}/{{ overview.totalScore }}</td> |
|
|
|
|
</tr> |
|
|
|
|
</tbody> |
|
|
|
|
</table> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
<draggable v-if="form.paperOutline && form.paperOutline.length"> |
|
|
|
|
<!-- <transition-group :key="1"> --> |
|
|
|
|
<div class="layer" id="layer" ref="layer"> |
|
|
|
|
<table class="table"> |
|
|
|
|
<thead> |
|
|
|
|
<tr> |
|
|
|
|
<th width="30%">大题</th> |
|
|
|
|
<th width="35%">已添加题数/目标题数</th> |
|
|
|
|
<th width="35%">已分配分值/目标分值</th> |
|
|
|
|
</tr> |
|
|
|
|
</thead> |
|
|
|
|
<tbody> |
|
|
|
|
<tr v-for="(item, i) in form.paperOutline" :key="i"> |
|
|
|
|
<td>第{{ arabicToChinese(i + 1) }}大题</td> |
|
|
|
|
<td>{{ item.examQuestions.length }}/{{ item.questionNum }}</td> |
|
|
|
|
<td>{{ item.examQuestions.reduce((e, j) => (e += +j.score), 0) || 0 }}/{{ item.targetScore }}</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr> |
|
|
|
|
<td>总计</td> |
|
|
|
|
<td>{{ overview.alreadyQuesCount }}/{{ overview.questionCount }}</td> |
|
|
|
|
<td>{{ overview.alreadyScore }}/{{ overview.totalScore }}</td> |
|
|
|
|
</tr> |
|
|
|
|
</tbody> |
|
|
|
|
</table> |
|
|
|
|
</div> |
|
|
|
|
<!-- </transition-group> --> |
|
|
|
|
</draggable> |
|
|
|
|
|
|
|
|
|
<Template :visible.sync="templateVisible" /> |
|
|
|
|
<Manual :visible.sync="manualVisible" :questionType.sync="curType.questionType" /> |
|
|
|
@ -247,13 +258,14 @@ |
|
|
|
|
|
|
|
|
|
<el-drawer title="编辑试题" :visible.sync="addQuesVisible" size="1200px" :close-on-click-modal="false" |
|
|
|
|
custom-class="editques-dia"> |
|
|
|
|
<QuesDetail :paperType.sync="testPaperType" :curQues.sync="curRow" @closeAdd="closeAdd" |
|
|
|
|
<QuesDetail :key="quesKey" :paperType.sync="testPaperType" :curQues.sync="curRow" @closeAdd="closeAdd" |
|
|
|
|
@updateQues="updateQues" /> |
|
|
|
|
</el-drawer> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import Draggable from 'vuedraggable' |
|
|
|
|
import Sortable from 'sortablejs' |
|
|
|
|
import UeditorPlus from '@/components/ueditorPlus' |
|
|
|
|
import Breadcrumb from '@/components/breadcrumb' |
|
|
|
|
import Template from './template' |
|
|
|
@ -394,6 +406,7 @@ export default { |
|
|
|
|
difficultSelected: false, |
|
|
|
|
|
|
|
|
|
addQuesVisible: false, |
|
|
|
|
quesKey: 1, |
|
|
|
|
testPaperType: 2, |
|
|
|
|
|
|
|
|
|
repeatVisible: false, |
|
|
|
@ -403,14 +416,6 @@ export default { |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
// 目标总题数 |
|
|
|
|
questionCount () { |
|
|
|
|
return this.form.paperOutline.reduce((e, j) => (e += +j.questionNum), 0) |
|
|
|
|
}, |
|
|
|
|
// 目标总分 |
|
|
|
|
score () { |
|
|
|
|
return this.form.paperOutline.reduce((e, j) => (e += +j.targetScore), 0) |
|
|
|
|
}, |
|
|
|
|
// 试题概览 |
|
|
|
|
overview () { |
|
|
|
|
const paper = this.form.paperOutline |
|
|
|
@ -449,6 +454,11 @@ export default { |
|
|
|
|
name: '创建试卷' |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
// console.log(44, Sortable, document.querySelector('#layer')) |
|
|
|
|
// new Sortable(document.querySelector('#layer'), { |
|
|
|
|
// group: "name", |
|
|
|
|
// sort: true, |
|
|
|
|
// }) |
|
|
|
|
this.getDetail() |
|
|
|
|
this.getType() |
|
|
|
|
this.getProfessional() |
|
|
|
@ -464,6 +474,8 @@ export default { |
|
|
|
|
id: paperId |
|
|
|
|
}) |
|
|
|
|
const r = res.examPaper |
|
|
|
|
delete r.createTime |
|
|
|
|
delete r.updateTime |
|
|
|
|
const paper = r.paperOutline |
|
|
|
|
paper.map(e => { |
|
|
|
|
e.shrink = false |
|
|
|
@ -553,6 +565,7 @@ export default { |
|
|
|
|
return { |
|
|
|
|
questionNum: e.examQuestions.length, |
|
|
|
|
targetScore: e.targetScore, |
|
|
|
|
questionType: e.questionType, |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
@ -573,7 +586,8 @@ export default { |
|
|
|
|
const { data } = await this.$post(this.api.avgValues, { |
|
|
|
|
avgValueList: [{ |
|
|
|
|
questionNum: item.examQuestions.length, |
|
|
|
|
targetScore: +item.targetScore |
|
|
|
|
targetScore: +item.targetScore, |
|
|
|
|
questionType: item.questionType, |
|
|
|
|
}] |
|
|
|
|
}) |
|
|
|
|
if (data && data.avgValueList && data.avgValueList.length) { |
|
|
|
@ -587,10 +601,11 @@ export default { |
|
|
|
|
// 填空题一键分配 |
|
|
|
|
async fillBlankAllocation (list) { |
|
|
|
|
const param = list.map(e => { |
|
|
|
|
let { answerData } = e.questionAnswerVersionsList[0] |
|
|
|
|
let { answerData } = e |
|
|
|
|
if (answerData) { |
|
|
|
|
answerData = JSON.parse(answerData) |
|
|
|
|
return { |
|
|
|
|
questionType: e.questionType, |
|
|
|
|
answerData: e.questionAnswerVersionsList[0].answerData, |
|
|
|
|
questionNum: answerData.length, |
|
|
|
|
targetScore: e.score, |
|
|
|
|
questionId: e.questionVersionId |
|
|
|
@ -606,7 +621,6 @@ export default { |
|
|
|
|
// scores里有-1则不用循环 |
|
|
|
|
if (!e.scores.includes(-1)) { |
|
|
|
|
const { fillScores } = list[i] |
|
|
|
|
debugger |
|
|
|
|
if (fillScores) { |
|
|
|
|
for (const j in fillScores) { |
|
|
|
|
fillScores[j].val = e.scores[j] |
|
|
|
@ -647,9 +661,8 @@ export default { |
|
|
|
|
getCorrectAnswer (e) { |
|
|
|
|
if (e.questionType === 'fill_blank') { // 填空题 |
|
|
|
|
// answerData里存了该填空题所有填空项的正确答案及分值占比,对象转化为字符串存起来了 |
|
|
|
|
let data = e.questionAnswerVersionsList[0].answerData |
|
|
|
|
let data = e.answerData |
|
|
|
|
if (data) { |
|
|
|
|
data = JSON.parse(data) |
|
|
|
|
let result = '' |
|
|
|
|
data.map((e, i) => { |
|
|
|
|
result += `填空项${i + 1}:${e.fills.map(n => n.val).join('|')};` |
|
|
|
@ -687,7 +700,7 @@ export default { |
|
|
|
|
let { answerData } = opts[0] |
|
|
|
|
if (answerData) { |
|
|
|
|
answerData = JSON.parse(answerData) |
|
|
|
|
|
|
|
|
|
ques.answerData = answerData |
|
|
|
|
// 正确答案 |
|
|
|
|
let { jsonText } = ques |
|
|
|
|
let scores |
|
|
|
@ -716,7 +729,9 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 编辑试题 |
|
|
|
|
toQues (item, i, ques) { |
|
|
|
|
toQues (item, i, ques, type) { |
|
|
|
|
this.testPaperType = type |
|
|
|
|
this.quesKey++ |
|
|
|
|
this.curType = item |
|
|
|
|
this.curQuesIndex = i |
|
|
|
|
this.curRow = ques |
|
|
|
@ -730,7 +745,6 @@ export default { |
|
|
|
|
updateQues (ques, id) { |
|
|
|
|
ques.questionAnswerVersionsList = ques.questionAnswerVersions |
|
|
|
|
delete ques.questionAnswerVersions |
|
|
|
|
ques.questionVersionId = id |
|
|
|
|
this.curType.examQuestions[this.curQuesIndex] = Object.assign(this.curRow, ques) |
|
|
|
|
this.calcDifficult() |
|
|
|
|
}, |
|
|
|
@ -783,14 +797,16 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 移除试题 |
|
|
|
|
async delQues (item, i) { |
|
|
|
|
async delQues (item, i, noConfirm) { |
|
|
|
|
try { |
|
|
|
|
await this.$confirm(`确认要移除吗?`, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
closeOnClickModal: false, |
|
|
|
|
}) |
|
|
|
|
if (!noConfirm) { |
|
|
|
|
await this.$confirm(`确认要移除吗?`, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
closeOnClickModal: false, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
item.examQuestions.splice(i, 1) |
|
|
|
|
item.checkAll = false |
|
|
|
|
this.calcDifficult() |
|
|
|
@ -993,7 +1009,7 @@ export default { |
|
|
|
|
if (typeof form.classificationId === 'object') form.classificationId = form.classificationId[form.classificationId.length - 1] |
|
|
|
|
|
|
|
|
|
const { questionTypes } = QuesConst |
|
|
|
|
form.questionType = [...new Set(paper.map(e => questionTypes.find(n => n.id === e.questionType).name))].join('、') // 试题类型 |
|
|
|
|
form.questionType = [...new Set(paper.map(e => questionTypes.find(n => n.id === e.questionType).name))].join(',') // 试题类型 |
|
|
|
|
form.createSource = 1 |
|
|
|
|
if (isCopy) form.paperId = '' |
|
|
|
|
this.tempForm = form |
|
|
|
@ -1157,6 +1173,20 @@ export default { |
|
|
|
|
border-radius: 2px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/deep/.html-parse { |
|
|
|
|
table { |
|
|
|
|
display: table; |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
border-collapse: collapse; |
|
|
|
|
|
|
|
|
|
th, |
|
|
|
|
td { |
|
|
|
|
padding: 5px 10px; |
|
|
|
|
border: 1px solid #DDD; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.stem { |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
} |
|
|
|
@ -1192,7 +1222,7 @@ export default { |
|
|
|
|
.bottom-line { |
|
|
|
|
display: flex; |
|
|
|
|
align-items: baseline; |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
margin-top: 10px; |
|
|
|
|
font-size: 13px; |
|
|
|
|
color: #333; |
|
|
|
|
} |
|
|
|
|