|
|
@ -12,9 +12,9 @@ |
|
|
|
value-format="yyyy"> |
|
|
|
value-format="yyyy"> |
|
|
|
</el-date-picker> |
|
|
|
</el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item required label="所属试卷分类"> |
|
|
|
<el-form-item prop="classificationId" label="所属试卷分类"> |
|
|
|
<el-cascader placeholder="请选择所属试卷分类" :options="types" v-model="form.classificationId" :props="cascaderProps" |
|
|
|
<el-cascader filterable placeholder="请选择所属试卷分类" :options="types" v-model="form.classificationId" |
|
|
|
clearable style="width: 100%"> |
|
|
|
:props="cascaderProps" clearable style="width: 100%"> |
|
|
|
</el-cascader> |
|
|
|
</el-cascader> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -32,7 +32,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="item-line"> |
|
|
|
<div class="item-line"> |
|
|
|
<el-form-item prop="professionals" label="所属专业"> |
|
|
|
<el-form-item prop="professionals" label="所属专业"> |
|
|
|
<el-select v-model="form.professionalId" multiple clearable placeholder="请选择所属专业"> |
|
|
|
<el-select v-model="form.professionalId" filterable multiple clearable placeholder="请选择所属专业"> |
|
|
|
<el-option v-for="(item, i) in professionals" :key="i" :label="item.professionalName" |
|
|
|
<el-option v-for="(item, i) in professionals" :key="i" :label="item.professionalName" |
|
|
|
:value="item.professionalId" filter></el-option> |
|
|
|
:value="item.professionalId" filter></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
@ -128,6 +128,8 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<p class="sum">本大题共{{ item.questionNum }}小题,共{{ item.targetScore }}分</p> |
|
|
|
<p class="sum">本大题共{{ item.questionNum }}小题,共{{ item.targetScore }}分</p> |
|
|
|
|
|
|
|
<el-checkbox v-if="item.examQuestions && item.examQuestions.length" class="m-l-15" v-model="item.checkAll" |
|
|
|
|
|
|
|
@change="e => item.examQuestions.map(n => n.check = e)">全选</el-checkbox> |
|
|
|
|
|
|
|
|
|
|
|
<div :class="['ques-wrap', { hide: item.shrink }]"> |
|
|
|
<div :class="['ques-wrap', { hide: item.shrink }]"> |
|
|
|
<draggable v-model="item.examQuestions" :group="dragGroup" chosenClass="chosen" animation="1000" |
|
|
|
<draggable v-model="item.examQuestions" :group="dragGroup" chosenClass="chosen" animation="1000" |
|
|
@ -144,8 +146,6 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="stem" :id="'stem' + ques.questionVersionId" v-html="getQuesStem(ques)"></div> |
|
|
|
<div class="stem" :id="'stem' + ques.questionVersionId" v-html="getQuesStem(ques)"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<p v-if="item.questionType !== 'fill_blank'">(<el-input class="l-input" placeholder="请输入分值" |
|
|
|
|
|
|
|
v-model="ques.score" />分)</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 单选、多选、判断的选项 --> |
|
|
|
<!-- 单选、多选、判断的选项 --> |
|
|
@ -163,15 +163,31 @@ |
|
|
|
<div v-html="getCorrectAnswer(ques)"></div> |
|
|
|
<div v-html="getCorrectAnswer(ques)"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="actions"> |
|
|
|
<div class="actions"> |
|
|
|
<div class="sort"> |
|
|
|
<p v-if="item.questionType !== 'fill_blank'" class="m-r-10 input-wrap"> |
|
|
|
|
|
|
|
(<el-input class="l-input" placeholder="请输入分值" v-model="ques.score" />分)</p> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-popover v-else placement="bottom" width="400" trigger="click"> |
|
|
|
|
|
|
|
<div v-if="ques.fillScores" class="fill-scores"> |
|
|
|
|
|
|
|
<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 }} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div slot="reference" class="input-wrap"> |
|
|
|
|
|
|
|
查看每空分值<el-input class="l-input" placeholder="请输入分值" v-model="ques.score" /> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</el-popover> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <el-button type="text" @click="toQues(item, j, ques)">编辑试题</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> |
|
|
|
|
|
|
|
<div class="input-wrap"> |
|
|
|
<span>排序</span> |
|
|
|
<span>排序</span> |
|
|
|
<el-input class="l-input sort-input" v-model="ques.serialNumber" |
|
|
|
<el-input class="l-input sort-input" v-model="ques.serialNumber" |
|
|
|
@change="sortChange(item, ques)" /> |
|
|
|
@change="sortChange(item, ques)" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-button type="text" @click="toQues(item, j, ques)">编辑试题</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> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -257,6 +273,7 @@ export default { |
|
|
|
questionType: 'single_choice', |
|
|
|
questionType: 'single_choice', |
|
|
|
targetScore: '20.0', |
|
|
|
targetScore: '20.0', |
|
|
|
shrink: false, |
|
|
|
shrink: false, |
|
|
|
|
|
|
|
checkAll: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
@ -265,6 +282,7 @@ export default { |
|
|
|
questionType: 'multiple_choice', |
|
|
|
questionType: 'multiple_choice', |
|
|
|
targetScore: '15.0', |
|
|
|
targetScore: '15.0', |
|
|
|
shrink: false, |
|
|
|
shrink: false, |
|
|
|
|
|
|
|
checkAll: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
@ -273,6 +291,7 @@ export default { |
|
|
|
questionType: 'judgement', |
|
|
|
questionType: 'judgement', |
|
|
|
targetScore: '10.0', |
|
|
|
targetScore: '10.0', |
|
|
|
shrink: false, |
|
|
|
shrink: false, |
|
|
|
|
|
|
|
checkAll: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
@ -281,6 +300,7 @@ export default { |
|
|
|
questionType: 'fill_blank', |
|
|
|
questionType: 'fill_blank', |
|
|
|
targetScore: '15.0', |
|
|
|
targetScore: '15.0', |
|
|
|
shrink: false, |
|
|
|
shrink: false, |
|
|
|
|
|
|
|
checkAll: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
examQuestions: [], |
|
|
|
examQuestions: [], |
|
|
@ -289,6 +309,7 @@ export default { |
|
|
|
questionType: 'essay', |
|
|
|
questionType: 'essay', |
|
|
|
targetScore: '40.0', |
|
|
|
targetScore: '40.0', |
|
|
|
shrink: false, |
|
|
|
shrink: false, |
|
|
|
|
|
|
|
checkAll: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
@ -299,6 +320,9 @@ export default { |
|
|
|
particularYear: [ |
|
|
|
particularYear: [ |
|
|
|
{ required: true, message: '请选择年份', trigger: 'change' } |
|
|
|
{ required: true, message: '请选择年份', trigger: 'change' } |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
classificationId: [ |
|
|
|
|
|
|
|
{ required: true, message: '请选择所属试卷分类', trigger: 'change' } |
|
|
|
|
|
|
|
], |
|
|
|
paperType: [ |
|
|
|
paperType: [ |
|
|
|
{ required: true, message: '请选择建议用途', trigger: 'change' } |
|
|
|
{ required: true, message: '请选择建议用途', trigger: 'change' } |
|
|
|
], |
|
|
|
], |
|
|
@ -371,6 +395,7 @@ export default { |
|
|
|
const paper = r.paperOutline |
|
|
|
const paper = r.paperOutline |
|
|
|
paper.map(e => { |
|
|
|
paper.map(e => { |
|
|
|
e.shrink = false |
|
|
|
e.shrink = false |
|
|
|
|
|
|
|
e.checkAll = false |
|
|
|
e.examQuestions.map((n, j) => { |
|
|
|
e.examQuestions.map((n, j) => { |
|
|
|
n.originSort = j + 1 |
|
|
|
n.originSort = j + 1 |
|
|
|
Object.assign(n, n.question) |
|
|
|
Object.assign(n, n.question) |
|
|
@ -437,6 +462,7 @@ export default { |
|
|
|
questionType: '', |
|
|
|
questionType: '', |
|
|
|
targetScore: '', |
|
|
|
targetScore: '', |
|
|
|
shrink: false, |
|
|
|
shrink: false, |
|
|
|
|
|
|
|
checkAll: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 试卷大纲移除行 |
|
|
|
// 试卷大纲移除行 |
|
|
@ -569,26 +595,32 @@ export default { |
|
|
|
// 处理题干显示 |
|
|
|
// 处理题干显示 |
|
|
|
getQuesStem (ques) { |
|
|
|
getQuesStem (ques) { |
|
|
|
let { stem } = ques |
|
|
|
let { stem } = ques |
|
|
|
if (ques.questionType === 'fill_blank') { // 填空题 |
|
|
|
try { |
|
|
|
let { jsonText } = ques |
|
|
|
if (ques.questionType === 'fill_blank') { // 填空题 |
|
|
|
if (jsonText) jsonText = JSON.parse(jsonText) |
|
|
|
let { jsonText } = ques |
|
|
|
|
|
|
|
if (jsonText) { |
|
|
|
const regex = /<span class="gapfilling-span" data-id="(.*?)">______<\/span>/g |
|
|
|
jsonText = JSON.parse(jsonText) |
|
|
|
let match |
|
|
|
const scores = jsonText.scores.map(e => { |
|
|
|
let index = 0 // 用于跟踪索引 |
|
|
|
return { |
|
|
|
let result = stem |
|
|
|
val: e |
|
|
|
|
|
|
|
} |
|
|
|
while ((match = regex.exec(stem)) !== null) { |
|
|
|
}) |
|
|
|
const newInput = `<input type="text" class="fill-input" placeholder="请输入分值" value="${jsonText && jsonText.scores ? jsonText.scores[index] : ''}">` |
|
|
|
console.log("🚀 ~ getQuesStem ~ ques.scores:", scores) |
|
|
|
result = result.replace(match[0], newInput) |
|
|
|
// this.$set(ques, 'fillScores', scores) |
|
|
|
index++ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return result |
|
|
|
} catch (e) { } |
|
|
|
} else { |
|
|
|
return stem |
|
|
|
return stem |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 填空题分数输入回调 |
|
|
|
|
|
|
|
fillScoreChange (ques) { |
|
|
|
|
|
|
|
let total = 0 |
|
|
|
|
|
|
|
ques.scores.map(e => { |
|
|
|
|
|
|
|
if (e.val && !isNaN(e.val)) total = Decimal(total).add(e.val).toNumber() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
ques.score = total |
|
|
|
|
|
|
|
}, |
|
|
|
// 编辑试题 |
|
|
|
// 编辑试题 |
|
|
|
toQues (item, i, ques) { |
|
|
|
toQues (item, i, ques) { |
|
|
|
this.curType = item |
|
|
|
this.curType = item |
|
|
@ -627,6 +659,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) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
item.checkAll = false |
|
|
|
this.calcDifficult() |
|
|
|
this.calcDifficult() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Util.warningMsg('请选择数据') |
|
|
|
Util.warningMsg('请选择数据') |
|
|
@ -661,6 +694,7 @@ export default { |
|
|
|
closeOnClickModal: false, |
|
|
|
closeOnClickModal: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
item.examQuestions.splice(i, 1) |
|
|
|
item.examQuestions.splice(i, 1) |
|
|
|
|
|
|
|
item.checkAll = false |
|
|
|
this.calcDifficult() |
|
|
|
this.calcDifficult() |
|
|
|
} catch (e) { } |
|
|
|
} catch (e) { } |
|
|
|
}, |
|
|
|
}, |
|
|
@ -713,6 +747,12 @@ export default { |
|
|
|
this.validForm(status) |
|
|
|
this.validForm(status) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$refs.form.validate(async (valid) => { |
|
|
|
this.$refs.form.validate(async (valid) => { |
|
|
|
|
|
|
|
const { form } = this |
|
|
|
|
|
|
|
if (form.name === '') return Util.warningMsg('请输入试卷名称') |
|
|
|
|
|
|
|
if (!form.particularYear) return Util.warningMsg('请选择年份') |
|
|
|
|
|
|
|
if (!form.classificationId.length) return Util.warningMsg('请选择所属试卷分类') |
|
|
|
|
|
|
|
if (form.paperType === '') return Util.warningMsg('请选择建议用途') |
|
|
|
|
|
|
|
if (form.suggestTime === '') return Util.warningMsg('请输入估计用时') |
|
|
|
if (valid) { |
|
|
|
if (valid) { |
|
|
|
this.validForm(status) |
|
|
|
this.validForm(status) |
|
|
|
} |
|
|
|
} |
|
|
@ -1081,14 +1121,15 @@ export default { |
|
|
|
align-items: center; |
|
|
|
align-items: center; |
|
|
|
|
|
|
|
|
|
|
|
.el-button { |
|
|
|
.el-button { |
|
|
|
margin-left: 20px; |
|
|
|
margin: 0 20px 0 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.sort { |
|
|
|
.input-wrap { |
|
|
|
display: inline-flex; |
|
|
|
display: inline-flex; |
|
|
|
align-items: center; |
|
|
|
align-items: center; |
|
|
|
font-size: 12px; |
|
|
|
font-size: 12px; |
|
|
|
|
|
|
|
white-space: nowrap; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|