Kaynağa Gözat

随机练习结果页更换新的接口和做题记录列表判断随机练习的跳转

xuqiaoying 2 yıl önce
ebeveyn
işleme
929f15a222

+ 7 - 0
common/httpList/goods.js

@@ -176,6 +176,13 @@ export default {
 			method: 'get',
 		})
 	},
+	// 随机练习
+	bankTempReport(data) {
+		return myRequest({
+			url: '/bank/exam/temp/'+data,
+			method: 'get',
+		})
+	},
 	
 	examRecordCount(data) {
 		return myRequest({

+ 6 - 3
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.goodsId, record)">重做</view>
+					<view class="btn" v-if="record.doMode == 1 && 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>
@@ -127,7 +127,8 @@ export default {
 			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='+moduleId+'&chapterId='+chapterId+'&orderGoodsId='+record.orderGoodsId
+				url:'/pages2/bank/questionBankExplain?id='+record.examId +'&goodsid='+record.goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId
+				+'&orderGoodsId='+record.orderGoodsId + '&doMode=' + record.doMode
 			})
 		},
 		questionReport(record) {
@@ -136,8 +137,10 @@ export default {
                 	url: "/pages2/class/question_report?examId=" + record.examId + '&recordId=' + record.recordId + '&type=' + record.type + '&orderGoodsId='+ record.orderGoodsId,
               });
 			} else {
+				let entryType = record.doMode == 2 ? 'random' : '' // random-随机练习
 				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
+					url:'/pages2/bank/question_report?goodsId='+record.goodsId+'&chapterId='+record.chapterExamId+'&moduleId='+record.moduleExamId
+					+'&examId='+record.examId+'&id=' + record.recordId+'&orderGoodsId='+record.orderGoodsId + '&entryType=' + entryType
 				})
 			}
 			

+ 23 - 5
pages2/bank/question_report.vue

@@ -5,14 +5,14 @@
 			{{ reportdata.reportStatus === 0 ? '测试未通过' : reportdata.reportStatus === 1 ? '测试通过' : '' }}
 		</view>
 		<view class="top">
-			<view class="title">{{ reportdata.examName }}</view>
+			<view class="title">{{ examName }}</view>
 			<view class="desc">交卷时间:{{ $method.timestampToTime(reportdata.updateTime, false) }}</view>
 
 			<view class="box">
 				<view class="left">
 					<view>
 						<!-- 练习 -->
-						<template v-if="examData.doType == 1">
+						<template v-if="entryType == 'random' || (examData.doType && examData.doType == 1)">
 							<!-- ((reportdata.rightQuestionNum /
 									reportdata.doQuestionNum || 0).toFixed(0) *
 									100) -->
@@ -170,6 +170,7 @@ export default {
 			total: 0,
 			entryType: '', // 进入做题页面的入口类型,daily-每日一练进来,其他的-题库做题进入
 			bankNum: 5, // 随机练习的题目数量
+			examName: '', // 试卷名称
 		};
 	},
 	onUnload() {},
@@ -194,9 +195,13 @@ export default {
 		
 		this.examWrongRecordWrongNum();
 		this.bankExamNextExam()
-		await this.bankExam();
+		// await this.bankExam();
 		await this.examReport();
-		
+		if (this.entryType == 'random') {
+			this.bankExamTemp()
+		} else {
+			await this.bankExam();
+		}
 	},
 	onPullDownRefresh() {
 		this.pageNum = 1
@@ -365,6 +370,7 @@ export default {
 			// });
 		},
 		bankExam(){
+			// '/bank/exam/'+data
 			return new Promise(resolve =>{
 				this.$api.bankExam(this.examId).then(res => {
 					this.examData = res.data.data;
@@ -443,12 +449,24 @@ export default {
 			return new Promise(resolve => {
 				this.$api.examReport(this.recordId).then(res => {
 					this.reportdata = res.data.data;
+					if (this.entryType != 'random') {
+						this.examName = this.reportdata.examName
+					}
 					this.getCanvas()
 					resolve()
 				});
 				
 			})
-		}
+		},
+		bankExamTemp() {
+			// '/bank/exam/temp/'+data
+			this.$api.bankTempReport(this.examId).then(res => {
+				if (res.data.code == 200) {
+					this.examName = res.data.data.examName
+				}
+			});
+				
+		},
 	}
 };
 </script>