فهرست منبع

feat: 视频试卷做题记录

xuqiaoying 3 سال پیش
والد
کامیت
5f9306844e
3فایلهای تغییر یافته به همراه135 افزوده شده و 37 حذف شده
  1. 59 14
      pages2/bank/question_record.vue
  2. 50 12
      pages2/bank/question_record_list.vue
  3. 26 11
      pages2/class/question_report.vue

+ 59 - 14
pages2/bank/question_record.vue

@@ -28,10 +28,10 @@
 					</view>
 				</view>
 				<view class="btns">
-					<view class="btn" v-if="record.status == 1" @click="doRepeat(record.examId, record.goodsId, record.moduleExamId, record.chapterExamId,index,record)">重做</view>
+					<view class="btn" v-if="record.status == 1" @click="doRepeat(record.goodsId, record)">重做</view>
 					<view class="btn" @click="questionBankExplain(record)" v-if="record.status == 1">解析</view>
 					<view class="btn" @click="questionReport(record)" v-if="record.status == 1">报告</view>
-					<view class="btn continue" @click="doContinue(record,index)" v-if="record.status == 0 && record.historyExamJson">继续答题</view>
+					<view class="btn continue" @click="doContinue(record,index)" v-if="record.courseType != 2 && record.status == 0 && record.historyExamJson">继续答题</view>
 					<view class="btn continue" @click="moreRecord(record,index)" >更多记录</view>
 				</view>
 			</view>
@@ -136,15 +136,24 @@ export default {
 	},
 	methods: {
 		questionBankExplain(record) {
+			let moduleId = record.courseType == 2 ? record.moduleId : record.moduleExamId
+			let chapterId = record.courseType == 2 ? record.chapterId : record.chapterExamId
 			uni.navigateTo({
-				url:'/pages2/bank/questionBankExplain?id='+record.examId +'&goodsid='+record.goodsId+'&moduleId='+record.moduleExamId+'&chapterId='+record.chapterExamId+'&orderGoodsId='+record.orderGoodsId
+				url:'/pages2/bank/questionBankExplain?id='+record.examId +'&goodsid='+record.goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+'&orderGoodsId='+record.orderGoodsId
 				
 			})
 		},
 		questionReport(record) {
-			uni.navigateTo({
-				url:'/pages2/bank/question_report?goodsId='+record.goodsId+'&chapterId='+record.chapterExamId+'&moduleId='+record.moduleExamId+'&examId='+record.examId+'&id=' + record.recordId+'&orderGoodsId='+record.orderGoodsId
-			})
+			if (record.courseType == 2) {
+				uni.navigateTo({
+                	url: "/pages2/class/question_report?examId=" + record.examId + '&recordId=' + record.recordId + '&type=' + record.type + '&orderGoodsId='+ record.orderGoodsId,
+              });
+			} else {
+				uni.navigateTo({
+					url:'/pages2/bank/question_report?goodsId='+record.goodsId+'&chapterId='+record.chapterExamId+'&moduleId='+record.moduleExamId+'&examId='+record.examId+'&id=' + record.recordId+'&orderGoodsId='+record.orderGoodsId
+				})
+			}
+			
 		},
 		/**
 		 * 更多记录
@@ -215,21 +224,40 @@ export default {
 		/**
 		 * 去做题
 		 */
-		async doRepeat(id, goodsId, moduleId = 0, chapterId = 0,index,record) {
+		async doRepeat(goodsId, record) {
 			// await this.getDetail(goodsId);
 			this.itemIndex = '';
 			this.isRepeat = true;
-			let count = await this.examRecordCount(id,goodsId);
-			let answerNum = await this.getExamDetail(id);
+			let count = 0
+			if (record.courseType == 2) {
+				count = await this.bankRecordDoNum(record)
+			} else {
+				count = await this.examRecordCount(record.examId, goodsId);
+			}
+			// let count = await this.examRecordCount(record.examId,goodsId);
+			let answerNum = await this.getExamDetail(record.examId);
 			//超过答题次数
 			if (answerNum > 0 && count >= answerNum) {
 				this.$u.toast('该试卷只能答题' + answerNum + '次!');
 				return;
 			}
 
-			uni.navigateTo({
-				url: '/pages2/bank/questionBank?id=' + id + '&goodsid=' + goodsId + '&moduleId=' + moduleId + '&chapterId=' + chapterId + '&orderGoodsId=' + record.orderGoodsId
-			});
+			if (record.courseType == 2) {
+				const {courseId, gradeId, sectionId, examId, orderGoodsId = 0, type} = record
+				let moduleId = record.moduleId || 0
+				let chapterId = record.chapterId || 0
+				uni.navigateTo({
+					url:"/pages2/class/questionBank?courseId=" + courseId + "&gradeId=" + gradeId + "&isFromVideo=1&id=" + examId +
+					"&goodsid=" + goodsId + "&moduleId=" + moduleId + "&chapterId=" + chapterId + "&sectionId=" + sectionId + "&orderGoodsId=" +
+					orderGoodsId + "&type=" + type,
+				})
+			} else {
+				let moduleId = record.moduleExamId || 0
+				let chapterId = record.chapterExamId || 0
+				uni.navigateTo({
+					url: '/pages2/bank/questionBank?id=' + record.examId + '&goodsid=' + goodsId + '&moduleId=' + moduleId + '&chapterId=' + chapterId + '&orderGoodsId='+record.orderGoodsId
+				});
+			}
 		},
 		/**
 		 * @param {Object} exam_id
@@ -243,7 +271,7 @@ export default {
 			});
 		},
 		/**
-		 * 查询试卷历史做题次数
+		 * 查询试卷历史做题次数(题库的)
 		 */
 		examRecordCount(examId,goodsId) {
 			return new Promise(resolve => {
@@ -257,7 +285,24 @@ export default {
 					});
 			});
 		},
-
+		/**
+		 * 获取试卷已做的次数(视频课程的)
+		 */
+		bankRecordDoNum(record) {
+			return new Promise((resolve) => {
+				this.$api.bankRecordDoNum({
+					goodsId: record.goodsId,
+					gradeId: record.gradeId,
+					chapterId: record.chapterId || 0,
+					courseId: record.courseId,
+					moduleId: record.moduleId || 0,
+					examId: record.examId,
+				})
+				.then((res) => {
+					resolve(res.data.data)
+				});
+			});
+		},
 		getDetail(id) {
 			return new Promise(resolve => {
 				this.$api.goodsDetail(id).then(res => {

+ 50 - 12
pages2/bank/question_record_list.vue

@@ -17,7 +17,7 @@
 					</view>
 				</view>
 				<view class="btns">
-					<view class="btn" v-if="record.status == 1" @click="doRepeat(record.examId, record.goodsId, record.moduleExamId, record.chapterExamId,index,record)">重做</view>
+					<view class="btn" v-if="record.status == 1" @click="doRepeat(record.goodsId, record)">重做</view>
 					<view class="btn" @click="questionBankExplain(record)" v-if="record.status == 1">解析</view>
 					<view class="btn" @click="questionReport(record)" v-if="record.status == 1">报告</view>
 					<view class="btn continue" @click="doContinue(record,index)" v-if="courseType != 2 && record.status == 0 && record.historyExamJson">继续答题</view>
@@ -124,14 +124,17 @@ export default {
 	},
 	methods: {
 		questionBankExplain(record) {
+			let moduleId = this.courseType == 2 ? record.moduleId : record.moduleExamId
+			let chapterId = this.courseType == 2 ? record.chapterId : record.chapterExamId
 			uni.navigateTo({
-				url:'/pages2/bank/questionBankExplain?id='+record.examId +'&goodsid='+record.goodsId+'&moduleId='+record.moduleExamId+'&chapterId='+record.chapterExamId+'&orderGoodsId='+record.orderGoodsId
-				
+				url:'/pages2/bank/questionBankExplain?id='+record.examId +'&goodsid='+record.goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+'&orderGoodsId='+record.orderGoodsId
 			})
 		},
 		questionReport(record) {
 			if (this.courseType == 2) {
-				
+				uni.navigateTo({
+                	url: "/pages2/class/question_report?examId=" + record.examId + '&recordId=' + record.recordId + '&type=' + record.type + '&orderGoodsId='+ record.orderGoodsId,
+              });
 			} else {
 				uni.navigateTo({
 					url:'/pages2/bank/question_report?goodsId='+record.goodsId+'&chapterId='+record.chapterExamId+'&moduleId='+record.moduleExamId+'&examId='+record.examId+'&id=' + record.recordId+'&orderGoodsId='+record.orderGoodsId
@@ -223,25 +226,42 @@ export default {
 		/**
 		 * 去做题
 		 */
-		async doRepeat(id, goodsId, moduleId = 0, chapterId = 0,index,record) {
+		async doRepeat(goodsId, record) {
 			// await this.getDetail(goodsId);
 			this.itemIndex = '';
 			this.isRepeat = true;
-			let count = await this.examRecordCount(id,goodsId);
-			let answerNum = await this.getExamDetail(id);
+			let count = 0
+			if (this.courseType == 2) {
+				count = await this.bankRecordDoNum(record)
+			} else {
+				count = await this.examRecordCount(record.examId, goodsId);
+			}
+			let answerNum = await this.getExamDetail(record.examId);
 			//超过答题次数
 			if (answerNum > 0 && count >= answerNum) {
 				this.$u.toast('该试卷只能答题' + answerNum + '次!');
 				return;
 			}
-
-			uni.navigateTo({
-				url: '/pages2/bank/questionBank?id=' + id + '&goodsid=' + goodsId + '&moduleId=' + moduleId + '&chapterId=' + chapterId + '&orderGoodsId='+record.orderGoodsId
-			});
+			if (this.courseType == 2) {
+				const {courseId, gradeId, sectionId, examId, orderGoodsId = 0, type} = record
+				let moduleId = record.moduleId || 0
+				let chapterId = record.chapterId || 0
+				uni.navigateTo({
+					url:"/pages2/class/questionBank?courseId=" + courseId + "&gradeId=" + gradeId + "&isFromVideo=1&id=" + examId +
+					"&goodsid=" + goodsId + "&moduleId=" + moduleId + "&chapterId=" + chapterId + "&sectionId=" + sectionId + "&orderGoodsId=" +
+					orderGoodsId + "&type=" + type,
+				})
+			} else {
+				let moduleId = record.moduleExamId || 0
+				let chapterId = record.chapterExamId || 0
+				uni.navigateTo({
+					url: '/pages2/bank/questionBank?id=' + record.examId + '&goodsid=' + goodsId + '&moduleId=' + moduleId + '&chapterId=' + chapterId + '&orderGoodsId='+record.orderGoodsId
+				});
+			}
 		},
 		/**
 		 * @param {Object} exam_id
-		 * 获取试卷可以做的次数
+		 * 获取试卷可以做的次数(题库的)
 		 */
 		getExamDetail(exam_id) {
 			return new Promise(resolve => {
@@ -250,6 +270,24 @@ export default {
 				});
 			});
 		},
+		/**
+		 * 获取试卷已做的次数(视频课程的)
+		 */
+		bankRecordDoNum(record) {
+			return new Promise((resolve) => {
+				this.$api.bankRecordDoNum({
+					goodsId: record.goodsId,
+					gradeId: record.gradeId,
+					chapterId: record.chapterId || 0,
+					courseId: record.courseId,
+					moduleId: record.moduleId || 0,
+					examId: record.examId,
+				})
+				.then((res) => {
+					resolve(res.data.data)
+				});
+			});
+		},
 		/**
 		 * 查询试卷历史做题次数
 		 */

+ 26 - 11
pages2/class/question_report.vue

@@ -130,7 +130,7 @@ export default {
 			context1: null,
 			context2: null,
 			rightQuestionNum:'',
-			doWrongQuestionNum:'',
+			// doWrongQuestionNum:'',
 			score:'',
 			totalScore:'',
 			doTime:'',
@@ -163,7 +163,13 @@ export default {
 		}
 	},
 	onUnload() {},
-	computed: { ...mapGetters(['userInfo', 'hideBuyState']) },
+	computed: { 
+		...mapGetters(['userInfo', 'hideBuyState']),
+		doWrongQuestionNum() {
+			let value = this.reportdata.totalQuestionNum - this.reportdata.rightQuestionNum - this.reportdata.lessQuestionNum
+			return value > 0 ? value : 0
+		}
+	},
 	async onShow() {
 		this.courseList = []
 		this.getcourList()
@@ -238,14 +244,14 @@ export default {
 		this.recordId = option.recordId
 		this.examId = option.examId
 		this.orderGoodsId = option.orderGoodsId
-		this.examTime = option.examTime;
-		this.doTime = option.doTime;
-		this.reportStatus = option.reportStatus;
-		this.rightQuestionNum = +option.rightQuestionNum;
-		this.doWrongQuestionNum = +option.doWrongQuestionNum;
-		this.score = +option.score;
-		this.lessQuestionNum = option.lessQuestionNum;
-		this.totalScore = +option.totalScore;
+		// this.examTime = option.examTime;
+		// this.doTime = option.doTime;
+		// this.reportStatus = option.reportStatus;
+		// this.rightQuestionNum = +option.rightQuestionNum;
+		// this.doWrongQuestionNum = +option.doWrongQuestionNum;
+		// this.score = +option.score;
+		// this.lessQuestionNum = option.lessQuestionNum;
+		// this.totalScore = +option.totalScore;
 		// this.hideBtns = Boolean(option.hideBtns);
 		this.bankReport()
 	},
@@ -287,6 +293,15 @@ export default {
 			this.$api.bankReportData(this.recordId).then((res) => {
 				this.reportdata = res.data.data
 				console.log('reportdata:', this.reportdata)
+				const {examTime, doTime, reportStatus, rightQuestionNum, performance, lessQuestionNum, totalScore} = this.reportdata
+				this.examTime = examTime
+				this.doTime = doTime
+				this.reportStatus = reportStatus
+				this.rightQuestionNum = rightQuestionNum
+				// this.doWrongQuestionNum = +option.doWrongQuestionNum;
+				this.score = performance
+				this.lessQuestionNum = lessQuestionNum
+				this.totalScore = totalScore
 			});
 		},
 		/**
@@ -304,7 +319,7 @@ export default {
 			// answerNum==0没有答题次数限制
 			if (answerNum == 0 || (answerNum - count > 0 && answerNum > 0)) {
 				const {courseId, gradeId, sectionId} = this.reportdata
-				uni.redirectTo({
+				uni.navigateTo({
 					url:"/pages2/class/questionBank?courseId=" + courseId + "&gradeId=" + gradeId + "&isFromVideo=1&id=" + examId +
 					"&goodsid=" + goodsId + "&moduleId=" + moduleId + "&chapterId=" + chapterId + "&sectionId=" + sectionId + "&orderGoodsId=" +
 					this.orderGoodsId + "&type=" + this.examType,