mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-14 05:16:43 +08:00
课程内考试,支持选择试卷
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
<div v-if="cware.content.contentRefId==''">
|
||||
<div style="padding-top: 0px;">
|
||||
<!-- <div> -->
|
||||
<choose-course-file ref="coursewarePanel" :resType="cware.content.contentType" @choose="chooseFile"></choose-course-file>
|
||||
<choose-course-file :orgId="course.orgId" :orgName="course.orgName" ref="coursewarePanel" :resType="cware.content.contentType" @choose="chooseFile"></choose-course-file>
|
||||
|
||||
<!-- <file-upload
|
||||
:fileType="getFileTypes(cware.content.contentType)"
|
||||
@@ -417,7 +417,11 @@
|
||||
</div>
|
||||
<div style="padding-top: 10px;">
|
||||
<el-form size="small" label-width="80px">
|
||||
<el-form-item label="考试时长">
|
||||
<el-form-item label="试卷类型">
|
||||
{{exam.info.paperType==1? '自定义试卷':'使用考试试卷: '+usePaper.paperName}}
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="考试时长">
|
||||
<el-col :span="6">{{exam.info.passScore}}分钟</el-col>
|
||||
<!-- <el-col :span="9">
|
||||
<el-form-item label="尝试次数">{{exam.info.times}}</el-form-item>
|
||||
@@ -890,7 +894,18 @@
|
||||
apiCourse.getExam(this.exam.content.id).then(res=>{
|
||||
if(res.status==200){
|
||||
this.exam.info=res.result;
|
||||
this.exam.paperJson=JSON.parse(res.result.paperContent);
|
||||
if(res.result.paperType==1){
|
||||
this.exam.paperJson=JSON.parse(res.result.paperContent);
|
||||
}else{
|
||||
apiExamPaper.detail(this.exam.info.paperId).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.usePaper.paperId=rs.result.id;
|
||||
this.usePaper.paperName=rs.result.testName;
|
||||
this.usePaper.counts=rs.result.counts;
|
||||
//this.usePaper.paperJson= rs.result.paperContent;
|
||||
}
|
||||
})
|
||||
}
|
||||
this.exam.show=9;
|
||||
this.examChange = deepClone(this.exam);
|
||||
}else if(res.status==404){
|
||||
@@ -1035,30 +1050,38 @@
|
||||
this.homeworkChange = deepClone(this.homework)
|
||||
}else if(index==3){
|
||||
postData.content=this.exam.content;
|
||||
//检查是不是所有的试题都有了答案
|
||||
if(this.exam.paperJson.items.length==0){
|
||||
this.$message.error("您还没有添加考试的试题");
|
||||
return;
|
||||
}
|
||||
let pass=true;
|
||||
this.exam.paperJson.items.forEach(qitem=>{
|
||||
if(qitem.options.length==0){
|
||||
pass=false;
|
||||
}else{
|
||||
let hasAnswer=qitem.options.some(opt=>{
|
||||
return opt.answer;
|
||||
});
|
||||
if(!hasAnswer){
|
||||
//console.log(this.exam,'this.exam');
|
||||
if(this.exam.info.paperType==2){
|
||||
if(!this.exam.info.paperId){
|
||||
this.$message.error("您还未选择任何试卷");
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
//检查是不是所有的试题都有了答案
|
||||
if(this.exam.paperJson.items.length==0){
|
||||
this.$message.error("您还没有添加考试的试题");
|
||||
return;
|
||||
}
|
||||
let pass=true;
|
||||
this.exam.paperJson.items.forEach(qitem=>{
|
||||
if(qitem.options.length==0){
|
||||
pass=false;
|
||||
}else{
|
||||
let hasAnswer=qitem.options.some(opt=>{
|
||||
return opt.answer;
|
||||
});
|
||||
if(!hasAnswer){
|
||||
pass=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if(!pass){
|
||||
this.$message.error("试卷试题请填写完整,每个试题必须要有答案");
|
||||
this.loading=false;
|
||||
return;
|
||||
});
|
||||
if(!pass){
|
||||
this.$message.error("试卷试题请填写完整,每个试题必须要有答案");
|
||||
this.loading=false;
|
||||
return;
|
||||
}
|
||||
this.exam.info.paperContent=JSON.stringify(this.exam.paperJson);
|
||||
}
|
||||
this.exam.info.paperContent=JSON.stringify(this.exam.paperJson);
|
||||
postData.exam=this.exam.info;
|
||||
this.examChange = deepClone(this.exam);
|
||||
}else if(index==4){
|
||||
@@ -1265,15 +1288,15 @@
|
||||
},
|
||||
openCusExam(){ //自定义考试
|
||||
this.exam.show=3;
|
||||
this.exam.paperType=1;
|
||||
this.exam.paperId='';
|
||||
this.exam.info.paperType=1;
|
||||
this.exam.info.paperId='';
|
||||
this.usePaper.pageIndex=1;
|
||||
this.usePaper.keyword="";
|
||||
},
|
||||
openChoosePaper(){
|
||||
this.exam.show=2;
|
||||
this.exam.paperType=3;
|
||||
this.exam.paperId='';
|
||||
this.exam.info.paperType=2; //选择试卷
|
||||
this.exam.info.paperId='';
|
||||
},
|
||||
findExamPapers(){ //查询已有的考试试卷
|
||||
this.usePaper.pageIndex=1;
|
||||
@@ -1319,6 +1342,7 @@
|
||||
if(rs.status==200){
|
||||
this.usePaper.paperId=rs.result.id;
|
||||
this.usePaper.paperName=rs.result.testName;
|
||||
this.usePaper.counts=rs.result.counts;
|
||||
//this.usePaper.paperJson= rs.result.paperContent;
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user