Browse Source

增加答题次数限制

chenxiong 3 years ago
parent
commit
3801f30dd0
1 changed files with 9 additions and 1 deletions
  1. 9 1
      pages2/bank/question_detail.vue

+ 9 - 1
pages2/bank/question_detail.vue

@@ -159,7 +159,15 @@ export default {
 		 * @param {Object} goodsId
 		 * @param {Object} chapterExamId
 		 */
-		doRepeat(recordId,examId,goodsId,chapterExamId=0,moduleId=0) {
+		async doRepeat(recordId,examId,goodsId,chapterExamId=0,moduleId=0) {
+			let count = await this.examRecordCount(examId);
+			let answerNum = await this.getExamDetail(examId);
+			//超过答题次数
+			if (answerNum > 0 && count >= answerNum) {
+				this.$u.toast('该试卷只能答题' + answerNum + '次!');
+				return;
+			}
+			
 			uni.showModal({
 			    title: '提示',
 			    content: '是否清空答案重做?',