chenxiong 3 yıl önce
ebeveyn
işleme
ede9a01581

+ 2 - 1
pages.json

@@ -356,7 +356,8 @@
 			{
 				"path": "bank/questionBankExplain",
 				"style": {
-					"navigationBarTitleText": "试卷解析",
+					"navigationBarTitleText": "试卷",
+					"navigationStyle": "custom", // 隐藏系统导航栏
 					"app-plus": {
 						"titleNView": false, //禁用原生导航栏 
 						"bounce": "none"

+ 2 - 2
pages2/bank/questionBank.vue

@@ -430,7 +430,7 @@
 					<view class="btnsty btns2" @click="backPages">结束做题</view>
 				</view>
 				<view class="classFootsty" v-if="cgType === 8">
-					<view class="btnsty btns1" @click="leaveNow()">下次继续</view>
+					<view class="btnsty btns1" @click="backPages()">下次继续</view>
 					<view class="btnsty btns2" @click="showpopups = false">继续作答</view>
 				</view>
 			</view>
@@ -451,7 +451,7 @@ export default {
 			ans: [],
 			ques: [],
 			show: false,
-			showDialog: true,
+			showDialog: false,
 			bankList: [],
 			collectList: [],
 			goodsId: '',

+ 350 - 4
pages2/bank/questionBankExplain.vue

@@ -1,5 +1,6 @@
 <template>
 	<view id="questionBank">
+		<uni-nav-bar @clickLeft="clickLeft" left-icon="back" :statusBar="true" title="试卷"></uni-nav-bar>
 		<swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
 			<swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">
 				<view class="pageContent">
@@ -317,7 +318,7 @@
 							</view>
 							答题卡
 						</view>
-						<view class="collect"  :class="{ show: explain ? false : true }" @click="submit">
+						<view class="collect"  :class="{ show: explain ? false : true }" @click="pdsubmit">
 							<view>
 								<image src="/static/jj.png" mode=""></image>
 								<view>交卷</view>
@@ -348,6 +349,35 @@
 			<view class="text">左右滑动切换上下题</view>
 			<view class="btn" @click="hideDialog">我知道了</view>
 		</view>
+		
+		<u-popup v-model="showpopups" mode="center" border-radius="24" height="439rpx" width="640rpx" :mask-close-able="false">
+			<view class="popboxs">
+				<view class="classTops">温馨提示</view>
+				<view class="textStys">
+					{{
+						cgType === 7
+							? '您还未交卷,确定结束做题吗?'
+							: cgType === 8
+							? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
+							: cgType === 6
+							? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
+							: ''
+					}}
+				</view>
+				<view class="classFootsty" v-if="cgType === 6">
+					<view class="btnsty btns1" @click="submit">立即交卷</view>
+					<view class="btnsty btns2" @click="showpopups = false">继续做题</view>
+				</view>
+				<view class="classFootsty" v-if="cgType === 7">
+					<view class="btnsty btns1" @click="showpopups = false">下次继续</view>
+					<view class="btnsty btns2" @click="backPages">结束做题</view>
+				</view>
+				<view class="classFootsty" v-if="cgType === 8">
+					<view class="btnsty btns1" @click="backPages()">下次继续</view>
+					<view class="btnsty btns2" @click="showpopups = false">继续作答</view>
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -357,21 +387,25 @@ export default {
 		return {
 			id:'',
 			current:0,
+			showpopups:false,
 			questionList:[],
 			ast: ['A', 'B', 'C', 'D','E','F','G'],
 			judge:['错误','正确'],
 			show: false,
-			showDialog:true,
+			showDialog:false,
 			bankList: [],
 			collectList:[],
 			goodsId:'',
 			recordId:'',
 			explain:'',  	//是否显示答案
 			isContinue:'',  //是否继续做题
+			isLastCount: false, //是否有未答题目
+			lastCount: 0, //剩余没有回答的题目数 
 			chapterId:'',
 			moduleId:'',
 			isHistory:'',  //是否显示历史答题记录
 			isSubmit:false,
+			cgType: 0 //对应设计稿弹窗编码
 		};
 	},
 	onLoad(option){
@@ -446,6 +480,102 @@ export default {
 			}
 			return;
 		},
+		/**
+		 * 点击后退按钮
+		 */
+		clickLeft() {
+			if(this.isContinue) {
+				
+				let ansCount = this.questionOverNum(true); //已答题数
+				this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
+					
+				//所有题目答完
+				if (this.lastCount == 0) {
+					// this.testOver = true;
+					this.cgType = 7;
+					//未答完
+				} else {
+					this.cgType = 8;    
+					// this.isLastCount = true;
+				}
+				this.showpopups = true;   
+			} else {
+				uni.navigateBack({
+					delta:1
+				})
+			}
+			
+		},
+		/**
+		 * 获取已经回答的题目数
+		 * hasSpecail (是否包含简答和案例)
+		 */
+		questionOverNum(hasSpecail) {
+			let count = 0;
+			this.questionList.forEach(item => {
+				if (item.type == 1 || item.type == 2 || item.type == 3) {
+					if (item.ques) {
+						count++;
+					}
+				} else if (item.type == 4) {
+					//案例题
+					if(hasSpecail) {
+						
+						let isOver = item.jsonStr.every((jsonItem, indexs) => {
+							if (jsonItem.type == 1 || jsonItem.type == 2 || jsonItem.type == 3) {
+								if (item.ques[indexs]) {
+									return true;
+								} else {
+									return false;
+								}
+							} else if (jsonItem.type == 5) {
+								if (item.ques[indexs] && (item.ques[indexs].text.length || item.ques[indexs].imageList.length)) {
+									return true;
+								} else {
+									return false;
+								}
+							}
+						});
+						
+						if (isOver) {
+							count++;
+							console.log(item, 444);
+						}
+					}
+				} else if (item.type == 5) {
+					//简答题
+					if(hasSpecail) {
+						
+						if (item.ansText && (item.ansText.text.length || item.ansText.imageList.length)) {
+							count++;
+						}
+					}
+				}
+			});
+		
+			return count;
+		},
+		/**
+		 * 返回上一页
+		 */
+		backPages() {
+			uni.navigateBack({
+				delta: 1
+			});
+		},
+		pdsubmit() {
+			// if (this.bankType == 1) {
+				let ansCount = this.questionOverNum(true); //已答题数
+				this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
+				//没有答完
+				if (this.lastCount !== 0) {
+					this.cgType = 6;
+					this.showpopups = true;
+					return;
+				}
+			// } 
+			this.submit();
+		},
 		goodsQuestionList() {
 			//继续答题
 			if(this.isContinue || this.isHistory) {
@@ -779,7 +909,7 @@ export default {
 				}
 			})
 			
-			//大于60分及格
+			//大于及格
 			if(score >= passScore) {
 				reportStatus = 1
 			} else {
@@ -864,6 +994,178 @@ export default {
 			this.$set(this.questionList[bindex].ques,ansindex,childindex+'')
 		},
 		
+		/**
+		 * 立即离开并交卷
+		 */
+		leaveNow() {
+			this.needBack = false;
+			this.isSubmit = true;
+			uni.navigateBack({
+				delta: 1
+			});
+			let score = 0; //计算总分
+			let reportStatus = 0;
+			let number = 0;  //做对的题目数量
+			let doQuestionNum = 0;  //做过的题目数量
+			let allScore = 0;  //总分
+			let passScore = 0;
+			let doWrongQuestionIds = []; //错题和未做题id(客观题)
+			let doQuestionIds = []; //做过的题目id
+			let rightQuestionIds = []; //做对的题目id
+			this.questionList.forEach((item, index) => {
+				// passScore = item.passScore
+				if (item.type == 1) {
+					//正确
+					if (item.ques == item.ans) {
+						item.scoreResult = item.score;
+						score += item.score;
+						number++;
+						rightQuestionIds.push(item.questionId)
+					} else { //错误
+						item.scoreResult = 0;
+						doWrongQuestionIds.push(item.questionId)
+					}
+					allScore += item.score;
+					if (item.ques) {
+						doQuestionNum++;
+						doQuestionIds.push(item.questionId)
+					}
+				} else if (item.type == 2) {
+					let isRight =
+						item.ans &&
+						item.ans.every((quesItem, quesIndex) => {
+							if(item.ques) {
+								return item.ques[quesIndex] == item.ans[quesIndex];
+							} else {
+								return false;
+							}
+							
+						});
+			
+					if (isRight) {
+						score += item.score;
+						number++;
+						item.scoreResult = item.score;
+						rightQuestionIds.push(item.questionId)
+					} else {
+						let checkboxScore = item.score;  //获取单题总分数
+						item.ques && item.ques.forEach((ques,quesIndex) => {
+							//选错一个全扣
+							if(item.ques) {
+								if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
+									checkboxScore = 0;
+								} 
+							} else {
+								checkboxScore = 0;
+							}
+						})
+						console.log(checkboxScore)
+						
+						//没选错
+						if(checkboxScore) {
+							
+							item.ans.forEach((ans,quesIndex) => {
+								//漏选扣一部分
+								if(item.ques) {
+									
+									if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
+										checkboxScore -= item.partScore;
+									}
+								} else {
+									checkboxScore = 0;
+								}
+							})
+						}
+						
+						
+						if(checkboxScore <= 0) { //0分
+							item.scoreResult = 0;
+							doWrongQuestionIds.push(item.questionId)
+						} else { //部分分
+							number++;
+							item.scoreResult = checkboxScore;
+							score += checkboxScore;
+							rightQuestionIds.push(item.questionId)
+						}
+					}
+					allScore += item.score;
+					if (item.ques && item.ques.length) {
+						doQuestionNum++;
+						doQuestionIds.push(item.questionId)
+					}
+				} else if (item.type == 3) {
+					if (item.ques == item.ans) {
+						item.scoreResult = item.score;
+						score += item.score;
+						number++;
+						rightQuestionIds.push(item.questionId)
+					} else {
+						item.scoreResult = 0;
+						doWrongQuestionIds.push(item.questionId)
+					}
+					allScore += item.score;
+					if (item.ques) {
+						doQuestionNum++;
+						doQuestionIds.push(item.questionId)
+					}
+				} else if (item.type == 4) {
+					if (item.ques && item.ques.length) {
+						doQuestionNum++;
+					}
+				} else if (item.type == 5) {
+					if (item.ques) {
+						doQuestionNum++;
+					}
+				}
+			});
+			
+			//大于60分及格
+			if(score >= 60) {
+				reportStatus = 1
+			} else {
+				reportStatus = 0
+			}
+			
+			//交卷
+			this.$api
+				.examRecordEdit({
+					examId: this.id,
+					goodsId: this.goodsId,
+					reportStatus:reportStatus,
+					recordId: this.recordId,
+					rightQuestionNum: number,
+					status: 1,
+					moduleExamId:this.moduleId || 0,
+					chapterExamId:this.chapterId || 0,
+					doQuestionIds:doQuestionIds.join(','),
+					rightQuestionIds:rightQuestionIds.join(','),
+					doQuestionNum: doQuestionNum,
+					performance: score,
+					totalScore: allScore,
+					examTime: parseInt(this.allTimes),
+					doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
+					historyExamJson: JSON.stringify(this.questionList)
+				})
+				.then(res => {
+					this.isSubmit = true;
+					if (res.data.code == 200) {
+						
+					}
+				});
+				
+				//错题集id提交(客观题)
+				this.$api.examWrongRecord({
+						moduleExamId:this.moduleId || 0,
+						chapterExamId:this.chapterId || 0,
+						examId: this.id,
+						goodsId: this.goodsId,
+						questionIds: doWrongQuestionIds,
+						recordId: this.recordId
+					}).then(res => { 
+						
+					});
+		},
+		
 		openFooterTab() {
 			this.show = true;
 		},
@@ -1141,7 +1443,7 @@ export default {
 <style lang="scss" scoped>
 .swiper {
 	width:100%;
-	height:100vh;
+	height: calc(100vh - 65px);
 }
 .lisSty {
 	margin-bottom: 16rpx;
@@ -1541,4 +1843,48 @@ export default {
 		font-size: 32rpx;
 	}
 }
+.popboxs {
+	width: 100%;
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	align-items: center;
+}
+.classTops {
+	flex-shrink: 0;
+	padding: 39rpx 0rpx 4rpx;
+	font-weight: bold;
+	color: #333;
+	font-size: 30rpx;
+}
+.textStys {
+	width: 100%;
+	flex: 1;
+	padding: 36rpx;
+}
+.classFootsty {
+	flex-shrink: 0;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	padding: 10rpx 0rpx 40rpx;
+	.btnsty {
+		width: 200rpx;
+		height: 80rpx;
+		border-radius: 40rpx;
+		font-weight: bold;
+		font-size: 30rpx;
+		text-align: center;
+		line-height: 80rpx;
+	}
+	.btns1 {
+		background-color: #f5f5f5;
+		color: #007aff;
+	}
+	.btns2 {
+		margin-left: 40rpx;
+		background-color: #007aff;
+		color: #ffffff;
+	}
+}
 </style>

+ 1 - 1
pages2/bank/questionBankExplainDetail.vue

@@ -366,7 +366,7 @@ export default {
 			ast: ['A', 'B', 'C', 'D','E','F','G'],
 			judge:['错误','正确'],
 			show: false,
-			showDialog:true,
+			showDialog:false,
 			bankList: [],
 			collectList:[],
 			goodsId:'',

+ 46 - 8
pages2/bank/questionBankTest.vue

@@ -1,7 +1,7 @@
 <template>
 	<view id="questionBank">
 		<swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
-			<swiper-item v-for="(bank,bankIndex) in newQuestionList" :key="bankIndex">
+			<swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">
 				<view class="pageContent">
 					<view class="pad_8 titBox" >
 						<view class="firstLetter">
@@ -347,11 +347,10 @@ export default {
 			id:'',
 			current:0,
 			questionList:[],
-			newQuestionList:[],
 			ast: ['A', 'B', 'C', 'D','E','F','G'],
 			judge:['错误','正确'],
 			show: false,
-			showDialog:true,
+			showDialog:false,
 			bankList: [],
 			collectList:[],
 			goodsId:'',
@@ -455,9 +454,7 @@ export default {
 				})
 				
 				this.questionList = res.data.data;
-				this.newQuestionList = this.questionList.filter((item,index) => {
-					return index < this.num
-				})
+				
 				
 			})
 		},
@@ -553,17 +550,58 @@ export default {
 			this.show = true;
 		},
 		hideDialog() {
-			this.showDialog = false
-		},
+			this.showDialog = false; 
+		}, 
 		changeIndex(index) {
 			if(index <= (this.num-1)) {
 				this.current = index
+			} else {
+				uni.showModal({
+					title: '提示',
+					content: '试做题目已结束,够买题卷可作答所有题目',
+					cancelText:'返回详情',
+					cancelColor:'',
+					confirmText:'继续作答',
+					confirmColor:'',
+					success: (res) => {
+						if (res.confirm) {
+
+						} else if (res.cancel) {
+							uni.navigateBack({
+								delta:1
+							})
+							console.log('返回详情');
+						}
+					}
+				});
 			}
 			
 		},
 		
 		swiperChange(e) {
 			this.current = e.detail.current;
+
+			if(this.current > this.num -1) {
+				
+				uni.showModal({
+					title: '提示',
+					content: '试做题目已结束,够买题卷可作答所有题目',
+					cancelText:'返回详情',
+					cancelColor:'',
+					confirmText:'继续作答',
+					confirmColor:'',
+					success: (res) => {
+						if (res.confirm) {
+							this.current = this.num - 1;
+						} else if (res.cancel) {
+							uni.navigateBack({
+								delta:1
+							})
+							console.log('返回详情');
+						}
+					}
+				});
+			}
 		},
 		
 		/**

+ 1 - 1
pages2/class/questionBank.vue

@@ -466,7 +466,7 @@ export default {
 			ans: [],
 			ques: [],
 			show: false,
-			showDialog: true,
+			showDialog: false,
 			bankList: [],
 			collectList: [],
 			goodsId: '',

+ 1 - 1
pages2/subject/collectBank.vue

@@ -338,7 +338,7 @@ export default {
 			ast: ['A', 'B', 'C', 'D','E','F','G'],
 			judge:['错误','正确'],
 			show: false,
-			showDialog:true,
+			showDialog:false,
 			bankList: [],
 			collectList:[],
 			goodsId:'',

+ 1 - 1
pages2/subject/collectTypeBank.vue

@@ -338,7 +338,7 @@ export default {
 			ast: ['A', 'B', 'C', 'D','E','F','G'],
 			judge:['错误','正确'],
 			show: false,
-			showDialog:true,
+			showDialog:false,
 			bankList: [],
 			collectList:[],
 			type:'',

+ 1 - 1
pages2/subject/wrongBank.vue

@@ -344,7 +344,7 @@ export default {
 			ast: ['A', 'B', 'C', 'D','E','F','G'],
 			judge:['错误','正确'],
 			show: false,
-			showDialog:true,
+			showDialog:false,
 			isFromReport:'',  //来自答题报告
 			bankList: [],
 			collectList:[],

+ 1 - 1
pages2/subject/wrongTypeBank.vue

@@ -343,7 +343,7 @@ export default {
 			ast: ['A', 'B', 'C', 'D','E','F','G'],
 			judge:['错误','正确'],
 			show: false,
-			showDialog:true,
+			showDialog:false,
 			bankList: [],
 			collectList:[],
 			type:'',