mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 02:46:44 +08:00
考试修改
This commit is contained in:
@@ -72,6 +72,9 @@ const querypaper = function(data) {
|
|||||||
const getPaperContent = function(id) {
|
const getPaperContent = function(id) {
|
||||||
return ajax.get('/xboe/m/exam/paper/paper-content?id=' + id);
|
return ajax.get('/xboe/m/exam/paper/paper-content?id=' + id);
|
||||||
}
|
}
|
||||||
|
const newPaperContent = function(id){
|
||||||
|
return ajax.get('/xboe/m/course/content/exam/paper-content?courseExamId='+id);
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
detail,
|
detail,
|
||||||
update,
|
update,
|
||||||
@@ -80,6 +83,7 @@ export default {
|
|||||||
querylist,
|
querylist,
|
||||||
querypaper,
|
querypaper,
|
||||||
getPaperContent,
|
getPaperContent,
|
||||||
|
newPaperContent,
|
||||||
batchImportCount,
|
batchImportCount,
|
||||||
batchImportData
|
batchImportData
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,28 @@
|
|||||||
<el-form-item label="考试说明">
|
<el-form-item label="考试说明">
|
||||||
<el-input type="textarea" show-word-limit v-model="examInfo.info" placeholder="关于考试的说明(限255字以内)" maxlength="255"></el-input>
|
<el-input type="textarea" show-word-limit v-model="examInfo.info" placeholder="关于考试的说明(限255字以内)" maxlength="255"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="随机模式">
|
||||||
|
<el-col :span="4">
|
||||||
|
<el-radio-group v-model="examInfo.randomMode">
|
||||||
|
<el-radio :label="true">是</el-radio>
|
||||||
|
<el-radio :label="false">否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="20" v-if="examInfo.randomMode&&examInfo.paperType==1">
|
||||||
|
<el-form-item label="数量">
|
||||||
|
<el-input-number v-model="examInfo.qnum" :min="1" :max="examPaper.items.length" label="数量"></el-input-number>
|
||||||
|
<span style="margin-left:10px;" v-if="examPaper.items.length==0">先添加试题</span>
|
||||||
|
<span style="margin-left:10px;" v-if="examPaper.items.length>0">试卷有 {{examPaper.items.length}} 道试题</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="20" v-if="examInfo.randomMode&&examInfo.paperType==2">
|
||||||
|
<el-form-item label="数量">
|
||||||
|
<el-input-number v-model="examInfo.qnum" :min="1" :max="usePaper.counts" label="数量"></el-input-number>
|
||||||
|
<span style="margin-left:10px;" v-if="usePaper.counts==0">先选择试卷</span>
|
||||||
|
<span style="margin-left:10px;" v-if="usePaper.counts>0">试卷有 {{usePaper.counts}} 道试题</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="examInfo.paperType==1">
|
<div v-if="examInfo.paperType==1">
|
||||||
@@ -285,7 +307,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!this.examInfo.randomMode){
|
||||||
|
this.examInfo.qnum = 0
|
||||||
|
}
|
||||||
this.$emit("save",this.examInfo);
|
this.$emit("save",this.examInfo);
|
||||||
},
|
},
|
||||||
deleteExam(){ //删除
|
deleteExam(){ //删除
|
||||||
@@ -294,6 +318,8 @@
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
this.examInfo.randomMode = false;
|
||||||
|
this.examInfo.qnum = 0;
|
||||||
this.$emit("remove",this.examInfo);
|
this.$emit("remove",this.examInfo);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|
||||||
|
|||||||
@@ -326,12 +326,11 @@ export default {
|
|||||||
return qitems;
|
return qitems;
|
||||||
},
|
},
|
||||||
startTest(){
|
startTest(){
|
||||||
if(this.info.paperType==2){
|
apiExamPaper.newPaperContent(this.info.id).then(res=>{
|
||||||
apiExamPaper.getPaperContent(this.info.paperId).then(rs=>{
|
if(res.status=200){
|
||||||
if(rs.status=200){
|
if(this.info.paperType==2){
|
||||||
this.examPaper.json=JSON.parse(rs.result);
|
this.examPaper.json=res.result;
|
||||||
//console.log(this.examPaper.json,'this.examPaper.json');
|
let qitems=this.convertToItems(this.examPaper.json);
|
||||||
let qitems=this.convertToItems(this.examPaper.json);
|
|
||||||
this.paper ={items:qitems};
|
this.paper ={items:qitems};
|
||||||
this.total=qitems.length;
|
this.total=qitems.length;
|
||||||
this.curItem=qitems[this.curIndex];
|
this.curItem=qitems[this.curIndex];
|
||||||
@@ -340,34 +339,74 @@ export default {
|
|||||||
this.timer=setInterval(this.changeTimer,60000);
|
this.timer=setInterval(this.changeTimer,60000);
|
||||||
this.testStart=true;
|
this.testStart=true;
|
||||||
}else{
|
}else{
|
||||||
this.$message.error('加载试卷内容失败,请与管理员联系,试卷是否已删除');
|
let paper= res.result;
|
||||||
}
|
paper.forEach(item=>{
|
||||||
})
|
if(item.type==101){
|
||||||
}else{
|
item.userAnswer='';
|
||||||
let paper= JSON.parse(this.info.paperContent);
|
}else if(item.type==102){
|
||||||
paper.items.forEach(item=>{
|
item.userAnswer=[];
|
||||||
//console.log(item);
|
}else{
|
||||||
if(item.type==101){
|
item.userAnswer=''
|
||||||
item.userAnswer='';
|
}
|
||||||
}else if(item.type==102){
|
item.options.forEach(opt=>{
|
||||||
item.userAnswer=[];
|
opt.checked=false;
|
||||||
}else{
|
})
|
||||||
item.userAnswer=''
|
});
|
||||||
}
|
this.total=paper.length;
|
||||||
item.options.forEach(opt=>{
|
this.paper =paper;
|
||||||
opt.checked=false;
|
|
||||||
})
|
|
||||||
});
|
|
||||||
this.total=paper.items.length;
|
|
||||||
this.paper =paper;
|
|
||||||
//console.log(this.paper);
|
|
||||||
|
|
||||||
this.curItem=paper.items[this.curIndex];
|
this.curItem=paper[this.curIndex];
|
||||||
this.startTime=new Date();//记录开始时间
|
this.startTime=new Date();//记录开始时间
|
||||||
this.timerValue=this.info.testDuration;
|
this.timerValue=this.info.testDuration;
|
||||||
this.timer=setInterval(this.changeTimer,60000);
|
this.timer=setInterval(this.changeTimer,60000);
|
||||||
this.testStart=true;
|
this.testStart=true;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
this.$message.error('加载试卷内容失败,请与管理员联系,试卷是否已删除');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// if(this.info.paperType==2){
|
||||||
|
// apiExamPaper.getPaperContent(this.info.paperId).then(rs=>{
|
||||||
|
// if(rs.status=200){
|
||||||
|
// this.examPaper.json=JSON.parse(rs.result);
|
||||||
|
// //console.log(this.examPaper.json,'this.examPaper.json');
|
||||||
|
// let qitems=this.convertToItems(this.examPaper.json);
|
||||||
|
// this.paper ={items:qitems};
|
||||||
|
// this.total=qitems.length;
|
||||||
|
// this.curItem=qitems[this.curIndex];
|
||||||
|
// this.startTime=new Date();//记录开始时间
|
||||||
|
// this.timerValue=this.info.testDuration;
|
||||||
|
// this.timer=setInterval(this.changeTimer,60000);
|
||||||
|
// this.testStart=true;
|
||||||
|
// }else{
|
||||||
|
// this.$message.error('加载试卷内容失败,请与管理员联系,试卷是否已删除');
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }else{
|
||||||
|
// let paper= JSON.parse(this.info.paperContent);
|
||||||
|
// paper.items.forEach(item=>{
|
||||||
|
// //console.log(item);
|
||||||
|
// if(item.type==101){
|
||||||
|
// item.userAnswer='';
|
||||||
|
// }else if(item.type==102){
|
||||||
|
// item.userAnswer=[];
|
||||||
|
// }else{
|
||||||
|
// item.userAnswer=''
|
||||||
|
// }
|
||||||
|
// item.options.forEach(opt=>{
|
||||||
|
// opt.checked=false;
|
||||||
|
// })
|
||||||
|
// });
|
||||||
|
// this.total=paper.items.length;
|
||||||
|
// this.paper =paper;
|
||||||
|
// //console.log(this.paper);
|
||||||
|
|
||||||
|
// this.curItem=paper.items[this.curIndex];
|
||||||
|
// this.startTime=new Date();//记录开始时间
|
||||||
|
// this.timerValue=this.info.testDuration;
|
||||||
|
// this.timer=setInterval(this.changeTimer,60000);
|
||||||
|
// this.testStart=true;
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
chooseOption(opt){
|
chooseOption(opt){
|
||||||
if(this.curItem.type==101 || this.curItem.type==103){
|
if(this.curItem.type==101 || this.curItem.type==103){
|
||||||
|
|||||||
@@ -401,6 +401,28 @@
|
|||||||
<el-form-item label="考试说明">
|
<el-form-item label="考试说明">
|
||||||
<el-input type="textarea" show-word-limit v-model="exam.info.info" placeholder="关于考试的说明(限255字以内)" maxlength="255"></el-input>
|
<el-input type="textarea" show-word-limit v-model="exam.info.info" placeholder="关于考试的说明(限255字以内)" maxlength="255"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="随机模式">
|
||||||
|
<el-col :span="4">
|
||||||
|
<el-radio-group v-model="exam.info.randomMode">
|
||||||
|
<el-radio :label="true">是</el-radio>
|
||||||
|
<el-radio :label="false">否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="20" v-if="exam.info.randomMode&&exam.info.paperType==1">
|
||||||
|
<el-form-item label="数量">
|
||||||
|
<el-input-number v-model="exam.info.qnum" :min="1" :max="exam.paperJson.items.length" label="数量"></el-input-number>
|
||||||
|
<span style="margin-left:10px;" v-if="exam.paperJson.items.length==0">先添加试题</span>
|
||||||
|
<span style="margin-left:10px;" v-if="exam.paperJson.items.length>0">试卷有 {{exam.paperJson.items.length}} 道试题</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="20" v-if="exam.info.randomMode&&exam.info.paperType==2">
|
||||||
|
<el-form-item label="数量">
|
||||||
|
<el-input-number v-model="exam.info.qnum" :min="1" :max="usePaper.counts" label="数量"></el-input-number>
|
||||||
|
<span style="margin-left:10px;" v-if="usePaper.counts==0">先选择试卷</span>
|
||||||
|
<span style="margin-left:10px;" v-if="usePaper.counts>0">试卷有 {{usePaper.counts}} 道试题</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="exam.info.paperType==1">
|
<div v-if="exam.info.paperType==1">
|
||||||
@@ -1059,12 +1081,14 @@
|
|||||||
if(this.exam.info.paperType==2){
|
if(this.exam.info.paperType==2){
|
||||||
if(!this.exam.info.paperId){
|
if(!this.exam.info.paperId){
|
||||||
this.$message.error("您还未选择任何试卷");
|
this.$message.error("您还未选择任何试卷");
|
||||||
|
this.loading=false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
//检查是不是所有的试题都有了答案
|
//检查是不是所有的试题都有了答案
|
||||||
if(this.exam.paperJson.items.length==0){
|
if(this.exam.paperJson.items.length==0){
|
||||||
this.$message.error("您还没有添加考试的试题");
|
this.$message.error("您还没有添加考试的试题");
|
||||||
|
this.loading=false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let pass=true;
|
let pass=true;
|
||||||
@@ -1087,6 +1111,9 @@
|
|||||||
}
|
}
|
||||||
this.exam.info.paperContent=JSON.stringify(this.exam.paperJson);
|
this.exam.info.paperContent=JSON.stringify(this.exam.paperJson);
|
||||||
}
|
}
|
||||||
|
if(!this.exam.info.randomMode){
|
||||||
|
this.exam.info.qnum = 0
|
||||||
|
}
|
||||||
postData.exam=this.exam.info;
|
postData.exam=this.exam.info;
|
||||||
postData.content.contentName='考试';
|
postData.content.contentName='考试';
|
||||||
this.examChange = deepClone(this.exam);
|
this.examChange = deepClone(this.exam);
|
||||||
@@ -1152,6 +1179,8 @@
|
|||||||
postData.id=this.exam.content.id;
|
postData.id=this.exam.content.id;
|
||||||
postData.ctype=this.exam.content.contentType;
|
postData.ctype=this.exam.content.contentType;
|
||||||
curContent=this.exam.content;
|
curContent=this.exam.content;
|
||||||
|
this.exam.info.randomMode = false;
|
||||||
|
this.exam.info.qnum = 0
|
||||||
}else if(index==4){
|
}else if(index==4){
|
||||||
postData.id=this.assess.content.id;
|
postData.id=this.assess.content.id;
|
||||||
postData.ctype=this.assess.content.contentType;
|
postData.ctype=this.assess.content.contentType;
|
||||||
|
|||||||
Reference in New Issue
Block a user