Browse Source

考试相关

wangxy 3 months ago
parent
commit
fafe22a037
4 changed files with 260 additions and 63 deletions
  1. 1 1
      api/exam.js
  2. 1 1
      components/scroll-list-card/scroll-list-card.vue
  3. 217 58
      pages/exam/exam.vue
  4. 41 3
      pages/exam/index.vue

+ 1 - 1
api/exam.js

@@ -118,7 +118,7 @@ export function getClientKsSubmit(data = {}) {
     timeout: 20000
   })
 }
-
+// 不存在
 export function getClientUserInfo(data = {}) {
   return request({
     url: '/app/kaoshi/user/info',

+ 1 - 1
components/scroll-list-card/scroll-list-card.vue

@@ -26,7 +26,7 @@
     <template v-for="item in btns" :key="item.status">
       <button
         class="lli-btn"
-        @click="btnClick(item)"
+        @click="btnClick(data)"
         v-if="item.show"
         :key="item.status"
         :disabled="data.disabled"

+ 217 - 58
pages/exam/exam.vue

@@ -10,12 +10,10 @@
 			<view v-if="activeSt" class="title-types">{{dlName}}</view>
 			<!--  倒计时 -->
 			<view v-if="!!data.endSecond">
-				<uni-countdown :show-day="false" :showHour="true" :showMinute="true" :second="data.endSecond" @timeup="onTimeUp"
-					:start="startCountDown"></uni-countdown>
+				<uni-countdown :show-day="false" :showHour="true" :showMinute="true" :second="data.endSecond"
+					@timeup="onTimeUp" :start="startCountDown"></uni-countdown>
 			</view>
 		</view>
-
-
 		<view class="kaoshi-shiti-content">
 			<!-- 内容区域 -->
 			<!-- 试题区域 -->
@@ -36,6 +34,14 @@
 					<!-- 填空 -->
 					<tiankong :question="activeSt" :key="activeSt.stId"></tiankong>
 				</template>
+				<template v-if="activeSt.stTypeId == 5">
+					<!-- 简答 -->
+					<jianda :question="activeSt" :key="activeSt.stId"></jianda>
+				</template>
+				<template v-if="activeSt.stTypeId == 6">
+					<!-- 阅读 -->
+					<yuedu :question="activeSt" :key="activeSt.stId"></yuedu>
+				</template>
 			</view>
 
 		</view>
@@ -81,21 +87,21 @@
 			</view>
 		</uni-popup>
 		<!-- 摄像头确认 -->
-	<!-- 	<zhuapaiConfirm ref="zhuapaiConfirmRef" @success="zpConfirmSuccess" @error="zpConfirmError" 
+		<!-- 	<zhuapaiConfirm ref="zhuapaiConfirmRef" @success="zpConfirmSuccess" @error="zpConfirmError" 
 			@cancel="zpConfirmCancel" key="1"></zhuapaiConfirm> -->
 		<template v-if="data.zhuapai && data.zhuapai > 0">
 			<!-- 抓拍 -->
 			<!-- <zhuapaiVue ref="zhuapaiRef" @error="zpError" @success="zpSuccess" key="2" @progress="onProgress"></zhuapaiVue> -->
 		</template>
-	
+
 		<!-- 切屏 -->
-	<!-- 	<qiepingVue ref="qiepingRef" @zhuapai="qpZhuapai" @forceSubmit="forceSubmit" @qiepingToast="qiepingToast"
+		<!-- 	<qiepingVue ref="qiepingRef" @zhuapai="qpZhuapai" @forceSubmit="forceSubmit" @qiepingToast="qiepingToast"
 			key="3"></qiepingVue> -->
 		<!-- 交卷确认 -->
 		<answerQueren ref="answerQrRef" @confirm="handleQuerenConfirm"></answerQueren>
 		<!-- 考试得分 -->
 		<submitScoreVue ref="subScoreRef" @confirm="handleScoreConfirm" @close="handleScoreClose"></submitScoreVue>
-		
+
 		<!-- 切屏确认弹窗 -->
 		<!-- <qiepingDlVue ref="qiepingDlRef" :content="messageContent" title="注意" okBtn="知道了"></qiepingDlVue> -->
 	</view>
@@ -122,6 +128,8 @@
 	import duoxuan from "@/components/questions/duoxuan.vue";
 	import tiankong from "@/components/questions/tiankong.vue";
 	import panduan from "@/components/questions/panduan.vue";
+	import jianda from "@/components/questions/jianda.vue";
+	import yuedu from "@/components/questions/yuedu.vue";
 	import {
 		useQuestionTools
 	} from "@/components/questions/useQuestionTools.js";
@@ -146,14 +154,13 @@
 	onLoad((option) => {
 		data.ksId = option.ksId;
 		data.zhuapai = option.zhuapai;
-		data.userKaozhengId = option.userKaozhengId;
-		data.from = option.from;
 		if (data.zhuapai && data.zhuapai != 0) {
 			// 考试前确认摄像头
 			nextTick(() => {
-				initBeforKaoshi();
+				// initBeforKaoshi();
 			})
 		} else {
+			console.log('初始化')
 			initKaoshi();
 		}
 	})
@@ -168,7 +175,7 @@
 	const subScoreRef = ref(null);
 	const messageContent = ref('');
 	const qiepingDlRef = ref(null);
-	
+
 	const timer1 = ref(null);
 
 	const data = reactive({
@@ -187,9 +194,8 @@
 		StListForSearch: [],
 		from: '',
 		hisId: '',
-		userKaozhengId: ''
 	})
-	
+
 	const markDB = ref([]);
 
 	const questionData = ref([]);
@@ -235,21 +241,21 @@
 			return false
 		}
 	});
-	
+
 
 	function handleScoreClose() {
 		handleBack()
 	}
-	
+
 	// 考试得分相关 start
 	function handleScoreConfirm() {
 		uni.redirectTo({
 			url: `/pages/client/Chengji/ksScoreShijuan?hisId=${data.hisId}&from=kaoshi`
 		})
 	}
-	
+
 	// 考试得分相关 end
-	
+
 	// 保存相关
 	function handleSave(showToast) {
 		if (timer1.value) {
@@ -257,13 +263,13 @@
 				title: '请勿连续保存',
 				icon: 'none'
 			})
-			return 
+			return
 		}
 		timer1.value = setTimeout(() => {
 			clearTimeout(timer1.value);
-		},10*1000);
+		}, 10 * 1000);
 		console.log(questionData.value)
-		
+
 		const result = []
 		const option = {
 			force: false,
@@ -281,7 +287,13 @@
 			})
 		})
 		// 保存试题答案
-		saveCacheKs(data.operId, {replyList:result, position: {dlIndex:progress.dlIndex, dtIndex: progress.dtIndex}})
+		saveCacheKs(data.operId, {
+			replyList: result,
+			position: {
+				dlIndex: progress.dlIndex,
+				dtIndex: progress.dtIndex
+			}
+		})
 		// 保存答题进度
 		ksApi.getClientKsSave(option).then(res => {
 			if (res.data && showToast) {
@@ -347,7 +359,7 @@
 	function handleQuerenConfirm() {
 		handleSubmit()
 	}
-	
+
 	function handleSubmit(force = false) {
 		const result = {
 			force,
@@ -363,7 +375,7 @@
 				result.replyList.push(opt)
 			})
 		})
-	
+
 		ksApi.getClientKsSubmit(result).then(res => {
 			if (res.code == 0) {
 				subScoreRef.value.showDialog(res.data);
@@ -373,7 +385,7 @@
 			}
 		})
 	}
-	
+
 	function onTimeUp() {
 		handleSubmit();
 	}
@@ -420,7 +432,9 @@
 		})
 		handleBack();
 	}
+
 	function zpConfirmSuccess() {
+		console.log('zpConfirmSuccess')
 		initKaoshi();
 	}
 
@@ -474,19 +488,20 @@
 
 	function answerCardItemClick(qa) {
 		const actQa = data.StListForSearch.find(item => item.stId == qa.stId);
+		console.log('actQa', actQa)
 		skipQuestion(actQa.dlIndex, actQa.dtIndex)
 
 	}
 
 	function handleBack() {
-		 const pages = getCurrentPages();
-		 if (pages.length>1) {
-			 uni.navigateBack()
-		 } else {
-			  history.back();
-		 }
-		
-		
+		const pages = getCurrentPages();
+		if (pages.length > 1) {
+			uni.navigateBack()
+		} else {
+			history.back();
+		}
+
+
 	}
 
 	function showAnswerCard() {
@@ -532,7 +547,7 @@
 			let order = 0; // 当前题型中第几题
 			for (const iDanxuan of duanluo.danxuan) {
 				iDanxuan.type = 'danxuan';
-				iDanxuan.marked = data.biaoji[iDanxuan.stId] ? true: false;
+				iDanxuan.marked = data.biaoji[iDanxuan.stId] ? true : false;
 				iDanxuan.onlyNum = uIndex + 1;
 				iDanxuan.order = order;
 				iDanxuan.iQa = iQa;
@@ -552,7 +567,7 @@
 			order = 0;
 			for (const iDuoxuan of duanluo.duoxuan) {
 				iDuoxuan.type = 'duoxuan';
-				iDuoxuan.marked = data.biaoji[iDuoxuan.stId] ? true: false;
+				iDuoxuan.marked = data.biaoji[iDuoxuan.stId] ? true : false;
 				iDuoxuan.onlyNum = uIndex + 1;
 				iDuoxuan.order = order;
 				paragraph.qas.push(iDuoxuan);
@@ -573,7 +588,7 @@
 			order = 0;
 			for (const iPanduan of duanluo.panduan) {
 				iPanduan.type = 'panduan';
-				iPanduan.marked = data.biaoji[iPanduan.stId] ? true: false;
+				iPanduan.marked = data.biaoji[iPanduan.stId] ? true : false;
 				iPanduan.onlyNum = uIndex + 1;
 				iPanduan.order = order;
 				paragraph.qas.push(iPanduan);
@@ -593,12 +608,12 @@
 			order = 0;
 			for (const iTiankong of duanluo.tiankong) {
 				iTiankong.type = 'tiankong';
-				iTiankong.marked = data.biaoji[iTiankong.stId] ? true: false;
+				iTiankong.marked = data.biaoji[iTiankong.stId] ? true : false;
 				iTiankong.onlyNum = uIndex + 1;
 				iTiankong.order = order;
 				paragraph.qas.push(iTiankong);
 				iTiankong.iQa = iQa;
-				iTiankong.reply = new Array(iTiankong.count).fill('');;
+				iTiankong.reply = new Array(iTiankong.count).fill('');
 				uIndex++;
 				order++;
 				iQa++;
@@ -611,10 +626,67 @@
 					onlyNum: iTiankong.onlyNum
 				})
 			}
+			order = 0;
+			for (const iJianda of duanluo.jianda) {
+				iJianda.marked = data.biaoji[iJianda.stId] ? true : false;
+				iJianda.type = 'jianda';
+				iJianda.onlyNum = uIndex + 1;
+				iJianda.order = order;
+				iJianda.iQa = iQa;
+				paragraph.qas.push(iJianda);
+				iJianda.reply = '';
+				uIndex++;
+				order++;
+				iQa++;
+
+				data.StListForSearch.push({
+					stId: iJianda.stId,
+					paragraphName: paragraph.name,
+					dlIndex: iDuanluo,
+					dtIndex: iJianda.iQa,
+					onlyNum: iJianda.onlyNum
+				})
+			}
+			order = 0;
+			for (const iYuedu of duanluo.yuedu) {
+				iYuedu.marked = data.biaoji[iYuedu.stId] ? true : false;
+				iYuedu.type = 'yuedu';
+				iYuedu.onlyNum = uIndex + 1;
+				iYuedu.order = order;
+				iYuedu.iQa = iQa;
+
+				if (iYuedu.duoxuan && iYuedu.duoxuan.length) {
+					iYuedu.duoxuan.map((qIt) => {
+						qIt.reply = qIt.reply || [];
+						return qIt
+					})
+				}
+				
+				if (iYuedu.tiankong && iYuedu.tiankong.length) {
+					iYuedu.tiankong.map((qIt) => {
+						qIt.reply = new Array(qIt.count).fill('');
+						return qIt;
+					}) ;
+				}
+
+
+
+				paragraph.qas.push(iYuedu);
+				iYuedu.reply = [];
+				uIndex++;
+				order++;
+				iQa++;
+
+				data.StListForSearch.push({
+					stId: iYuedu.stId,
+					paragraphName: paragraph.name,
+					dlIndex: iDuanluo,
+					dtIndex: iYuedu.iQa,
+					onlyNum: iYuedu.onlyNum
+				})
+			}
 			iDuanluo++;
 			questionData.value.push(paragraph)
-			console.log('1', questionData.value)
-			console.log('2', data.StListForSearch)
 		}
 	}
 
@@ -635,7 +707,10 @@
 	function formatKaoshiData() {
 		const historyData = getCacheKs(data.operId);
 		if (historyData) {
-			const { replyList ,position } = historyData;
+			const {
+				replyList,
+				position
+			} = historyData;
 			if (replyList) {
 				questionData.value.forEach(dl => {
 					dl.qas.forEach(st => {
@@ -647,7 +722,7 @@
 				progress.dlIndex = position.dlIndex;
 				progress.dtIndex = position.dtIndex;
 			}
-		
+
 		}
 	}
 
@@ -661,7 +736,6 @@
 	function initKaoshi() {
 		ksApi.getClientKsStart({
 			ksId: data.ksId,
-			userKaozhengId: data.userKaozhengId
 		}).then(res => {
 			const {
 				ksId,
@@ -683,7 +757,7 @@
 			data.ksName = ksName;
 			data.stTotal = stTotal;
 			data.stScore = stScore;
-			data.biaoji = biaoji ? JSON.parse(biaoji): {};
+			data.biaoji = biaoji ? JSON.parse(biaoji) : {};
 			data.endSecond = endSecond;
 			data.pageSize = pageSize;
 			data.toggleScreenFlag = toggleScreenFlag;
@@ -694,28 +768,113 @@
 			// 设置缓存
 			formatKaoshiData();
 			// 设置抓拍监听
-			
+
 			if (data.zhuapai && data.zhuapai > 0) {
 				zhuapaiRef.value.init({
 					zhuapai: zhuapai,
 					operId: operId
 				});
 			}
-			
+
 			// 设置切屏监听
-			qiepingRef.value.init({
-				zhuapaiFlag: true,
-				toggleScreenFlag: toggleScreenFlag,
-				toggleScreenSecond: toggleScreenSecond,
-				ksId: data.ksId
-			})
+			// qiepingRef.value.init({
+			// 	zhuapaiFlag: true,
+			// 	toggleScreenFlag: toggleScreenFlag,
+			// 	toggleScreenSecond: toggleScreenSecond,
+			// 	ksId: data.ksId
+			// })
 
-			uni.setNavigationBarTitle({
-				title: data.ksName
-			});
 			startCountDown.value = true;
 		}).catch(err => {
-      handleBack()
-    })
+			console.log('asdasd', err)
+			// handleBack()
+		})
+	}
+</script>
+
+<style lang="scss">
+	.phone-kaoshi-page {
+		display: flex;
+		flex-direction: column;
+		background-color: #f4f6fa;
+		position: relative;
+
+		.kaoshi-page-title {
+			height: 80rpx;
+			line-height: 80rpx;
+			background-color: #fff;
+			margin-top: 20rpx;
+			font-size: 26rpx;
+			color: #333;
+			display: flex;
+			justify-content: space-between;
+			padding: 0 24rpx;
+			border-bottom: 1rpx solid #ebebeb;
+
+			.title-types {
+				font-size: 32rpx;
+				color: #000;
+			}
+		}
+
+		.kaoshi-shiti-content {
+			padding: 24rpx 24rpx 0 24rpx;
+			background-color: #fff;
+			flex: 1;
+		}
+
+		.kaoshi-bottom-box {
+			width: 100%;
+			height: 100rpx;
+			background-color: #f0f0f0;
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			padding: 0 24rpx;
+			box-sizing: border-box;
+			position: fixed;
+			bottom: var(--window-bottom);
+
+			.bj-btn,
+			.jx-btn,
+			.save-btn {
+				height: 60rpx;
+				line-height: 58rpx;
+				box-sizing: border-box;
+			}
+
+			.bj-btn {
+				margin-left: unset;
+			}
+
+			.jx-btn,
+			.save-btn {
+				margin-right: unset;
+			}
+
+			.shiti-num-icon {
+				width: 27px;
+				height: 24px;
+				vertical-align: middle;
+				// background-image: url("@/static/images/exam/shiti-num-icon.png");
+				@include ezy-no-repeat-cover();
+			}
+
+			.active-num {
+				color: #30c190;
+			}
+		}
+
+		.ks-btn-prev {
+			position: fixed;
+			bottom: 130rpx;
+			left: 24rpx;
+		}
+
+		.ks-btn-next {
+			position: fixed;
+			bottom: 130rpx;
+			right: 24rpx;
+		}
 	}
-</script>
+</style>

+ 41 - 3
pages/exam/index.vue

@@ -31,9 +31,47 @@
 	]
 	
 	function handleClick(data) {
-		uni.redirectTo({
-			url: '/pages/exam/exam'
-		})
+		console.log('data', data)
+		if (data.status == 0) {
+			// 未开始
+			uni.redirectTo({
+				url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
+			})
+		}
+		if (data.status == 1) {
+			// 可以考试
+			uni.redirectTo({
+				url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
+			})
+		}
+		if (data.status == 2) {
+			// 再次考试
+			uni.redirectTo({
+				url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
+			})
+		}
+		if (data.status == 3) {
+			// 考试中
+			uni.redirectTo({
+				url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
+			})
+		}
+		if (data.status == 4) {
+			// 已结束
+		}
+		if (data.status == 5) {
+			// 未报名
+		}
+		if (data.status == 6) {
+			// 报名审核中
+		}
+		if (data.status == 7) {
+			// 审核未通过
+		}
+		if (data.status == 8) {
+			// 等待人工评分
+		}
+
 	}
 </script>