mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-10 19:36:47 +08:00
解决只有一道试题时,不能提交的问题
This commit is contained in:
@@ -249,6 +249,7 @@
|
|||||||
},
|
},
|
||||||
startTest() {
|
startTest() {
|
||||||
this.curTestAnswer = {};
|
this.curTestAnswer = {};
|
||||||
|
this.aloneExamAnswerId='';
|
||||||
this.curIndex=0;
|
this.curIndex=0;
|
||||||
// 先禁用,防止重复提交
|
// 先禁用,防止重复提交
|
||||||
if (this.testPaper.entranceTime && this.testPaper.entranceTime !== '') {
|
if (this.testPaper.entranceTime && this.testPaper.entranceTime !== '') {
|
||||||
@@ -299,9 +300,9 @@
|
|||||||
this.testStatus = 2;
|
this.testStatus = 2;
|
||||||
this.startReckon();
|
this.startReckon();
|
||||||
//60秒后执行保存处理,这里和pc端不一致,不做延迟,直接保存考试信息
|
//60秒后执行保存处理,这里和pc端不一致,不做延迟,直接保存考试信息
|
||||||
// window.setTimeout(function() {
|
//window.setTimeout(function() {
|
||||||
$this.saveUserTest();
|
//$this.saveUserTest();
|
||||||
// }, 10000);
|
//}, 10000);
|
||||||
} else {
|
} else {
|
||||||
this.startButton = false;
|
this.startButton = false;
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
@@ -314,6 +315,7 @@
|
|||||||
reStartTest(item){
|
reStartTest(item){
|
||||||
//直接提取,
|
//直接提取,
|
||||||
this.curTestAnswer = {};
|
this.curTestAnswer = {};
|
||||||
|
this.aloneExamAnswerId='';
|
||||||
this.curIndex=0;
|
this.curIndex=0;
|
||||||
apiTestPaper.getAnswerDetail(item.id).then(res => {
|
apiTestPaper.getAnswerDetail(item.id).then(res => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
@@ -368,6 +370,20 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
clearPagerJson(){
|
||||||
|
let paperJson = [];
|
||||||
|
this.paper.forEach((item,index) => {
|
||||||
|
let option = {
|
||||||
|
id:item.id,
|
||||||
|
optionList:[]
|
||||||
|
};
|
||||||
|
item.optionList.forEach(it=>{
|
||||||
|
option.optionList.push({id:it.id})
|
||||||
|
})
|
||||||
|
paperJson.push(option);
|
||||||
|
})
|
||||||
|
return JSON.stringify(paperJson);
|
||||||
|
},
|
||||||
saveUserTest() { //保存用户的考试,在点击开始考试1分钟后执行
|
saveUserTest() { //保存用户的考试,在点击开始考试1分钟后执行
|
||||||
if (this.handleSaveTest != null) {
|
if (this.handleSaveTest != null) {
|
||||||
window.clearTimeout(this.handleSaveTest);
|
window.clearTimeout(this.handleSaveTest);
|
||||||
@@ -385,7 +401,7 @@
|
|||||||
data.arrange = this.testPaper.arrange;
|
data.arrange = this.testPaper.arrange;
|
||||||
data.passLine = this.testPaper.passLine;
|
data.passLine = this.testPaper.passLine;
|
||||||
data.ucode = this.userInfo.userNo;
|
data.ucode = this.userInfo.userNo;
|
||||||
data.paperJson = JSON.stringify(this.paper);
|
data.paperJson = this.clearPagerJson();
|
||||||
data.answerJson = this.getAnswer();
|
data.answerJson = this.getAnswer();
|
||||||
//计算总分
|
//计算总分
|
||||||
let total = 0;
|
let total = 0;
|
||||||
@@ -419,11 +435,13 @@
|
|||||||
total+=item.defaultScore;
|
total+=item.defaultScore;
|
||||||
}
|
}
|
||||||
}else if (item.type == 1) {
|
}else if (item.type == 1) {
|
||||||
|
//console.log(item,item.defaultScore,'item.defaultScore')
|
||||||
item.optionList.forEach(opt => {
|
item.optionList.forEach(opt => {
|
||||||
if (opt.id == item.userAnswer && opt.isAnswer) {
|
if (opt.id == item.userAnswer && opt.isAnswer) {
|
||||||
total += item.defaultScore;
|
total += item.defaultScore;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
//console.log(total,'total')
|
||||||
}else if (item.type == 2) {
|
}else if (item.type == 2) {
|
||||||
let tempAnswer = [];
|
let tempAnswer = [];
|
||||||
item.optionList.forEach(opt => {
|
item.optionList.forEach(opt => {
|
||||||
@@ -470,9 +488,19 @@
|
|||||||
data.arrange = this.testPaper.arrange;
|
data.arrange = this.testPaper.arrange;
|
||||||
data.passLine = this.testPaper.passLine;
|
data.passLine = this.testPaper.passLine;
|
||||||
data.scoreType=this.testPaper.scoringType;
|
data.scoreType=this.testPaper.scoringType;
|
||||||
data.totalScore=this.curTestAnswer.totalScore;
|
data.ucode = this.userInfo.userNo;
|
||||||
|
//计算总分
|
||||||
|
let total = 0;
|
||||||
|
this.paper.forEach(item => {
|
||||||
|
total += item.defaultScore;
|
||||||
|
});
|
||||||
|
data.totalScore=total;
|
||||||
data.answerJson = this.getAnswer();
|
data.answerJson = this.getAnswer();
|
||||||
data.realScore=this.countScore();
|
data.realScore=this.countScore();
|
||||||
|
if(!this.aloneExamAnswerId){
|
||||||
|
data.paperJson = this.clearPagerJson();
|
||||||
|
}
|
||||||
|
|
||||||
data.useSecond=this.testPaper.testDuration*60-this.remainingTime;
|
data.useSecond=this.testPaper.testDuration*60-this.remainingTime;
|
||||||
//计算百分制显示
|
//计算百分制显示
|
||||||
data.score=data.realScore*100/data.totalScore;
|
data.score=data.realScore*100/data.totalScore;
|
||||||
@@ -611,7 +639,6 @@
|
|||||||
},
|
},
|
||||||
nextSub() {
|
nextSub() {
|
||||||
//console.log(this.curItem,'this.curItem');
|
//console.log(this.curItem,'this.curItem');
|
||||||
|
|
||||||
if (this.curIndex >= (this.total - 1)) {
|
if (this.curIndex >= (this.total - 1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user