|
@@ -669,45 +669,66 @@ export default {
|
|
|
* 离开页面统计回答正确题数
|
|
|
*/
|
|
|
examRecordEdit() {
|
|
|
- if (!this.isSubmit) {
|
|
|
- let number = 0;
|
|
|
- let score = 0;
|
|
|
- this.questionList.forEach((item, index) => {
|
|
|
- if (item.type == 1) {
|
|
|
- if (item.ques == item.ans) {
|
|
|
- score += item.score;
|
|
|
- number++;
|
|
|
- }
|
|
|
- } else if (item.type == 2) {
|
|
|
- let isRight =
|
|
|
- item.ques &&
|
|
|
- item.ques.every((quesItem, quesIndex) => {
|
|
|
- return item.ques[quesIndex] == item.ans[quesIndex];
|
|
|
- });
|
|
|
-
|
|
|
- if (isRight) {
|
|
|
- score += item.score;
|
|
|
- number++;
|
|
|
- }
|
|
|
- } else if (item.type == 3) {
|
|
|
- if (item.ques == item.ans) {
|
|
|
- score += item.score;
|
|
|
- number++;
|
|
|
+ if(!this.isSubmit) {
|
|
|
+
|
|
|
+ let number = 0;
|
|
|
+ let score = 0;
|
|
|
+ let doQuestionNum = 0;
|
|
|
+ this.questionList.forEach((item,index) => {
|
|
|
+ if(item.type == 1) {
|
|
|
+ if(item.ques == item.ans) {
|
|
|
+ score += item.score;
|
|
|
+ number++
|
|
|
+ }
|
|
|
+
|
|
|
+ if(item.ques) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ } else if(item.type == 2) {
|
|
|
+ let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
|
|
|
+ return item.ques[quesIndex] == item.ans[quesIndex]
|
|
|
+ })
|
|
|
+
|
|
|
+ if(isRight) {
|
|
|
+ score += item.score;
|
|
|
+ number++
|
|
|
+ }
|
|
|
+
|
|
|
+ if(item.ques && item.ques.length) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ } else if(item.type == 3) {
|
|
|
+ if(item.ques == item.ans) {
|
|
|
+ score += item.score;
|
|
|
+ number++
|
|
|
+ }
|
|
|
+
|
|
|
+ if(item.ques) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ } else if(item == 4) {
|
|
|
+ if(item.ques.length) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ } else if(item.type == 5) {
|
|
|
+ if(item.ques) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.$api.examRecordEdit({
|
|
|
+ examId:this.id,
|
|
|
+ goodsId:this.goodsId,
|
|
|
+ recordId: this.recordId,
|
|
|
+ rightQuestionNum:number,
|
|
|
+ status:0,
|
|
|
+ doQuestionNum:doQuestionNum,
|
|
|
+ historyExamJson:JSON.stringify(this.questionList)
|
|
|
+ }).then(res => {
|
|
|
+
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- this.$api
|
|
|
- .examRecordEdit({
|
|
|
- examId: this.id,
|
|
|
- goodsId: this.goodsId,
|
|
|
- recordId: this.recordId,
|
|
|
- rightQuestionNum: number,
|
|
|
- status: 0,
|
|
|
- historyExamJson: JSON.stringify(this.questionList)
|
|
|
- })
|
|
|
- .then(res => {});
|
|
|
- }
|
|
|
},
|
|
|
/**
|
|
|
* 记录总题数
|
|
@@ -1046,64 +1067,83 @@ export default {
|
|
|
let score = 0; //计算总分
|
|
|
let reportStatus = 0;
|
|
|
let number = 0;
|
|
|
- this.questionList.forEach((item, index) => {
|
|
|
- if (item.type == 1) {
|
|
|
- if (item.ques == item.ans) {
|
|
|
+ let doQuestionNum = 0;
|
|
|
+ this.questionList.forEach((item,index) => {
|
|
|
+ if(item.type == 1) {
|
|
|
+ if(item.ques == item.ans) {
|
|
|
score += item.score;
|
|
|
- number++;
|
|
|
+ number++
|
|
|
}
|
|
|
- } else if (item.type == 2) {
|
|
|
- let isRight =
|
|
|
- item.ques &&
|
|
|
- item.ques.every((quesItem, quesIndex) => {
|
|
|
- return item.ques[quesIndex] == item.ans[quesIndex];
|
|
|
- });
|
|
|
-
|
|
|
- if (isRight) {
|
|
|
+
|
|
|
+ if(item.ques) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ } else if(item.type == 2) {
|
|
|
+ let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
|
|
|
+ return item.ques[quesIndex] == item.ans[quesIndex]
|
|
|
+ })
|
|
|
+
|
|
|
+ if(isRight) {
|
|
|
score += item.score;
|
|
|
- number++;
|
|
|
+ number++
|
|
|
}
|
|
|
- } else if (item.type == 3) {
|
|
|
- if (item.ques == item.ans) {
|
|
|
+
|
|
|
+ if(item.ques && item.ques.length) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ } else if(item.type == 3) {
|
|
|
+ if(item.ques == item.ans) {
|
|
|
score += item.score;
|
|
|
- number++;
|
|
|
+ number++
|
|
|
+ }
|
|
|
+
|
|
|
+ if(item.ques) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ } else if(item.type == 4) {
|
|
|
+ if(item.ques && item.ques.length) {
|
|
|
+ doQuestionNum++;
|
|
|
+ }
|
|
|
+ } else if(item.type == 5) {
|
|
|
+ if(item.ques) {
|
|
|
+ doQuestionNum++;
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
+ })
|
|
|
+
|
|
|
// if(score >= 60) {
|
|
|
// reportStatus = 1
|
|
|
// } else {
|
|
|
// reportStatus = 0
|
|
|
// }
|
|
|
-
|
|
|
- this.$api
|
|
|
- .examRecordEdit({
|
|
|
- examId: this.id,
|
|
|
- goodsId: this.goodsId,
|
|
|
- // reportStatus:reportStatus,
|
|
|
- recordId: this.recordId,
|
|
|
- rightQuestionNum: number,
|
|
|
- status: 1,
|
|
|
- score: score,
|
|
|
- historyExamJson: JSON.stringify(this.questionList)
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- this.isSubmit = true;
|
|
|
- if (res.data.code == 200) {
|
|
|
- uni.showToast({
|
|
|
- title: '交卷成功',
|
|
|
- duration: 2000,
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
-
|
|
|
- setTimeout(() => {
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages2/bank/question_report?id=' + this.recordId
|
|
|
- });
|
|
|
- }, 2000);
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ this.$api.examRecordEdit({
|
|
|
+ examId:this.id,
|
|
|
+ goodsId:this.goodsId,
|
|
|
+ // reportStatus:reportStatus,
|
|
|
+ recordId: this.recordId,
|
|
|
+ rightQuestionNum:number,
|
|
|
+ status:1,
|
|
|
+ doQuestionNum:doQuestionNum,
|
|
|
+ score:score,
|
|
|
+ historyExamJson:JSON.stringify(this.questionList)
|
|
|
+ }).then(res => {
|
|
|
+ this.isSubmit = true;
|
|
|
+ if(res.data.code == 200) {
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ title: '交卷成功',
|
|
|
+ duration: 2000,
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.redirectTo({
|
|
|
+ url:'/pages2/bank/question_report?id='+this.recordId
|
|
|
+ })
|
|
|
+ },2000)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/**
|