he2802 4 年之前
父节点
当前提交
ebfd026ed6
共有 5 个文件被更改,包括 272 次插入105 次删除
  1. 9 0
      common/httpList/collect.js
  2. 2 2
      pages.json
  3. 47 21
      pages2/bank/detail.vue
  4. 8 2
      pages2/bank/endBG.vue
  5. 206 80
      pages2/bank/question.vue

+ 9 - 0
common/httpList/collect.js

@@ -108,4 +108,13 @@ export default {
 			method: 'get',
 		})
 	},
+	
+	//查询用户错题历史列表
+	questionListrecord(data) {
+		return myRequest({
+			url: '/bank/question/record/list',
+			method: 'get',
+			data: data,
+		})
+	},
 }

+ 2 - 2
pages.json

@@ -200,7 +200,7 @@
 		}, {
 			"path": "bank/question",
 			"style": {
-				"navigationBarTitleText": "题集",
+				"navigationBarTitleText": "题集",
 				"app-plus": {
 					"titleNView": false, //禁用原生导航栏 
 					"bounce": "none"
@@ -209,7 +209,7 @@
 		},{
 			"path": "bank/endBG",
 			"style": {
-				"navigationBarTitleText": "错题集",
+				"navigationBarTitleText": "答题报告",
 				"app-plus": {
 					"titleNView": false, //禁用原生导航栏 
 					"bounce": "none"

+ 47 - 21
pages2/bank/detail.vue

@@ -24,7 +24,7 @@
 								<u-col span="5">
 									<view style="margin-top: 20rpx;">
 										<view class="t1">总题数</view>
-										<view class="t3">300</view>
+										<view class="t3">{{pageData.questionNum}}</view>
 										<view class="t1">已答过</view>
 										<view class="t3">0</view>
 									</view>
@@ -32,10 +32,10 @@
 							</u-row>
 						</view>
 					</view>
-					<view class="box2">
+					<view class="box2" @click="jumpExam(2)">
 						<view style="height: 100%;display: flex;flex-direction: column;justify-content: center;">
-							<view style="text-align: center;" @click="jumpQuestion">
-								<view class="big_num">0</view>
+							<view style="text-align: center;">
+								<view class="big_num">{{errorLists}}</view>
 								<view class="t4">
 									错题集
 									<u-icon name="arrow-right" size="28"></u-icon>
@@ -43,10 +43,10 @@
 							</view>
 						</view>
 					</view>
-					<view class="box2">
+					<view class="box2" @click="jumpExam(1)">
 						<view style="height: 100%;display: flex;flex-direction: column;justify-content: center;">
 							<view style="text-align: center;">
-								<view class="big_num">0</view>
+								<view class="big_num">{{favoritesLength}}</view>
 								<view class="t4">
 									收藏集
 									<u-icon name="arrow-right" size="28"></u-icon>
@@ -160,7 +160,7 @@
 					</u-col>
 				</u-row>
 				<view style="margin: 10rpx;">
-					<view class="tj_box" v-for="(item, index) in recommendListS" :key="index">
+					<view class="tj_box" v-for="(item, index) in recommendListS" :key="index" @click="changeComNewPages(item)">
 						<image :src="$method.splitImgHost(item.coverUrl)" style="width: 320rpx;height: 160rpx;"></image>
 						<view style="font-size: 24rpx;color: #666666;">{{ item.bankName }}</view>
 						<view>
@@ -233,7 +233,7 @@ export default {
 					name: '相关推荐'
 				}
 			],
-			collecStatus:false,
+			collecStatus: false,
 			current: 0,
 			activeStatus: false, //课程目录下拉样式变化是否开启
 			activeStatusCata: 0, //当前选中章节
@@ -244,13 +244,15 @@ export default {
 			pageData: [], //传入数据
 			teachersList: [], //教师数据
 			recommendListS: [], //推荐列表
-			id:0
+			favoritesLength: 0,//收藏集数量
+			errorLists: 0,//错题集数量
+			id: 0
 		};
 	},
 	onLoad(option) {
 		this.drawProgressbg();
 		this.drawCircle(1.3); // 0-2
-		this.id = option.id
+		this.id = option.id;
 		var options = {};
 		this.$api.bankInfo(option.id).then(res => {
 			options = res.data.data;
@@ -260,21 +262,41 @@ export default {
 			} else {
 				this.getBankDListSJ(options);
 			}
-			if(options.teacherIds!=null){
+			if (options.teacherIds != null) {
 				this.teacherS(options.teacherIds);
 			}
 			this.recommendList(options);
 		});
-		
 	},
 	onShow() {
 		if (!uni.getStorageSync('union_id') && this.$store.state.token === '') {
 		} else {
 			this.favoritesStatus();
+			this.favoritesList();
+			this.errorList()
 		}
 	},
 	methods: {
-
+		// 收藏
+		favoritesList() {
+			var data ={
+				bankId: this.id
+			}
+			this.$api.systemquestionList(data).then(res => {
+				console.log(res)
+				this.favoritesLength = res.data.rows.length
+			})
+		},
+		//错题集
+		errorList(){
+			var self = this
+			var data ={
+				bankId: self.id
+			}
+			self.$api.questionListrecord(data).then(res => {
+				self.errorLists = res.data.rows.length
+			})
+		},
 		getBankDList(options) {
 			var data = {
 				bankId: options.bankId
@@ -346,11 +368,6 @@ export default {
 				this.teachersList = res.data.rows;
 			});
 		},
-		jumpQuestion() {
-			this.$navTo.togo('/pages2/bank/question', {
-				type: 2
-			});
-		},
 		recommendList(options) {
 			var data = {
 				bankId: options.bankId
@@ -362,24 +379,28 @@ export default {
 		change(index) {
 			this.current = index;
 		},
-		jumpExam() {
+		jumpExam(v) {
 			if (this.pageData.typeId === 1) {
 				this.$navTo.togo('/pages2/bank/question', {
 					bankSectionId: this.infoData.bankSectionId,
 					bankId: this.pageData.bankId,
 					typeId: this.pageData.typeId,
+					sc: v === 1 ? true : false,
+					ct: v === 2 ? true : false
 				});
 			} else {
 				this.$navTo.togo('/pages2/bank/question', {
 					examId: this.infoData.examId,
 					bankId: this.pageData.bankId,
 					typeId: this.pageData.typeId,
+					sc: v === 1 ? true : false,
+					ct: v === 2 ? true : false
 				});
 			}
 		},
 		favoritesStatus() {
 			this.$api.bankCollects(this.id).then(result => {
-				console.log(1)
+				console.log(1);
 				if (result.data.data === undefined) {
 					this.collecStatus = false;
 				} else {
@@ -397,7 +418,7 @@ export default {
 			} else {
 				if (this.collecStatus) {
 					this.$api.bankCollects(self.id).then(results => {
-						console.log(results)
+						console.log(results);
 						self.$api.bankCollectdelete(results.data.data.collectBankId).then(resz => {
 							self.favoritesStatus();
 						});
@@ -413,6 +434,11 @@ export default {
 				}
 			}
 		},
+		changeComNewPages(item){
+			this.$navTo.togo('/pages2/bank/detail', {
+				id: item.bankId
+			});
+		},
 		drawProgressbg() {
 			// 使用 wx.createContext 获取绘图上下文 context
 			var ctx = wx.createCanvasContext('canvasProgressbg', this);

+ 8 - 2
pages2/bank/endBG.vue

@@ -36,7 +36,7 @@
 		<view class="footer">
 			<view class="btns">错题解析</view>
 			<view class="btns">全部解析</view>
-			<view class="btns">继续练习</view>
+			<view class="btns" @click="backUp">继续练习</view>
 		</view>
 	</view>
 </template>
@@ -55,7 +55,13 @@ export default {
 		this.correct = options.correct;
 		this.error = options.error;
 	},
-	methods: {}
+	methods: {
+		backUp(){
+			uni.navigateBack({
+			    delta: 1
+			});
+		},
+	}
 };
 </script>
 <style>

+ 206 - 80
pages2/bank/question.vue

@@ -13,7 +13,7 @@
 			<view class="content">
 				<view class="contentTitle">{{ nowPageData.content }}</view>
 				<view class="imageBox" v-if="nowPageData.imgUrl && nowPageData.imgUrl !== null">
-					<image :src="$method.splitImgHost(nowPageData.imgUrl)" mode="aspectFit"  @click="seeBigImage(nowPageData.imgUrl)"></image>
+					<image :src="$method.splitImgHost(nowPageData.imgUrl)" mode="aspectFit" @click="seeBigImage(nowPageData.imgUrl)"></image>
 				</view>
 			</view>
 			<!---案例内容start -->
@@ -25,7 +25,9 @@
 				</view>
 				<view class="content">
 					<view class="contentTitle">{{ itemst.content }}</view>
-					<view class="imageBox" v-if="itemst.imgUrl && itemst.imgUrl !== null"><image :src="$method.splitImgHost(itemst.imgUrl)" mode="aspectFit"  @click="seeBigImage(itemst.imgUrl)"></image></view>
+					<view class="imageBox" v-if="itemst.imgUrl && itemst.imgUrl !== null">
+						<image :src="$method.splitImgHost(itemst.imgUrl)" mode="aspectFit" @click="seeBigImage(itemst.imgUrl)"></image>
+					</view>
 				</view>
 				<view
 					class="banksChiList"
@@ -37,7 +39,7 @@
 					<view class="leftIndex">{{ alphabet[indexs] }}.</view>
 					<view class="bankTie">
 						<view>{{ items.content }}</view>
-						<image v-if="items.imgUrl && items.imgUrl !== null" :src="$method.splitImgHost(items.imgUrl)" mode="aspectFit"  @click="seeBigImage(items.imgUrl)"></image>
+						<image v-if="items.imgUrl && items.imgUrl !== null" :src="$method.splitImgHost(items.imgUrl)" mode="aspectFit" @click="seeBigImage(items.imgUrl)"></image>
 					</view>
 				</view>
 				<view v-if="itemst.type === 3" class="banksChiList" :class="isWrong === 1 ? 'activeListBt' : ''" @click="activePDs(1, indexst)">正确</view>
@@ -126,7 +128,13 @@
 		<u-popup v-model="show" mode="bottom" :safe-area-inset-bottom="true">
 			<view class="popup_box">
 				<scroll-view scroll-y="true" class="popup_list">
-					<view v-for="(item, index) in list" :key="index" class="btn_num" :class="index === numIndex ? 'btn_bac2' : 'btn_bac1'" @click="changeTM(index, 2)">
+					<view
+						v-for="(item, index) in list"
+						:key="index"
+						class="btn_num"
+						:class="index === numIndex ? 'btn_bac2' : isWrites.indexOf(item.questionId) !== -1 ? 'btn_bac3' : 'btn_bac1'"
+						@click="changeTM(index, 2)"
+					>
 						<text class="">{{ index + 1 }}</text>
 					</view>
 				</scroll-view>
@@ -174,28 +182,33 @@ export default {
 			selects: [], //当前做了哪些题目
 			showJX: [], // 展开解析列表
 			showJXanli: [], // 展开案例解析列表
-			collecStatus: false
+			collecStatus: false,
+			isWrites: [], //已做的题目id
+			sc: false, //收藏集进来的?
+			ct: false //错题进来的?
 		};
 	},
 	onLoad(option) {
-		this.titleListFn(option);
 		this.bankId = option.bankId;
 		this.typeId = option.typeId;
+		this.sc = option.sc;
+		this.ct = option.ct;
 		if (option.bankSectionId) {
 			this.bankSectionId = option.bankSectionId;
 		}
 		if (option.examId) {
 			this.examId = option.examId;
 		}
+		this.titleListFn(option);
 	},
 	methods: {
 		//预览图片
-		seeBigImage(url){
-			var urlarr = []
-			urlarr.push(this.$method.splitImgHost(url))
+		seeBigImage(url) {
+			var urlarr = [];
+			urlarr.push(this.$method.splitImgHost(url));
 			uni.previewImage({
 				urls: urlarr
-			})
+			});
 		},
 		favoritesStatus() {
 			this.$api.questionsystems(this.nowPageData.questionId).then(result => {
@@ -223,6 +236,7 @@ export default {
 					});
 				} else {
 					var data = {
+						bankId: self.bankId,
 						questionId: self.nowPageData.questionId
 					};
 					this.$api.questionsystemadd(data).then(res => {
@@ -262,8 +276,18 @@ export default {
 			this.initLint();
 			this.getCooieds();
 			this.favoritesStatus(self.nowPageData.questionId);
+			this.getBGCchange();
 			this.show = false;
 		},
+		//已做题目颜色变化
+		getBGCchange() {
+			var self = this;
+			this.answerList.forEach((item, index) => {
+				if (this.isWrites.indexOf(item.questionId) === -1) {
+					self.isWrites.push(item.questionId);
+				}
+			});
+		},
 		//数据清空
 		initDatas() {
 			this.isWrong = -1;
@@ -343,21 +367,88 @@ export default {
 				self.answerList[self.numIndex] = objList;
 			}
 			if (self.numIndex === self.list.length - 1) {
-				uni.showModal({
-					title: '提示',
-					content: '是否确定交卷',
-					success: function(res) {
-						if (res.confirm) {
-							self.carryOut();
-						} else if (res.cancel) {
-						}
-					}
-				});
+				self.changeTM(self.numIndex, 2);
+				self.carryOut();
 				return;
 			}
 			self.changeTM(self.numIndex, 1);
 		},
 		titleListFn(option) {
+			console.log(option)
+			var self = this;
+			if (option.sc === 'true') {
+				var data = {
+					bankId: self.bankId
+				};
+				self.$api.systemquestionList(data).then(res => {
+					if (res.data.rows.length) {
+						res.data.rows.forEach((items, indexs) => {
+							items.jsonStr = JSON.parse(items.jsonStr);
+						});
+						if (res.data.rows[self.numIndex].type === 4) {
+							self.replyL = [];
+							for (var i = 0; i < res.data.rows[self.numIndex].jsonStr.length; i++) {
+								self.replyL.push({ selectId: [] });
+							}
+						}
+						self.nowPageData = res.data.rows[self.numIndex];
+						self.favoritesStatus(res.data.rows[self.numIndex].questionId);
+						self.list = res.data.rows;
+					} else {
+						uni.showModal({
+							title: '提示',
+							content: '没有题目',
+							showCancel: false,
+							confirmText: '返回上级',
+							success: function(res) {
+								if (res.confirm) {
+									uni.navigateBack({
+										delta: 1
+									});
+								}
+							}
+						});
+					}
+				});
+				return;
+			}
+			if (option.ct === 'true') {
+				var data = {
+					bankId: self.bankId
+				};
+				self.$api.questionListrecord(data).then(res => {
+					if (res.data.rows.length) {
+						res.data.rows.forEach((items, indexs) => {
+							items.jsonStr = JSON.parse(items.jsonStr);
+						});
+						if (res.data.rows[self.numIndex].type === 4) {
+							self.replyL = [];
+							for (var i = 0; i < res.data.rows[self.numIndex].jsonStr.length; i++) {
+								self.replyL.push({ selectId: [] });
+							}
+						}
+						self.nowPageData = res.data.rows[self.numIndex];
+						self.favoritesStatus(res.data.rows[self.numIndex].questionId);
+						self.list = res.data.rows;
+					} else {
+						uni.showModal({
+							title: '提示',
+							content: '没有题目',
+							showCancel: false,
+							confirmText: '返回上级',
+							success: function(res) {
+								if (res.confirm) {
+									uni.navigateBack({
+										delta: 1
+									});
+								}
+							}
+						});
+					}
+				});
+				return;
+			}
+
 			if (option.bankSectionId) {
 				var data = {
 					bankSectionId: option.bankSectionId
@@ -368,9 +459,24 @@ export default {
 					examId: option.examId
 				};
 			}
-			this.$api.questiondetailList(data).then(res => {
+			if (option.bankSectionId === undefined && option.examId === undefined) {
+				uni.showModal({
+					title: '提示',
+					content: '没有题目',
+					showCancel: false,
+					confirmText: '返回上级',
+					success: function(res) {
+						if (res.confirm) {
+							uni.navigateBack({
+								delta: 1
+							});
+						}
+					}
+				});
+				return;
+			}
+			self.$api.questiondetailList(data).then(res => {
 				if (res.data.rows.length) {
-					let self = this;
 					res.data.rows.forEach((items, indexs) => {
 						items.jsonStr = JSON.parse(items.jsonStr);
 					});
@@ -509,69 +615,85 @@ export default {
 		//交卷
 		carryOut() {
 			var self = this;
-			var correct = 0;
-			var errorz = 0;
-			var answerListString = JSON.parse(JSON.stringify(this.answerList));
-			answerListString.forEach((item, index) => {
-				if (item.isRight !== undefined) {
-					if (item.isRight === 1) {
-						correct++;
-					} else {
-						errorz++;
-					}
-				}
-				item.selectIds = item.selectIds.toString();
-				item.replyStr.forEach((items, indexs) => {
-					if (items.selectId) {
-						items.selectId = items.selectId.toString();
-					}
+			if (this.isWrites.length !== this.list.length) {
+				uni.showModal({
+					title: '提示',
+					content: '请完成所有作答再交卷',
+					showCancel: false,
+					success: function(res) {}
 				});
-				item.replyStr = JSON.stringify(item.replyStr);
-			});
-			var data = {
-				bankId: this.bankId,
-				type: this.typeId,
-				answerList: answerListString
-			};
-			if (this.examId !== null) {
-				data.examId = this.examId;
-			}
-			if (this.simulateId !== null) {
-				data.simulateId = this.bankSectionId;
+				return;
 			}
-			this.$api.questiondetailrecord(data).then(res => {
-				if (res.data.code === 200) {
-					// uni.showModal({
-					// 	title: '提示',
-					// 	content: '提交成功返回上级',
-					// 	showCancel: false,
-					// 	confirmText: '返回上级',
-					// 	success: function(ress) {
-					// 		if (ress.confirm) {
-					// 			uni.navigateBack({
-					// 				delta: 1
-					// 			});
-					// 		}
-					// 	}
-					// });
-					var num = 0;
-					self.list.forEach((item, index) => {
-						if (item.type !== 4) {
-							num++;
+			uni.showModal({
+				title: '提示',
+				content: '是否确定交卷',
+				success: function(res) {
+					if (res.confirm) {
+						var correct = 0;
+						var errorz = 0;
+						var answerListString = JSON.parse(JSON.stringify(self.answerList));
+						answerListString.forEach((item, index) => {
+							if (item.isRight !== undefined) {
+								if (item.isRight === 1) {
+									correct++;
+								} else {
+									errorz++;
+								}
+							}
+							item.selectIds = item.selectIds.toString();
+							item.replyStr.forEach((items, indexs) => {
+								if (items.selectId) {
+									items.selectId = items.selectId.toString();
+								}
+							});
+							item.replyStr = JSON.stringify(item.replyStr);
+						});
+						var data = {
+							bankId: self.bankId,
+							type: self.typeId,
+							answerList: answerListString
+						};
+						if (self.examId !== null) {
+							data.examId = self.examId;
 						}
-					});
-					uni.redirectTo({
-						url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${self.typeId}&allIndex=${num}&correct=${correct}&error=${errorz}`
-					});
-				} else {
-					uni.showToast({
-						title: '提交失败',
-						icon: 'none',
-						duration: 2000
-					});
+						if (self.simulateId !== null) {
+							data.simulateId = self.bankSectionId;
+						}
+						if (self.sc === 'true') {
+							var num = 0;
+							self.list.forEach((item, index) => {
+								if (item.type !== 4) {
+									num++;
+								}
+							});
+							uni.redirectTo({
+								url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${self.typeId}&allIndex=${num}&correct=${correct}&error=${errorz}`
+							});
+						} else {
+							self.$api.questiondetailrecord(data).then(res => {
+								if (res.data.code === 200) {
+									var num = 0;
+									self.list.forEach((item, index) => {
+										if (item.type !== 4) {
+											num++;
+										}
+									});
+									uni.redirectTo({
+										url: `/pages2/bank/endBG?bankId=${self.bankId}&type=${self.typeId}&allIndex=${num}&correct=${correct}&error=${errorz}`
+									});
+								} else {
+									uni.showToast({
+										title: '提交失败',
+										icon: 'none',
+										duration: 2000
+									});
+								}
+							});
+						}
+					} else if (res.cancel) {
+					}
 				}
 			});
-			console.log(data);
 		}
 	}
 };
@@ -655,6 +777,10 @@ export default {
 .banksChiList > .bankTie > image {
 	max-width: 95%;
 }
+.btn_bac3 {
+	background: #4d6dbd;
+	color: #fff;
+}
 .btn_bac2 {
 	background: #32467b;
 	color: #fff;