Commit 059dafaa authored by 李苏's avatar 李苏 💬

试题管理

parent 280549fe
......@@ -17,8 +17,9 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20"> <el-col :span="12">
</el-row>
<el-row :gutter="20" v-show="this.form.type=='S'||this.form.type=='M'" > <el-col :span="12">
<el-form-item label="选项A" ref="opta" prop="opta">
<el-input :readonly="readonly" v-model="form.opta"></el-input> </el-form-item> </el-col>
<el-col :span="12">
......@@ -38,12 +39,12 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="12" v-show="this.form.type=='M'" >
<el-form-item label="选项E" ref="opte" prop="opte">
<el-input :readonly="readonly" v-model="form.opte"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="12" v-show="this.form.type=='M'" >
<el-form-item label="选项F" ref="optf" prop="optf">
<el-input :readonly="readonly" v-model="form.optf"></el-input>
</el-form-item>
......@@ -65,11 +66,6 @@
<el-input type="textarea" :readonly="readonly" v-model="form.bz"></el-input>
</el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-form-item label="系统版本" ref="sysversion" prop="sysversion">
<el-input :readonly="readonly" v-model="form.sysversion" ></el-input>
</el-form-item>
</el-col> -->
</el-row>
</el-form>
</RelDialog>
......
......@@ -5,12 +5,20 @@
<div class="search" v-condition>
<SearchButton :app='app'></SearchButton>
<el-row :gutter="20" class="search-row-1">
<el-col :span="12" class="search-col">
<el-col :span="6" class="search-col">
<div class="search-item">
<span class="search-span">名称:</span>
<el-input v-model="queryParams.info"></el-input>
<span class="search-span">类型:</span>
<RelSelect filterable style="width: 100%;" clearable src='aqgl/pxgl/pxst/init/type'
:match="{value:'id',label:'name'}" v-model='queryParams.type'></RelSelect>
</div>
</el-col>
<el-col :span="6" class="search-col">
<div class="search-item">
<span class="search-span">题库:</span>
<RelSelect filterable style="width: 100%;" clearable src='aqgl/pxgl/pxxm/query'
:match="{value:'id',label:'name'}" v-model='queryParams.xmid'></RelSelect>
</div>
</el-col>
</el-row>
</div>
<!-- 按钮操作-->
......@@ -75,7 +83,8 @@
baseUrl: '/aqgl/pxgl/pxst',
/* 查询参数*/
queryParams: {
info: ''
type: '',
xmid:''
},
/* 表格标题对应参数*/
tableTitle: [
......
<template>
<div class="testpaper">
<!-- 批阅水印 -->
<div class="readover">
<div class="readover" v-if='paperType!="T"&&paperState=="E"' >
<div class="yyj">
已阅卷
</div>
......@@ -9,8 +9,16 @@
100分
</div>
</div>
<div class="readover" style="color:red;" v-if='paperType=="T"&&paperState=="E"' >
<div class="yyj">
训练题测试
</div>
<div class="df">
训练结果:{{rightNum}}/{{subjectList.length}}
</div>
</div>
<div ref="title" class="title">{{title+id}}
<span style="position: absolute;right: 36px;;font-size: 13px;font-weight: 300;">{{`剩余时间:${parseInt(remaining/(60*1000))}分钟${parseInt((remaining%(60*1000))/1000)}秒`}}</span>
<span v-if='paperState=="B"&&paperType!="T"' style="position: absolute;right: 36px;;font-size: 13px;font-weight: 300;">{{`剩余时间:${parseInt(remaining/(60*1000))}分钟${parseInt((remaining%(60*1000))/1000)}秒`}}</span>
</div>
<div class="info">
<div class="infoItem">
......@@ -26,9 +34,13 @@
<span>结束时间:{{$moment(endTime).format('YYYY-MM-DD HH:mm:ss ') }}</span>
</div>
</div>
<Subject :app='that' v-for='(item,index) in subjectList' :key="index" :index='index+1' :subject='item.subject' :score='item.score' :type='item.type' :options='item.options' ></Subject>
<Subject :app='that' v-for='(item,index) in subjectList' :allItem='item' :key="index" :index='index+1' :subject='item.subject' :score='item.score' :type='item.type' :options='item.options' ></Subject>
<div style="height: 200px;padding-top: 120px;">
<el-button @click="submit" size="mini" type="primary" style="float: right;width: 100px;">提交</el-button>
<el-button v-if="paperState=='B'" @click="submit" size="mini" type="primary" style="float: right;width: 100px;">提交</el-button>
<!-- 练习模式按钮-->
<el-button v-if="paperType=='T'&&paperState=='E'" @click="contlx" size="mini" type="primary" style="float: right;width: 100px;margin-left: 60px;">继续练习</el-button>
<el-button v-if="paperType=='T'&&paperState=='E'" @click="gobac" size="mini" type="primary" style="float: right;width: 100px;">返回</el-button>
</div>
</div>
......@@ -47,35 +59,8 @@
export default{
created(){
this.id=this.$route.params.id
let type={
'S':'DXT',
'F':'TKT',
'J':'PDT',
'M':'DXTS'
}
doQuery().then(res=>{
let oList=res.data.records||[]
/* 构建subjectList*/
this.subjectList=oList.map(item=>{
let newobj=Object.create({})
newobj.id=item.id
newobj.ans=item.ans
newobj.score=item.score||2
newobj.type=type[item.type]
newobj.subject=item.cont||'未设置问题'
newobj.options=Object.create({})
item['opta']&&(newobj.options.A=item.opta)
item['optb']&&(newobj.options.B=item.optb)
item['optc']&&(newobj.options.C=item.optc)
item['optd']&&(newobj.options.D=item.optd)
item['opte']&&(newobj.options.E=item.opte)
item['optf']&&(newobj.options.F=item.optf)
return newobj
})
})
this.apiTranswf()
},
mounted() {
......@@ -86,6 +71,46 @@
Subject
},
methods:{
apiTranswf(){
let type={
'S':'DXT',
'F':'TKT',
'J':'PDT',
'M':'DXTS'
}
doQuery().then(res=>{
this.subjectList=[]
let oList=res.data.records||[]
/* 构建subjectList*/
this.subjectList=oList.map(item=>{
let newobj=Object.create({})
newobj.desc=item.desc||'该题没有答案解析!'
newobj.id=item.id
newobj.ans=item.ans
newobj.score=item.score||2
newobj.type=type[item.type]
newobj.subject=item.cont||'未设置问题'
newobj.options=Object.create({})
item['opta']&&(newobj.options.A=item.opta)
item['optb']&&(newobj.options.B=item.optb)
item['optc']&&(newobj.options.C=item.optc)
item['optd']&&(newobj.options.D=item.optd)
item['opte']&&(newobj.options.E=item.opte)
item['optf']&&(newobj.options.F=item.optf)
return newobj
})
})
},
contlx(){
/* 当前为练习状态*/
/* 当前为开始状态*/
this.paperType='T'
this.paperState='B'
this.apiTranswf()
},
getRemain(){
let setNum=setTimeout(()=>{
let time=new Date().getTime()
......@@ -96,9 +121,11 @@
}
},1000)
},
gobac(){
this.$router.replace({path:'/train/onlinExamination'})
},
submit(){
/* 路由调回去*/
/* 前端判断是否填写*/
this.subjectList.forEach((item,index)=>{
if(item.value&&item.value.length>0){
......@@ -107,12 +134,48 @@
throw new Error(`第${index+1}题未作答`)
}
})
/* 前端判断答案对错*/
console.log( this.subjectList)
this.rightNum=0
this.subjectList.forEach((item,index)=>{
/* 其他*/
if(item.type!='TKT'){
if(item.ans==item.value){
item.result='right'
item.resultName='正确'
this.rightNum++
}else{
item.result='error'
item.resultName='错误'
}
}else{
let nans=item.ans.replace(/\s*/g,"")
let nvalue=item.value.replace(/\s*/g,"")
if(nans==nvalue){
item.result='right'
item.resultName='正确'
this.rightNum++
}else{
item.result='error'
item.resultName='错误'
}
/* 填空题*/
}
})
/* 提交试卷*/
this.$confirm('是否提交试卷, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
/* 练习时*/
console.log(this.subjectList)
if(this.paperType=='T'&&this.paperState=='B'){
this.paperState='E'
}
return
this.$success('提交成功,您可以在考试记录中查看分数')
this.$router.replace({path:'/train/onlinExamination'})
}).catch(() => {
......@@ -122,6 +185,9 @@
},
data(){
return{
/* 考试or测试*/
paperType:'T',
paperState:'B',
id:'',
startTime:new Date().getTime(),
endTime:new Date().getTime()+1000*120*60,
......@@ -161,7 +227,6 @@
width: 100%;
text-align: center;
}
}
$f:flex;
$mini:800px;
......
......@@ -17,13 +17,13 @@
<!-- 单选-->
<div v-if="type=='DXT'" class="options">
<div class="item" :key="index" v-for="(item,index) in options">
<el-radio v-model="value" :label="index"> {{`${index}.${item}`}}</el-radio>
<el-radio :disabled='allItem.result' v-model="value" :label="index"> {{`${index}.${item}`}}</el-radio>
</div>
</div>
<!-- 多选-->
<div v-if="type=='DXTS'" class="options">
<div class="item" :key="index" v-for="(item,index) in options">
<el-checkbox-group v-model="valueList">
<el-checkbox-group :disabled='allItem.result' v-model="valueList">
<el-checkbox :label="index">{{`${index}.${item}`}}</el-checkbox>
</el-checkbox-group>
</div>
......@@ -31,19 +31,20 @@
<!-- 判断题 -->
<div v-if="type=='PDT'" class="options">
<div class="item" :key="index" v-for="(item,index) in options">
<el-radio v-model="value" :label="index"> {{`${index}.${item}`}}</el-radio>
<el-radio :disabled='allItem.result' v-model="value" :label="index"> {{`${index}.${item}`}}</el-radio>
</div>
</div>
<!-- 答案显示-->
<div class="ans">
<div class="ans" v-if='app.paperState=="E"' >
<hr>
<br>
<span>结果:<span class="error">错误</span></span>
<span>结果:<span :class="allItem.result">{{allItem.resultName}}</span></span>
<br>
<span>本题答案是:<span class="dajx" >A,B,C</span></span>
<span>本题答案是:<span class="dajx" >{{allItem.ans}}</span></span>
<br>
<span>您的答案是:<span class="dajx" >A</span></span>
<span>您的答案是:<span class="dajx" >{{allItem.value}}</span></span>
<br>
<span>答案解析:<span class="dajx">对于线性表(734552564462010)进行散列存储时,若选用HK=K %9作为散列函数,则散列地址为1的元素有()个。</span></span>
<span>答案解析:<span class="dajx">{{allItem.desc}}</span></span>
</div>
</div>
......@@ -80,6 +81,12 @@
})
},
props: {
allItem:{
type: Object,
default: () => {
return {}
}
},
app: {
type: Object,
default: () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment