Tang před 3 roky
rodič
revize
4af64f9056
1 změnil soubory, kde provedl 68 přidání a 13 odebrání
  1. 68 13
      pages2/bank/questionBank.vue

+ 68 - 13
pages2/bank/questionBank.vue

@@ -316,7 +316,7 @@
 							{{ collectList[bankIndex] ? '已收藏' : '未收藏' }}
 						</view>
 						<view @click="openFooterTab">答题卡</view>
-						<view @click="submit">交卷</view>
+						<view @click="pdsubmit">交卷</view>
 					</view>
 				</view>
 			</swiper-item>
@@ -382,10 +382,28 @@
 		<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">出淤泥而不染,濯清涟而不妖</view>
-				<view class="classFootsty">
-					<view class="btnsty btns1" @click="showpopups=false">暂不交卷</view>
-					<view class="btnsty btns2">立即交卷</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="submit">立即交卷</view>
+					<view class="btnsty btns2" @click="showpopups = false">继续做题</view>
 				</view>
 			</view>
 		</u-popup>
@@ -396,7 +414,7 @@
 export default {
 	data() {
 		return {
-			showpopups: true,
+			showpopups: false,
 			id: '',
 			current: 0,
 			questionList: [],
@@ -420,7 +438,8 @@ export default {
 			isLastCount: false, //是否有未答题目
 			lastCount: 0, //剩余没有回答的题目数
 			chapterId: 0,
-			moduleId: 0
+			moduleId: 0,
+			cgType: 0 //对应设计稿弹窗编码
 		};
 	},
 	onLoad(option) {
@@ -488,10 +507,19 @@ export default {
 		 */
 		clickLeft() {
 			if (this.bankType == 1) {
-				this.needBack = false;
-				uni.navigateBack({
-					delta: 1
-				});
+				let ansCount = this.questionOverNum(); //已答题数
+				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 if (this.bankType == 2) {
 				let ansCount = this.questionOverNum(); //已答题数
 				this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
@@ -505,6 +533,15 @@ export default {
 				}
 			}
 		},
+		/**
+		 * 返回上一页
+		 */
+		backPages() {
+			this.needBack = false;
+			uni.navigateBack({
+				delta: 1
+			});
+		},
 		/**
 		 * 获取已经回答的题目数
 		 */
@@ -517,6 +554,7 @@ export default {
 					}
 				} else if (item.type == 4) {
 					//案例题
+					console.log(item.jsonStr)
 					let isOver = item.jsonStr.every(jsonItem => {
 						if (jsonItem.type == 1 || jsonItem.type == 2 || jsonItem.type == 3) {
 							if (jsonItem.ques) {
@@ -535,6 +573,7 @@ export default {
 
 					if (isOver) {
 						count++;
+						console.log(item,444)
 					}
 				} else if (item.type == 5) {
 					//简答题
@@ -622,6 +661,7 @@ export default {
 		 * 立即交卷
 		 */
 		submitNow() {
+			this.showpopups = false;
 			this.needBack = false;
 			this.submit();
 		},
@@ -762,8 +802,10 @@ export default {
 								let ansArr = [];
 								item.jsonStr.forEach((json, index) => {
 									if (json.type == 1) {
+										json.ques = []
 										ansArr[index] = json.answerQuestion;
 									} else if (json.type == 2) {
+										json.ques = []
 										json.optionsList.forEach(str => {
 											str.optionsId = '' + str.optionsId;
 										});
@@ -773,6 +815,7 @@ export default {
 										});
 										ansArr[index] = arr;
 									} else if (json.type == 3) {
+										json.ques = []
 										ansArr[index] = json.answerQuestion;
 									} else if (json.type == 5) {
 										ansArr[index] = {
@@ -983,7 +1026,19 @@ export default {
 					}
 				});
 		},
-
+		pdsubmit(){
+			if (this.bankType == 1) {
+				let ansCount = this.questionOverNum(); //已答题数
+				this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
+				//没有答完
+				if (this.lastCount !== 0) {
+					this.cgType = 6;
+					this.showpopups = true;
+					return
+				}
+			}
+			this.submit()
+		},
 		/**
 		 * 提交数据
 		 */
@@ -1787,7 +1842,7 @@ export default {
 	color: #333;
 	font-size: 30rpx;
 }
-.textStys{
+.textStys {
 	width: 100%;
 	flex: 1;
 	padding: 36rpx;