diff --git a/src/api/modules/paper.js b/src/api/modules/paper.js
index 5ed38974..312f83ff 100644
--- a/src/api/modules/paper.js
+++ b/src/api/modules/paper.js
@@ -72,6 +72,9 @@ const querypaper = function(data) {
const getPaperContent = function(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 {
detail,
update,
@@ -80,6 +83,7 @@ export default {
querylist,
querypaper,
getPaperContent,
+ newPaperContent,
batchImportCount,
batchImportData
}
diff --git a/src/components/Course/courseExam.vue b/src/components/Course/courseExam.vue
index e43cebeb..22c0d9a4 100644
--- a/src/components/Course/courseExam.vue
+++ b/src/components/Course/courseExam.vue
@@ -85,6 +85,28 @@
+
+
+
+ 是
+ 否
+
+
+
+
+
+ 先添加试题
+ 试卷有 {{examPaper.items.length}} 道试题
+
+
+
+
+
+ 先选择试卷
+ 试卷有 {{usePaper.counts}} 道试题
+
+
+
@@ -285,7 +307,9 @@
return;
}
}
-
+ if(!this.examInfo.randomMode){
+ this.examInfo.qnum = 0
+ }
this.$emit("save",this.examInfo);
},
deleteExam(){ //删除
@@ -294,6 +318,8 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
+ this.examInfo.randomMode = false;
+ this.examInfo.qnum = 0;
this.$emit("remove",this.examInfo);
}).catch(() => {
diff --git a/src/components/Course/exam.vue b/src/components/Course/exam.vue
index a6e9f251..3084be7d 100644
--- a/src/components/Course/exam.vue
+++ b/src/components/Course/exam.vue
@@ -326,12 +326,11 @@ export default {
return qitems;
},
startTest(){
- 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);
+ apiExamPaper.newPaperContent(this.info.id).then(res=>{
+ if(res.error == ''&&res.result != ''){
+ if(this.info.paperType==2){
+ this.examPaper.json=res.result;
+ let qitems=this.convertToItems(this.examPaper.json);
this.paper ={items:qitems};
this.total=qitems.length;
this.curItem=qitems[this.curIndex];
@@ -340,34 +339,74 @@ export default {
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);
+ let paper= {items:res.result};
+ paper.items.forEach(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;
- this.curItem=paper.items[this.curIndex];
- this.startTime=new Date();//记录开始时间
- this.timerValue=this.info.testDuration;
- this.timer=setInterval(this.changeTimer,60000);
- this.testStart=true;
- }
+ this.curItem=paper.items[this.curIndex];
+ this.startTime=new Date();//记录开始时间
+ this.timerValue=this.info.testDuration;
+ this.timer=setInterval(this.changeTimer,60000);
+ 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){
if(this.curItem.type==101 || this.curItem.type==103){
diff --git a/src/components/Course/weikeContent.vue b/src/components/Course/weikeContent.vue
index f8310736..168aa565 100644
--- a/src/components/Course/weikeContent.vue
+++ b/src/components/Course/weikeContent.vue
@@ -401,6 +401,28 @@
+
+
+
+ 是
+ 否
+
+
+
+
+
+ 先添加试题
+ 试卷有 {{exam.paperJson.items.length}} 道试题
+
+
+
+
+
+ 先选择试卷
+ 试卷有 {{usePaper.counts}} 道试题
+
+
+
@@ -1059,12 +1081,14 @@
if(this.exam.info.paperType==2){
if(!this.exam.info.paperId){
this.$message.error("您还未选择任何试卷");
+ this.loading=false;
return;
}
}else{
//检查是不是所有的试题都有了答案
if(this.exam.paperJson.items.length==0){
this.$message.error("您还没有添加考试的试题");
+ this.loading=false;
return;
}
let pass=true;
@@ -1087,6 +1111,9 @@
}
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.content.contentName='考试';
this.examChange = deepClone(this.exam);
@@ -1152,6 +1179,8 @@
postData.id=this.exam.content.id;
postData.ctype=this.exam.content.contentType;
curContent=this.exam.content;
+ this.exam.info.randomMode = false;
+ this.exam.info.qnum = 0
}else if(index==4){
postData.id=this.assess.content.id;
postData.ctype=this.assess.content.contentType;