Browse Source

修改bug

chenxiong 3 năm trước cách đây
mục cha
commit
d0f2e00182
2 tập tin đã thay đổi với 124 bổ sung6 xóa
  1. 8 0
      common/httpList/goods.js
  2. 116 6
      pages2/bank/questionBankExplainDetail.vue

+ 8 - 0
common/httpList/goods.js

@@ -68,6 +68,14 @@ export default {
 		})
 	},
 	
+	examRecordWrongList(data) {
+		return myRequest({
+			url: '/exam/record/wrong_list',
+			data:data,
+			method: 'GET',
+		})
+	},
+	
 	 
 	
 	bankRecord(data) {

+ 116 - 6
pages2/bank/questionBankExplainDetail.vue

@@ -1,7 +1,7 @@
 <template>
 	<view id="questionBank">
 		<view class="tabs-top">
-			<u-tabs :list="list" sticky :current="current" @change="change" active-color="#007AFF"></u-tabs>
+			<u-tabs :list="list" sticky :current="tabCurrent" @change="tabChange" active-color="#007AFF"></u-tabs>
 		</view>
 		<swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
 			<swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">
@@ -360,6 +360,7 @@ export default {
 	data() {
 		return {
 			examId:'',
+			tabCurrent:0,
 			current:0,
 			questionList:[],
 			ast: ['A', 'B', 'C', 'D','E','F','G'],
@@ -385,12 +386,25 @@ export default {
 		this.chapterId = option.chapterId;
 		this.moduleId = option.moduleId;
 		// this.goodsQuestionList();
-		this.examRecordRightList();
+		if(this.tabCurrent == 0) {
+			this.examRecordRightList();
+		} else {
+			this.examRecordWrongList();
+		}
+		
 	},
 	onUnload() {
 		
 	},
 	methods: {
+		tabChange(e) {
+			this.tabCurrent = e;
+			if(this.tabCurrent == 0) {
+				this.examRecordRightList();
+			} else {
+				this.examRecordWrongList();
+			}
+		},
 		/**
 		 * 是否有上传图片
 		 */
@@ -398,16 +412,112 @@ export default {
 			
 			return bank.ansText.imageList.length == 0;
 		},
+		/**
+		 * 获取错题列表
+		 */
+		examRecordWrongList() {
+			this.$api.examRecordWrongList({
+				examId:this.examId,
+				goodsId:this.goodsId
+			}).then(res => {
+				
+				res.data.rows.forEach((item,index) => { 
+					if(typeof item.jsonStr == 'string') {
+						item.jsonStr = JSON.parse(item.jsonStr)
+						
+						if(item.type == 2) { //多选
+							item.jsonStr.forEach(str => {
+								str.optionsId = ''+str.optionsId;
+							})
+							let arr = item.answerQuestion.split(',');
+							arr.forEach((a,i) => {
+								arr[i] = ''+a;
+							})
+							item.ans = arr;
+							if(this.explain) {
+								item.ques = item.ans;
+							}
+							return;
+						} else if(item.type == 5) {
+							item.ansText = {
+								text: '',
+								imageList: []
+							}
+							
+							if(this.explain) {
+								item.ques = {
+									text:item.analysisContent
+								}
+								
+								return;
+							}
+							
+							
+						} else if(item.type == 4) {
+							console.log(item.jsonStr)
+							item.ques = []
+							item.current = 0;
+							let ansArr = []; 
+							item.jsonStr.forEach((json,index) => {
+								if(json.type == 1) {
+									ansArr[index] = json.answerQuestion;
+								} else if(json.type == 2) {
+									json.optionsList.forEach(str => {
+										str.optionsId = ''+str.optionsId;
+									})
+									let arr = json.answerQuestion.split(',');
+									arr.forEach((a,i) => {
+										arr[i] = ''+a;
+									})
+									ansArr[index] = arr
+								} else if(json.type == 3) {
+									ansArr[index] = json.answerQuestion;
+								} else if(json.type == 5) {
+									ansArr[index] = {
+										text: '',
+										imageList: []
+									}
+									json.ansText = {
+										text: '',
+										imageList: []
+									}
+								}
+							})
+							
+							item.ans = ansArr
+							if(this.explain) {
+								item.ques = item.ans;
+							}
+							return;
+							
+						}
+						
+						item.ans = item.answerQuestion
+						if(this.explain) {
+							item.ques = item.ans;
+						}
+					} else {
+						if(this.explain) {
+							item.ques = item.ans;
+						}
+					}
+					
+				})
+				
+				this.questionList = res.data.rows;
+				
+			})
+		},
 		/**
 		 * 获取对题列表
 		 */
 		examRecordRightList() {
-			this.$api.goodsQuestionList({
+			this.$api.examRecordRightList({
 				examId:this.examId,
 				goodsId:this.goodsId
 			}).then(res => {
 				
-				res.data.data.forEach((item,index) => { 
+				res.data.rows.forEach((item,index) => { 
 					if(typeof item.jsonStr == 'string') {
 						item.jsonStr = JSON.parse(item.jsonStr)
 						
@@ -490,7 +600,7 @@ export default {
 					
 				})
 				
-				this.questionList = res.data.data;
+				this.questionList = res.data.rows;
 				
 			})
 		},
@@ -1215,7 +1325,7 @@ export default {
 }
 .swiper {
 	width:100%;
-	height:100vh;
+	height:calc(100vh - 44px);
 }
 .lisSty {
 	margin-bottom: 16rpx;