yujialong 3 months ago
parent 05840159d0
commit 66f11fef31
  1. 8
      src/layouts/navbar/index.vue
  2. 24
      src/pages/ques/detail/index.vue
  3. 2
      src/pages/ques/list/index.vue
  4. 2
      src/pages/quesBank/index.vue
  5. 2
      src/pages/quesBankType/index.vue
  6. 20
      src/pages/testPaper/detail/auto.vue
  7. 95
      src/pages/testPaper/detail/index.vue
  8. 6
      src/pages/testPaper/detail/manual.vue
  9. 6
      src/pages/testPaper/detail/template.vue
  10. 4
      src/pages/testPaper/list/index.vue
  11. 2
      src/pages/testPaperLibrary/index.vue
  12. 2
      src/pages/testPaperLibraryType/index.vue
  13. 4
      src/router/permission.js
  14. 25
      src/styles/common.scss

@ -5,8 +5,8 @@
<img width="30" src="@/assets/images/logo.png" alt="">
<span>理论考试系统</span>
</div>
<el-menu :default-active="active" :default-openeds="['user']" background-color="#001529" text-color="#fff"
active-text-color="#fff" :collapse-transition="false" @select="menuSelect">
<el-menu :default-active="active" :default-openeds="['ques', 'testPaper']" background-color="#001529"
text-color="#fff" active-text-color="#fff" :collapse-transition="false" @select="menuSelect">
<template v-for="item in menus">
<template v-if="item.subs">
<el-submenu :index="item.index" :key="item.index">
@ -54,7 +54,7 @@ export default {
// },
{
icon: 'user',
index: 'user',
index: 'ques',
title: '题库管理',
subs: [
{
@ -69,7 +69,7 @@ export default {
},
{
icon: 'annex',
index: '/annex/list',
index: 'testPaper',
title: '试卷管理',
subs: [
{

@ -276,6 +276,7 @@ export default {
templateVisible: false,
submiting: false,
tempForm: {},
beforeSubmitForm: {},
keep: 0,
repeatVisible: false,
@ -321,9 +322,8 @@ export default {
},
methods: {
//
init () {
init (v) {
this.form = _.cloneDeep(this.originForm)
this.handleSingleMultiple()
const type = this.detailType
//
@ -338,6 +338,19 @@ export default {
answerAnalysis && answerAnalysis.instance && answerAnalysis.setText('')
this.answerAnalysis = ''
//
if (v) {
const { form } = this
form.difficulty = v.difficulty
form.givenYear = v.givenYear
form.knowledgePointIds = this.beforeSubmitForm.knowledgePointIds
form.questionType = v.questionType
form.specialtyIds = v.specialtyIds
this.questionTypeChange(v.questionType)
} else {
this.handleSingleMultiple()
}
this.getDetail()
this.getKnowledge()
this.getProfessional()
@ -581,6 +594,10 @@ export default {
submit (keep) {
if (this.submiting) return false
this.$refs.form.validate(async (valid) => {
const { form } = this
if (!form.knowledgePointIds.length) return Util.warningMsg('请选择知识点')
if (!form.difficulty) return Util.warningMsg('请选择难度')
if (valid) {
const form = _.cloneDeep(this.form)
const stem = this.$refs.stem.getUEContent()
@ -604,6 +621,7 @@ export default {
this.submiting = true
try {
this.beforeSubmitForm = _.cloneDeep(form)
form.stem = stem
form.questionBankId = this.questionBankId
form.knowledgePointIds = form.knowledgePointIds.map(e => {
@ -671,7 +689,7 @@ export default {
type === 4 && this.$emit('updateQues', this.tempForm, res.questionVersionId)
Util.successMsg('保存成功')
!form.questionId && this.keep ? '' : this.back()
!form.questionId && this.keep ? this.init(form) : this.back()
this.repeatVisible = false
} finally {
this.submiting = false

@ -119,7 +119,7 @@
<el-table-column prop="lastEditor" label="最近编辑人" align="center" width="90"></el-table-column>
<el-table-column prop="referenceCount" label="已引用试卷(套)" align="center" width="130"
sortable="custom"></el-table-column>
<el-table-column label="操作" align="center" width="300">
<el-table-column label="操作" align="center" width="300" fixed="right">
<template slot-scope="scope">
<el-button type="text" @click="toDetail(scope.row, 1)">复制</el-button>
<el-button type="text" @click="toDetail(scope.row, 2)">查看</el-button>

@ -64,7 +64,7 @@
<el-button type="text" @click="edit(scope.row, 1)">复制</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button>
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px"
:active-text="scope.row.status ? '开' : '关'"
:active-text="scope.row.status ? '启用' : '禁用'"
@change="switchOff($event, scope.row, scope.$index)"></el-switch>
</template>
</el-table-column>

@ -34,7 +34,7 @@
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button>
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px"
:active-text="scope.row.status ? '开' : '关'" @change="switchOff($event, scope.row)"></el-switch>
:active-text="scope.row.status ? '启用' : '禁用'" @change="switchOff($event, scope.row)"></el-switch>
</template>
</el-table-column>
</el-table>

@ -6,12 +6,30 @@
<h6 class="page-name">难度设置</h6>
<div class="tool">
<ul class="filter">
<li>
<li style="margin-right: 10px">
<label>试卷难度</label>
<el-select v-model="difficult" placeholder="请选择试卷难度" @change="difficultChange">
<el-option v-for="(item, i) in difficults" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
<el-tooltip placement="top">
<div class="diff-text" slot="content">
<p>基础题难度系数0.2</p>
<p>普通题难度系数0.4</p>
<p>较难题难度系数0.6</p>
<p>困难题难度系数0.8</p>
<p>1<span class="em">题型难度系数</span>=对应题型所有试题的难度系数之和/总试题数</p>
<p>2<span class="em">试卷总难度系数</span>=所有试题的难度系数之和/总试题数</p>
<p>3<span class="em">难度系数评价</span></p>
<div class="coe">
<p>简单系数 &lt;=0.3</p>
<p>普通0.3&lt;系数&lt;=0.4</p>
<p>较难0.4&lt;系数&lt;0.5</p>
<p>困难:系数&gt;=0.5</p>
</div>
</div>
<i class="el-icon-question" style="font-size: 16px;color: #8f8f8f;cursor: pointer;"></i>
</el-tooltip>
</ul>
</div>

@ -12,9 +12,9 @@
value-format="yyyy">
</el-date-picker>
</el-form-item>
<el-form-item required label="所属试卷分类">
<el-cascader placeholder="请选择所属试卷分类" :options="types" v-model="form.classificationId" :props="cascaderProps"
clearable style="width: 100%">
<el-form-item prop="classificationId" label="所属试卷分类">
<el-cascader filterable placeholder="请选择所属试卷分类" :options="types" v-model="form.classificationId"
:props="cascaderProps" clearable style="width: 100%">
</el-cascader>
</el-form-item>
</div>
@ -32,7 +32,7 @@
</div>
<div class="item-line">
<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"
:value="item.professionalId" filter></el-option>
</el-select>
@ -128,6 +128,8 @@
</div>
</div>
<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 }]">
<draggable v-model="item.examQuestions" :group="dragGroup" chosenClass="chosen" animation="1000"
@ -144,8 +146,6 @@
</div>
<div class="stem" :id="'stem' + ques.questionVersionId" v-html="getQuesStem(ques)"></div>
</div>
<p v-if="item.questionType !== 'fill_blank'"><el-input class="l-input" placeholder="请输入分值"
v-model="ques.score" /></p>
</div>
<!-- 单选多选判断的选项 -->
@ -163,15 +163,31 @@
<div v-html="getCorrectAnswer(ques)"></div>
</div>
<div class="actions">
<div class="sort">
<span>排序</span>
<el-input class="l-input sort-input" v-model="ques.serialNumber"
@change="sortChange(item, ques)" />
<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)" />&emsp;填空项{{ k + 1 }}
</div>
</div>
<el-button type="text" @click="toQues(item, j, ques)">编辑试题</el-button>
<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>
<el-input class="l-input sort-input" v-model="ques.serialNumber"
@change="sortChange(item, ques)" />
</div>
</div>
</div>
</div>
@ -257,6 +273,7 @@ export default {
questionType: 'single_choice',
targetScore: '20.0',
shrink: false,
checkAll: false,
},
{
examQuestions: [],
@ -265,6 +282,7 @@ export default {
questionType: 'multiple_choice',
targetScore: '15.0',
shrink: false,
checkAll: false,
},
{
examQuestions: [],
@ -273,6 +291,7 @@ export default {
questionType: 'judgement',
targetScore: '10.0',
shrink: false,
checkAll: false,
},
{
examQuestions: [],
@ -281,6 +300,7 @@ export default {
questionType: 'fill_blank',
targetScore: '15.0',
shrink: false,
checkAll: false,
},
{
examQuestions: [],
@ -289,6 +309,7 @@ export default {
questionType: 'essay',
targetScore: '40.0',
shrink: false,
checkAll: false,
},
],
},
@ -299,6 +320,9 @@ export default {
particularYear: [
{ required: true, message: '请选择年份', trigger: 'change' }
],
classificationId: [
{ required: true, message: '请选择所属试卷分类', trigger: 'change' }
],
paperType: [
{ required: true, message: '请选择建议用途', trigger: 'change' }
],
@ -371,6 +395,7 @@ export default {
const paper = r.paperOutline
paper.map(e => {
e.shrink = false
e.checkAll = false
e.examQuestions.map((n, j) => {
n.originSort = j + 1
Object.assign(n, n.question)
@ -437,6 +462,7 @@ export default {
questionType: '',
targetScore: '',
shrink: false,
checkAll: false,
})
},
//
@ -569,26 +595,32 @@ export default {
//
getQuesStem (ques) {
let { stem } = ques
try {
if (ques.questionType === 'fill_blank') { //
let { jsonText } = ques
if (jsonText) jsonText = JSON.parse(jsonText)
const regex = /<span class="gapfilling-span" data-id="(.*?)">______<\/span>/g
let match
let index = 0 //
let result = stem
while ((match = regex.exec(stem)) !== null) {
const newInput = `<input type="text" class="fill-input" placeholder="请输入分值" value="${jsonText && jsonText.scores ? jsonText.scores[index] : ''}">`
result = result.replace(match[0], newInput)
index++
if (jsonText) {
jsonText = JSON.parse(jsonText)
const scores = jsonText.scores.map(e => {
return {
val: e
}
})
console.log("🚀 ~ getQuesStem ~ ques.scores:", scores)
// this.$set(ques, 'fillScores', scores)
}
return result
} else {
return stem
}
} catch (e) { }
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) {
this.curType = item
@ -627,6 +659,7 @@ export default {
const cur = item.examQuestions.findIndex(n => n.questionVersionId === e.questionVersionId)
cur >= 0 && item.examQuestions.splice(cur, 1)
})
item.checkAll = false
this.calcDifficult()
} else {
Util.warningMsg('请选择数据')
@ -661,6 +694,7 @@ export default {
closeOnClickModal: false,
})
item.examQuestions.splice(i, 1)
item.checkAll = false
this.calcDifficult()
} catch (e) { }
},
@ -713,6 +747,12 @@ export default {
this.validForm(status)
} else {
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) {
this.validForm(status)
}
@ -1081,14 +1121,15 @@ export default {
align-items: center;
.el-button {
margin-left: 20px;
margin: 0 20px 0 0;
}
}
.sort {
.input-wrap {
display: inline-flex;
align-items: center;
font-size: 12px;
white-space: nowrap;
}
}

@ -185,7 +185,9 @@ export default {
computed: {
// +
checkedLen () {
return this.curCheckQues.length + this.checked.length
let len = this.curCheckQues.length + this.checked.length
if (this.$parent.curQues) len -= 1
return len
},
// name
questionTypeName () {
@ -432,7 +434,7 @@ export default {
if (!checked.length) return Util.warningMsg('请选择试题')
const { curType, curQuesIndex, curQues } = this.$parent
if (!curQues && this.checkedLen > +curType.questionNum) return Util.warningMsg(`目标题数为${curType.questionNum},已选题数不得大于目标题数`)
if (this.checkedLen > +curType.questionNum) return Util.warningMsg(`目标题数为${curType.questionNum},已选题数不得大于目标题数`)
try {
checked.map((e, i) => {

@ -239,7 +239,11 @@ export default {
// 使
async useTemplate (row) {
const data = await this.getDetail(row.templateId)
data.paperOutline.map(e => e.examQuestions = [])
data.paperOutline.map(e => {
e.shrink = false
e.checkAll = false
e.examQuestions = []
})
this.$parent.form.paperOutline = data.paperOutline
this.listVisible = false
},

@ -147,14 +147,14 @@
<el-table-column prop="updateTime" label="最近编辑时间" align="center" width="160"
sortable="custom"></el-table-column>
<el-table-column prop="createUser" label="最近编辑人" align="center" width="90"></el-table-column>
<el-table-column label="操作" align="center" width="240">
<el-table-column label="操作" align="center" width="250" fixed="right">
<template slot-scope="scope">
<el-button type="text" @click="toDetail(scope.row, 1)">复制</el-button>
<el-button type="text" @click="preview(scope.row)">预览</el-button>
<el-button type="text" @click="toDetail(scope.row)">编辑</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button>
<el-switch v-if="!scope.row.status" v-model="scope.row.isDisable" :active-value="false"
:inactive-value="true" style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '关' : '开'"
:inactive-value="true" style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '禁用' : '启用'"
@change="switchOff($event, scope.row, scope.$index)"></el-switch>
</template>
</el-table-column>

@ -66,7 +66,7 @@
<el-button type="text" @click="edit(scope.row, 1)">复制</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button>
<el-switch v-model="scope.row.isDisable" :active-value="false" :inactive-value="true"
style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '关' : '开'"
style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '禁用' : '启用'"
@change="switchOff($event, scope.row)"></el-switch>
</template>
</el-table-column>

@ -34,7 +34,7 @@
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button>
<el-switch v-model="scope.row.isDisable" :active-value="false" :inactive-value="true"
style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '关' : '开'"
style="margin: 0 10px 0 5px" :active-text="scope.row.isDisable ? '禁用' : '启用'"
@change="switchOff($event, scope.row)"></el-switch>
</template>
</el-table-column>

@ -4,6 +4,6 @@ import util from '@/libs/util'
router.beforeEach((to, from, next) => {
document.title = Setting.titleSuffix
localStorage.setItem('examPath', to.fullPath)
next()
});
localStorage.setItem('examPath', router.resolve(to.fullPath).href)
})

@ -438,3 +438,28 @@
text-align: center;
color: #a3a3a3;
}
.fill-scores {
.fill-title {
margin-bottom: 10px;
font-size: 13px;
}
.input-wrap {
display: flex;
align-items: center;
font-size: 12px;
white-space: nowrap;
&:not(:last-child) {
margin-bottom: 10px;
}
}
.l-input {
width: 100px;
margin-right: 10px;
.el-input__inner {
height: 28px;
line-height: 28px;
}
}
}
Loading…
Cancel
Save