Explorar o código

增加做题记录

chenxiong %!s(int64=3) %!d(string=hai) anos
pai
achega
84fc4dfcf7
Modificáronse 3 ficheiros con 73 adicións e 17 borrados
  1. 13 2
      pages2/bank/questionBank.vue
  2. 60 4
      pages2/bank/questionBankExplain.vue
  3. 0 11
      pages2/class/detail.vue

+ 13 - 2
pages2/bank/questionBank.vue

@@ -767,15 +767,26 @@ export default {
 		},
 		/**
 		 * 记录总题数
+		 * hasSpecial (是否包含简答和案例) true 包含  false 不包含
 		 */
-		examRecord() {
+		examRecord(hasSpecial) {
+			let questionList = 0;
+			if(!hasSpecial) {
+				this.questionList.forEach((item, index) => {
+					if(item.type == 1 || item.type == 2 || item.type == 3) {
+						questionList++;
+					}
+				})
+			} else {
+				questionList = this.questionList.length;
+			}
 			this.$api
 				.examRecord({
 					chapterExamId: this.chapterId || 0,
 					moduleExamId: this.moduleId || 0,
 					examId: this.id,
 					goodsId: this.goodsId,
-					totalQuestionNum: this.questionList.length
+					totalQuestionNum: questionList
 				})
 				.then(res => {
 					this.recordId = res.data.data;

+ 60 - 4
pages2/bank/questionBankExplain.vue

@@ -433,7 +433,8 @@ export default {
 			//继续答题
 			if(this.isContinue || this.isHistory) {
 				
-				console.log(this.isContinue,"历史做题")
+				console.log(this.isHistory,"历史做题")
+				console.log(this.isContinue,"继续做题")
 				this.$api.examReport(this.recordId).then(res => {
 					let json = JSON.parse(res.data.data.historyExamJson)
 					
@@ -567,12 +568,16 @@ export default {
 			if(!this.isSubmit) {
 				let number = 0;
 				let score = 0;
+				let doQuestionNum = 0;
 				this.questionList.length && 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]
@@ -582,11 +587,25 @@ export default {
 							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++;
+						}
 					}
 				})
 				
@@ -596,6 +615,7 @@ export default {
 					recordId: this.recordId,
 					rightQuestionNum:number,
 					status:0,
+					doQuestionNum: doQuestionNum,
 					historyExamJson:JSON.stringify(this.questionList)
 				}).then(res => {
 					
@@ -638,14 +658,24 @@ export default {
 			let number = 0;
 			let allScore = 0;
 			let passScore = 0;
+			let doWrongQuestionIds = []; //错题和未做题id(客观题)
+			let doQuestionIds = []; //做过的题目id
+			let rightQuestionIds = []; //做对的题目id
 			this.questionList.forEach((item,index) => {
 				passScore = item.passScore
 				if(item.type == 1) {
 					if(item.ques == item.ans) { 
 						score += item.score;
 						number++
+						rightQuestionIds.push(item.questionId)
+					} else { //错误
+						doWrongQuestionIds.push(item.questionId)
 					}
 					allScore += item.score
+					if (item.ques) {
+						doQuestionNum++;
+						doQuestionIds.push(item.questionId)
+					}
 				} else if(item.type == 2) {
 					let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
 						return item.ques[quesIndex] == item.ans[quesIndex]
@@ -654,18 +684,41 @@ export default {
 					if(isRight) {
 						score += item.score;
 						number++
+						rightQuestionIds.push(item.questionId)
+					} else {
+						doWrongQuestionIds.push(item.questionId)
 					}
 					allScore += item.score
+					if (item.ques && item.ques.length) {
+						doQuestionNum++;
+						doQuestionIds.push(item.questionId)
+					}
 				} else if(item.type == 3) {
 					if(item.ques == item.ans) {
 						score += item.score;
 						number++
+						rightQuestionIds.push(item.questionId)
+					} else {
+						doWrongQuestionIds.push(item.questionId)
+					}
+					allScore += item.score;
+					if (item.ques) {
+						doQuestionNum++;
+						doQuestionIds.push(item.questionId)
+					}
+				} else if (item.type == 4) {
+					if (item.ques && item.ques.length) {
+						doQuestionNum++;
+					}
+				} else if (item.type == 5) {
+					if (item.ques) {
+						doQuestionNum++;
 					}
-					allScore += item.score
 				}
 			})
 			
-			if(score >= passScore) {
+			//大于60分及格
+			if(score >= 60) {
 				reportStatus = 1
 			} else {
 				reportStatus = 0
@@ -679,7 +732,10 @@ export default {
 				recordId: this.recordId,
 				rightQuestionNum:number,
 				status:1,
-				performance:score,
+				doQuestionIds:doQuestionIds.join(','),
+				rightQuestionIds:rightQuestionIds.join(','),
+				doQuestionNum: doQuestionNum,
+				performance: score,
 				historyExamJson:JSON.stringify(this.questionList)
 			}).then(res => {
 				this.isSubmit = true;

+ 0 - 11
pages2/class/detail.vue

@@ -622,17 +622,6 @@ export default {
 			}
 		},
 		onStateChange(newstate, oldstate) {
-			setTimeout(()=>{
-				this.photoPopup = true;
-					uni.authorize({
-					     scope: 'scope.camera',
-					     success() {
-					        
-					     }
-					 })    
-					 
-					 console.log(9999119)
-			},5000) 
 			console.log(newstate, 6989);
 			if (newstate.detail.newstate == 'playing') {
 				if (this.needSeek) {