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

试题管理

parent 280549fe
...@@ -17,8 +17,9 @@ ...@@ -17,8 +17,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-col :span="12">
<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-form-item label="选项A" ref="opta" prop="opta">
<el-input :readonly="readonly" v-model="form.opta"></el-input> </el-form-item> </el-col> <el-input :readonly="readonly" v-model="form.opta"></el-input> </el-form-item> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -38,12 +39,12 @@ ...@@ -38,12 +39,12 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <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-form-item label="选项E" ref="opte" prop="opte">
<el-input :readonly="readonly" v-model="form.opte"></el-input> <el-input :readonly="readonly" v-model="form.opte"></el-input>
</el-form-item> </el-form-item>
</el-col> </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-form-item label="选项F" ref="optf" prop="optf">
<el-input :readonly="readonly" v-model="form.optf"></el-input> <el-input :readonly="readonly" v-model="form.optf"></el-input>
</el-form-item> </el-form-item>
...@@ -65,11 +66,6 @@ ...@@ -65,11 +66,6 @@
<el-input type="textarea" :readonly="readonly" v-model="form.bz"></el-input> <el-input type="textarea" :readonly="readonly" v-model="form.bz"></el-input>
</el-form-item> </el-form-item>
</el-col> </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-row>
</el-form> </el-form>
</RelDialog> </RelDialog>
......
...@@ -5,12 +5,20 @@ ...@@ -5,12 +5,20 @@
<div class="search" v-condition> <div class="search" v-condition>
<SearchButton :app='app'></SearchButton> <SearchButton :app='app'></SearchButton>
<el-row :gutter="20" class="search-row-1"> <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"> <div class="search-item">
<span class="search-span">名称:</span> <span class="search-span">类型:</span>
<el-input v-model="queryParams.info"></el-input> <RelSelect filterable style="width: 100%;" clearable src='aqgl/pxgl/pxst/init/type'
:match="{value:'id',label:'name'}" v-model='queryParams.type'></RelSelect>
</div> </div>
</el-col> </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> </el-row>
</div> </div>
<!-- 按钮操作--> <!-- 按钮操作-->
...@@ -75,7 +83,8 @@ ...@@ -75,7 +83,8 @@
baseUrl: '/aqgl/pxgl/pxst', baseUrl: '/aqgl/pxgl/pxst',
/* 查询参数*/ /* 查询参数*/
queryParams: { queryParams: {
info: '' type: '',
xmid:''
}, },
/* 表格标题对应参数*/ /* 表格标题对应参数*/
tableTitle: [ tableTitle: [
......
<template> <template>
<div class="testpaper"> <div class="testpaper">
<!-- 批阅水印 --> <!-- 批阅水印 -->
<div class="readover"> <div class="readover" v-if='paperType!="T"&&paperState=="E"' >
<div class="yyj"> <div class="yyj">
已阅卷 已阅卷
</div> </div>
...@@ -9,8 +9,16 @@ ...@@ -9,8 +9,16 @@
100分 100分
</div> </div>
</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}} <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>
<div class="info"> <div class="info">
<div class="infoItem"> <div class="infoItem">
...@@ -26,9 +34,13 @@ ...@@ -26,9 +34,13 @@
<span>结束时间:{{$moment(endTime).format('YYYY-MM-DD HH:mm:ss ') }}</span> <span>结束时间:{{$moment(endTime).format('YYYY-MM-DD HH:mm:ss ') }}</span>
</div> </div>
</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;"> <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>
</div> </div>
...@@ -47,35 +59,8 @@ ...@@ -47,35 +59,8 @@
export default{ export default{
created(){ created(){
this.id=this.$route.params.id 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=>{ this.apiTranswf()
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
})
})
}, },
mounted() { mounted() {
...@@ -86,6 +71,46 @@ ...@@ -86,6 +71,46 @@
Subject Subject
}, },
methods:{ 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(){ getRemain(){
let setNum=setTimeout(()=>{ let setNum=setTimeout(()=>{
let time=new Date().getTime() let time=new Date().getTime()
...@@ -96,9 +121,11 @@ ...@@ -96,9 +121,11 @@
} }
},1000) },1000)
}, },
gobac(){
this.$router.replace({path:'/train/onlinExamination'})
},
submit(){ submit(){
/* 路由调回去*/ /* 前端判断是否填写*/
this.subjectList.forEach((item,index)=>{ this.subjectList.forEach((item,index)=>{
if(item.value&&item.value.length>0){ if(item.value&&item.value.length>0){
...@@ -107,12 +134,48 @@ ...@@ -107,12 +134,48 @@
throw new Error(`第${index+1}题未作答`) 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('是否提交试卷, 是否继续?', '提示', { this.$confirm('是否提交试卷, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
/* 练习时*/
console.log(this.subjectList)
if(this.paperType=='T'&&this.paperState=='B'){
this.paperState='E'
}
return
this.$success('提交成功,您可以在考试记录中查看分数') this.$success('提交成功,您可以在考试记录中查看分数')
this.$router.replace({path:'/train/onlinExamination'}) this.$router.replace({path:'/train/onlinExamination'})
}).catch(() => { }).catch(() => {
...@@ -122,6 +185,9 @@ ...@@ -122,6 +185,9 @@
}, },
data(){ data(){
return{ return{
/* 考试or测试*/
paperType:'T',
paperState:'B',
id:'', id:'',
startTime:new Date().getTime(), startTime:new Date().getTime(),
endTime:new Date().getTime()+1000*120*60, endTime:new Date().getTime()+1000*120*60,
...@@ -161,7 +227,6 @@ ...@@ -161,7 +227,6 @@
width: 100%; width: 100%;
text-align: center; text-align: center;
} }
} }
$f:flex; $f:flex;
$mini:800px; $mini:800px;
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
<!-- 单选--> <!-- 单选-->
<div v-if="type=='DXT'" class="options"> <div v-if="type=='DXT'" class="options">
<div class="item" :key="index" v-for="(item,index) in 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> </div>
<!-- 多选--> <!-- 多选-->
<div v-if="type=='DXTS'" class="options"> <div v-if="type=='DXTS'" class="options">
<div class="item" :key="index" v-for="(item,index) in 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 :label="index">{{`${index}.${item}`}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
...@@ -31,19 +31,20 @@ ...@@ -31,19 +31,20 @@
<!-- 判断题 --> <!-- 判断题 -->
<div v-if="type=='PDT'" class="options"> <div v-if="type=='PDT'" class="options">
<div class="item" :key="index" v-for="(item,index) in 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> </div>
<!-- 答案显示--> <!-- 答案显示-->
<div class="ans"> <div class="ans" v-if='app.paperState=="E"' >
<hr>
<br> <br>
<span>结果:<span class="error">错误</span></span> <span>结果:<span :class="allItem.result">{{allItem.resultName}}</span></span>
<br> <br>
<span>本题答案是:<span class="dajx" >A,B,C</span></span> <span>本题答案是:<span class="dajx" >{{allItem.ans}}</span></span>
<br> <br>
<span>您的答案是:<span class="dajx" >A</span></span> <span>您的答案是:<span class="dajx" >{{allItem.value}}</span></span>
<br> <br>
<span>答案解析:<span class="dajx">对于线性表(734552564462010)进行散列存储时,若选用HK=K %9作为散列函数,则散列地址为1的元素有()个。</span></span> <span>答案解析:<span class="dajx">{{allItem.desc}}</span></span>
</div> </div>
</div> </div>
...@@ -80,6 +81,12 @@ ...@@ -80,6 +81,12 @@
}) })
}, },
props: { props: {
allItem:{
type: Object,
default: () => {
return {}
}
},
app: { app: {
type: Object, type: Object,
default: () => { 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