wangguoyu 4 tygodni temu
rodzic
commit
addcf13417

+ 12 - 0
api/chengji.js

@@ -22,3 +22,15 @@ export function getKcchengjiList(data = {}) {
 		timeout: 20000
 	})
 }
+
+export function lookChengjiView(data = {}) {
+	return request({
+		'url': '/app/chengji/view',
+		headers: {
+			isToken: true
+		},
+		method: 'post',
+		data,
+		timeout: 20000
+	})
+}

+ 85 - 0
components/questionsChengji/danxuan.vue

@@ -0,0 +1,85 @@
+<template>
+	<view v-if="question" class="phone-danxuan-box">
+		<view class="phone-shiti-question">
+			<view class="question-num">{{question.onlyNum}}、</view>
+			<!-- 题干区域 -->
+			<rich-text :nodes="data.name"></rich-text>
+		</view>
+		
+		<!-- 选项区域 -->
+		<view v-for="(item,index) in data.contents" class="danxuan-option-box" :class="formatClass(index)" :key="index">
+			<text class="option-change"  @click="onSelect(index)">{{item.number}}</text>
+			<rich-text :nodes="item.label" class="option-question"></rich-text>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		ref,
+		reactive,
+		watch
+	} from 'vue';
+	import {
+		useQuestionTools
+	} from "./useQuestionTools"
+	const {
+		getLetterByIndex
+	} = useQuestionTools();
+
+	const props = defineProps({
+		question: {
+			type: Object,
+		},
+		showError: {
+			type: Boolean,
+			default: false
+		}
+	})
+
+	const data = reactive({
+		name: '', //题干数据
+		contents: [], // 选项数据
+	})
+
+	watch(() => props.question, (val) => formatData(val), {
+		immediate: true
+	})
+
+	function formatClass(index) {
+		if (props.showError) {
+			return {
+				active_right: props.question.result == index,
+				showError: props.question.reply == index && props.question.result != index
+			}
+		} else {
+			  if (props.question.reply === ''||props.question.reply === null ) {
+				return {
+				  active: false
+				}
+			  }
+			return {
+				active: props.question.reply == index
+			}
+		}
+	}
+
+	function formatData(val) {
+		if (val) {
+			data.name = val.name;
+			data.contents = val.content.map((item, index) => {
+				return {
+					label: item,
+					number: getLetterByIndex(index)
+				}
+			})
+		}
+	}
+
+	function onSelect(index) {
+		if (props.showError) {
+			return;
+		}
+		props.question.reply = index;
+	}
+</script>

+ 87 - 0
components/questionsChengji/duoxuan.vue

@@ -0,0 +1,87 @@
+<template>
+	<view v-if="question" class="phone-duoxuan-box">
+		<view class="phone-shiti-question">
+			<view class="question-num">{{question.onlyNum}}、</view>
+			<!-- 题干区域 -->
+			<rich-text :nodes="data.name"></rich-text>
+		</view>
+		<!-- 选项区域 -->
+		<view v-for="(item,index) in data.contents" class="duoxuan-option-box" :class="formatClass(index)" :key="index">
+			<text class="option-change" @click="onSelect(index)">{{item.number}}</text>
+			<rich-text :nodes="item.label" class="option-question"></rich-text>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		ref,
+		reactive,
+		watch
+	} from 'vue';
+	import {
+		useQuestionTools
+	} from "./useQuestionTools"
+	const {
+		getLetterByIndex,
+		haveSameElements
+	} = useQuestionTools();
+
+	const props = defineProps({
+		question: {
+			type: Object,
+		},
+		showError: {
+			type: Boolean,
+			default: false
+		}
+	})
+
+	const data = reactive({
+		name: '', //题干数据
+		contents: [], // 选项数据
+	})
+
+	watch(() => props.question, (val) => formatData(val), {
+		immediate: true
+	})
+
+
+	function formatClass(index) {
+		if (props.showError) {
+			return {
+				active_right: props.question.result.some(item => item == index),
+				showError: !props.question.result.some(item => item == index)
+			}
+		} else {
+			return {
+				active: props.question.reply.some(item => item == index)
+			}
+		}
+	}
+
+	function formatData(val) {
+		if (val) {
+			data.name = val.name;
+			data.contents = val.content.map((item, index) => {
+				return {
+					label: item,
+					number: getLetterByIndex(index)
+				}
+			})
+		}
+	}
+
+	function onSelect(index) {
+		if (props.showError) {
+			return;
+		}
+		if (props.question.reply) {
+			if (props.question.reply.some(item => item == index)) {
+				props.question.reply = props.question.reply.filter(item => item != index);
+			} else {
+				props.question.reply.push(index);
+			}
+		}
+	}
+</script>

+ 23 - 0
components/questionsChengji/jianda.vue

@@ -0,0 +1,23 @@
+<template>
+	<view v-if="question" class="phone-jianda-box">
+		<view class="phone-shiti-question">
+			<view class="question-num">{{question.onlyNum}}、</view>
+			<!-- 题干区域 -->
+			<rich-text :nodes="question.name"></rich-text>
+		</view>
+		<!-- 选项区域 -->
+		<textarea class="jianda-textarea-box" placeholder="请输入内容" v-model="question.reply" />
+	</view>
+</template>
+
+<script setup>
+	const props = defineProps({
+		question: {
+			type: Object,
+		},
+		showError: {
+			type: Boolean,
+			default: false
+		}
+	})
+</script>

+ 52 - 0
components/questionsChengji/panduan.vue

@@ -0,0 +1,52 @@
+<template>
+	<view class="phone-panduan-box">
+		<view class="phone-shiti-question">
+			<view class="question-num">{{question.onlyNum}}、</view>
+			<!-- 题干区域 -->
+			<rich-text :nodes="question.name"></rich-text>
+		</view>
+		<!-- 选项区域 -->
+		<radio-group @change="radioChange" class="panduan-option-box">
+			<label class="option-question" :class="formatClass('1')">
+				<radio value="1" :disabled="showError" :checked="question.reply == '1'"/>
+				<view>正确</view>
+			</label>
+			<label class="option-question" :class="formatClass('0')"> 
+				<radio value="0" :disabled="showError" :checked="question.reply == '0'"/>
+				<view>错误</view>
+			</label>
+		</radio-group>
+	</view>
+</template>
+
+<script setup>
+	const props = defineProps({
+		question: {
+			type: Object,
+		},
+		showError: {
+			type: Boolean,
+			default: false
+		}
+	})
+
+	function radioChange(e) {
+		if (props.showError) {
+			return;
+		}
+		props.question.reply = e.detail.value;
+	}
+	
+	function formatClass(index) {
+		if (props.showError) {
+			return {
+				active_right: props.question.result == index,
+				showError: props.question.reply == index && props.question.result != index
+			}
+		} else {
+			return {
+				active: props.question.reply == index
+			}
+		}
+	}
+</script>

+ 35 - 0
components/questionsChengji/tiankong.vue

@@ -0,0 +1,35 @@
+<template>
+	<view v-if="question" class="phone-tiankong-box">
+		<view class="phone-shiti-question">
+			<view class="question-num">{{question.onlyNum}}、</view>
+			<!-- 题干区域 -->
+			<rich-text :nodes="question.name"></rich-text>
+		</view>
+		<!-- 选项区域 -->
+		<view v-for="(item,index) in question.reply" class="tiankong-option-box" :key="index" :class="formatClass(index)">
+			<text class="option-question">填空{{index+1}}:</text>
+			<input type="text" v-model="question.reply[index]" class="option-question-text" :placeholder="`请输入填空${index+1}答案`">
+		</view>
+	</view>
+</template>
+
+<script setup>
+	const props = defineProps({
+		question: {
+			type: Object,
+		},
+		showError: {
+			type: Boolean,
+			default: false
+		}
+	})
+
+	function formatClass(index) {
+		if (props.showError) {
+			return {
+				active_right: props.question.result[index].some(item => item == props.question.reply[index]?props.question.reply[index].trim(): ''),
+				showError: !props.question.result[index].some(item => item == props.question.reply[index]?props.question.reply[index].trim(): '')
+			}
+		}
+	}
+</script>

+ 126 - 0
components/questionsChengji/useQuestionTools.js

@@ -0,0 +1,126 @@
+export function useQuestionTools() {
+	function getLetterByIndex(index) {
+		let letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+		if (index < 0 || index > 26) {
+			return '?';
+		}
+		return letters.charAt(index);
+	}
+
+	// 判断两个数组是否具有相同元素
+	function haveSameElements(arr1, arr2) {
+		// 如果两个数组的长度不同,它们不可能包含相同的元素
+		if (arr1.length !== arr2.length) {
+			return false;
+		}
+
+		// 对两个数组进行排序
+		arr1.sort((a, b) => a - b);
+		arr2.sort((a, b) => a - b);
+
+		// 比较排序后的数组是否相同
+		for (let i = 0; i < arr1.length; i++) {
+			if (arr1[i] != arr2[i]) {
+				return false;
+			}
+		}
+
+		// 如果所有元素都相同,返回 true
+		return true;
+	}
+
+	function checkDanxuanReply(item) {
+		if (item.reply === 0 || item.reply === '0') {
+			return true
+		}
+		if (!item.reply || item.reply === '' || item.reply === [] || item.reply.length === 0) {
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+	function checkDuoxuanReply(item) {
+		if (!item.reply || item.reply === '' || item.reply === [] || item.reply.length === 0) {
+			return false;
+		} else {
+			for (const _item of item.reply) {
+				if (_item === '') {
+					return false;
+				}
+			}
+			return true;
+		}
+	}
+
+	function checkPanduanReply(item) {
+		if (!item.reply || item.reply === '' || item.reply === [] || item.reply.length === 0) {
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+	function checkTiankongReply(item) {
+		if (!item.reply || item.reply === '' || item.reply === [] || item.reply.length === 0) {
+			return false;
+		} else {
+			for (const _item of item.reply) {
+				if (_item === '') {
+					return false;
+				}
+			}
+			return true;
+		}
+	}
+
+	function checkJiandaReply(item) {
+		if (!item.reply || item.reply === '' || item.reply === [] || item.reply.length === 0) {
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+	function checkYueduReply(qa) {
+		console.log('qa =>',qa)
+		for (const iDanxuan of qa.danxuan) {
+			if (!checkDanxuanReply(iDanxuan)) {
+				return false;
+			}
+		}
+		for (const iDuoxuan of qa.duoxuan) {
+			if (!checkDuoxuanReply(iDuoxuan)) {
+				return false;
+			}
+		}
+		for (const iPanduan of qa.panduan) {
+			if (!checkPanduanReply(iPanduan)) {
+				return false;
+			}
+		}
+		for (const iTiankong of qa.tiankong) {
+			if (!checkTiankongReply(iTiankong)) {
+				return false;
+			}
+		}
+		for (const iJianda of qa.jianda) {
+			if (!checkJiandaReply(iJianda)) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	return {
+		getLetterByIndex,
+		haveSameElements,
+		checkDanxuanReply,
+		checkDuoxuanReply,
+		checkPanduanReply,
+		checkTiankongReply,
+		checkJiandaReply,
+		checkYueduReply
+	}
+}

+ 128 - 0
components/questionsChengji/yuedu.vue

@@ -0,0 +1,128 @@
+<template>
+	<view v-if="question" class="phone-yuedu-box">
+		<view class="phone-shiti-question">
+			<view class="question-num">{{question.onlyNum}}、</view>
+			<!-- 题干区域 -->
+			<rich-text :nodes="question.name"></rich-text>
+		</view>
+		<!-- 选项区域 -->
+		<swiper class="yuedu-swiper-box" @change="onSwitchChange" :current="swiperDotIndex">
+			<swiper-item v-for="(item,index) in data.content" :key="index" class="yuedu-swiper-content">
+				<template v-if="item.type == 'danxuan'">
+					<!-- 单选 -->
+				<danxuan :question="item" :key="item.stId"></danxuan>
+				</template>
+				<template v-if="item.type == 'duoxuan'">
+					<!-- 多选 -->
+					<duoxuan :question="item" :key="item.stId"></duoxuan>
+				</template>
+				<template v-if="item.type == 'panduan'">
+					<!-- 判断 -->
+					<panduan :question="item" :key="item.stId"></panduan>
+				</template>
+				<template v-if="item.type == 'tiankong'">
+					<!-- 填空 -->
+					<tiankong :question="item" :key="item.stId"></tiankong>
+				</template>
+				<template v-if="item.type == 'jianda'">
+					<!-- 简答 -->
+					<jianda :question="item" :key="item.stId"></jianda>
+				</template>
+			</swiper-item>
+		</swiper>
+	</view>
+</template>
+
+<script setup>
+	import {
+		reactive,
+		watch,
+		ref,
+		computed
+	} from 'vue';
+	import danxuan from "@/components/questionsChengji/danxuan.vue";
+	import duoxuan from "@/components/questionsChengji/duoxuan.vue";
+	import tiankong from "@/components/questionsChengji/tiankong.vue";
+	import panduan from "@/components/questionsChengji/panduan.vue";
+	import jianda from "@/components/questionsChengji/jianda.vue";
+import cacheManager from '../../utils/cacheManager';
+	const props = defineProps({
+		question: {
+			type: Object,
+		},
+		showError: {
+			type: Boolean,
+			default: false
+		},
+		showTishixinxi: {
+			type:Boolean,
+			default: false,
+		}
+	})
+	const data = reactive({
+		content: []
+	})
+	const Emits = defineEmits(['yudu-change'])
+
+	const swiperDotIndex = ref(0);
+	const showTishi = ref(false);
+
+	watch(() => props.question, (question) => {
+		const danxuanlist = question.danxuan.forEach(item => item.type = 'danxuan')
+		const duoxuanlist = question.duoxuan.forEach(item => item.type = 'duoxuan')
+		const panduanlist = question.panduan.forEach(item => item.type = 'panduan')
+		const tiankonglist = question.tiankong.forEach(item => item.type = 'tiankong')
+		const jiandalist = question.jianda.forEach(item => item.type = 'jianda')
+		
+		
+		data.content = [...question.danxuan, ...question.duoxuan, ...question.panduan, ...question.tiankong, ...
+			question.jianda
+		];
+		data.content.map((item,index) => {
+			item.onlyNum = index+1;
+			return item
+		})
+		Emits('yudu-change', data.content[0])
+	}, {
+		immediate: true
+	})
+
+	watch(() => {
+		if (props.showTishixinxi) {
+			if (!cacheManager.get('exam-tishi')) {
+				// 首次考试打开提示信息
+				showTishi.value = true
+			} else {
+				showTishi.value = false
+			}
+		} else {
+			showTishi.value = false
+		}
+	}, {
+		immediate: true
+	})
+
+	function onSwitchChange(e) {
+		console.log('eeee', e.detail,data.content[e.detail.current])
+		Emits('yudu-change', data.content[e.detail.current])
+	}
+	
+	function handleRight() {
+		if (swiperDotIndex.value > 0) {
+			swiperDotIndex.value = swiperDotIndex.value--;
+		}
+	}
+	
+	function handleLeft() {
+		
+		if (props.showTishixinxi) {
+			// 阅读题提示
+			cacheManager.set('exam-tishi', 1)
+			showTishi.value = false
+		}
+		
+		if (swiperDotIndex.value < data.content.length-1) {
+			swiperDotIndex.value = swiperDotIndex.value++;
+		}
+	}
+</script>

+ 4 - 4
pages/score/index.vue

@@ -51,14 +51,14 @@ const currentRefreshFn = computed(() =>
 	const lookShijuan = (data) => {
 		console.log('data',data);
 		uni.navigateTo({
-			url: '/pages/score/kaoshiChengjiInfo?lxId=' + data.lxId + '&name=' + data.name
+			url: '/pages/score/kaoshiChengjiInfo?hisId=' + data.hisId + '&name=' + data.ksName
 		});
 	}
 	const lookPaiming = (data) => {
 		console.log('datalookPaiming',data);
-		// uni.navigateTo({
-		// 	url: '/pages/score/kaoshiChengjiInfo?kcId=' + data.kcId + '&name=' + data.name
-		// });
+		uni.navigateTo({
+			url: '/pages/score/kaoshiChengjiInfo?kcId=' + data.kcId + '&name=' + data.name
+		});
 	}
 </script>
 

+ 728 - 0
pages/score/kaoshiChengjiInfo copy.vue

@@ -0,0 +1,728 @@
+<template>
+	<view class="phone-kaoshi-page">
+		<!-- 导航区域 -->
+		<view class="icon-title-navBar-box">
+			<view @click="handleBack" class="nav-bar-icon"></view>
+			<text class="nav-bar-title">{{data.lxName}}</text>
+		</view>
+		<!-- 第一行 -->
+		<view class="kaoshi-page-title">
+			<view v-if="activeSt" class="title-types">{{dlName}}</view>
+			<view>100分钟</view>
+		</view>
+
+
+		<view class="kaoshi-shiti-content">
+			<!-- 内容区域 -->
+			<!-- 试题区域 -->
+			<view v-if="activeSt">
+				<template v-if="activeSt.stTypeId == 1">
+					<!-- 单选 -->
+					<danxuan :question="activeSt" :key="activeSt.stId"></danxuan>
+				</template>
+				<template v-if="activeSt.stTypeId == 2">
+					<!-- 多选 -->
+					<duoxuan :question="activeSt" :key="activeSt.stId"></duoxuan>
+				</template>
+				<template v-if="activeSt.stTypeId == 3">
+					<!-- 判断 -->
+					<panduan :question="activeSt" :key="activeSt.stId"></panduan>
+				</template>
+				<template v-if="activeSt.stTypeId == 4">
+					<!-- 填空 -->
+					<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" @yudu-change="onYueduChange"></yuedu>
+				</template>
+			</view>
+
+		</view>
+
+		<view class="kaoshi-bottom-box">
+			<button class="phone-green-btn bj-btn" hover-class="none" type="default" size="mini"
+				@click="handleBiaoji">{{activeSt && activeSt.marked ? '取标':'标记'}}</button>
+			<view @click="showAnswerCard" class="shiti-num-box">
+				<icon class="shiti-num-icon"></icon>
+				<text
+					class="active-num">{{activeSt ? activeSt.onlyNum: 0}}</text>/<text>{{data.StListForSearch.length}}</text>
+			</view>
+			<button class="phone-white-btn jx-btn" hover-class="none" type="default" size="mini"
+				@click="handleCheckJiexi">解析</button>
+		</view>
+		<template v-if="activeSt">
+			<button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-prev"
+				@click="handlePrev" v-if="!isFistStId">上一题</button>
+			<button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-next"
+				@click="handleNext" v-if="!isLastStId">下一题</button>
+			<button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-next"
+				@click="handleBack" v-if="isLastStId">交卷</button>
+		</template>
+
+		<!-- 答题卡 -->
+		<uni-popup ref="popupRef" background-color="#fff" :animation="false" :is-mask-click="false" :mask-click="false">
+			<view class="answer-card-popup">
+				<view class="icon-title-navBar-box">
+					<view @click="handlePopupBack" class="nav-bar-icon"> </view>
+					<text class="nav-bar-title">答题卡</text>
+				</view>
+				<view class="card-content-box">
+					<view class="answer-card-content" v-for="(paragraph,paragraphIndex) in questionData"
+						:key="paragraphIndex">
+						<view class="paragraph-title">
+							{{paragraph.name}}
+						</view>
+						<view class="paragraph-qa" v-for="(qa,qaIndex) in paragraph.qas" :key="qaIndex"
+							:class="getQaClass(qa)" @click="answerCardItemClick(qa)">{{qa.onlyNum}}
+						</view>
+					</view>
+				</view>
+			</view>
+		</uni-popup>
+		<!--
+		// 倒计时
+		<view v-if="!!data.endSecond">
+			<text>考试倒计时:</text>
+			<uni-countdown :show-day="false" :second="1000" @timeup="onTimeUp" :start="startCountDown"></uni-countdown>
+		</view>
+		-->
+		<!-- 答案解析 -->
+		<scoreAndAnswerVue ref="scoreAnswerRef"></scoreAndAnswerVue>
+		<scoreAndAnswerAdminTiankong ref="scoreAnswerTkRef"></scoreAndAnswerAdminTiankong>
+		<scoreAndAnswerAdminJianda ref="scoreAnswerJdRef"></scoreAndAnswerAdminJianda>
+	</view>
+
+
+
+</template>
+
+<script setup>
+	import {
+		ref,
+		reactive,
+		computed,
+		watch
+	} from "vue";
+	import {
+		onLoad
+	} from "@dcloudio/uni-app";
+	import * as lxApi from "@/api/lianxi.js"
+	import danxuan from "@/components/questions/danxuan.vue";
+	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 scoreAndAnswerVue from "@/components/scoreAndAnswer/scoreAndAnswerAdmin.vue";
+	import scoreAndAnswerAdminTiankong from "@/components/scoreAndAnswer/scoreAndAnswerAdminTiankong.vue";
+	import scoreAndAnswerAdminJianda from "@/components/scoreAndAnswer/scoreAndAnswerJianda.vue";
+	import {
+		useQuestionTools
+	} from "@/components/questions/useQuestionTools.js";
+
+	const {
+		checkDanxuanReply,
+		checkDuoxuanReply,
+		checkPanduanReply,
+		checkTiankongReply,
+		getLetterByIndex,
+		checkJiandaReply,
+		checkYueduReply
+	} = useQuestionTools();
+
+	const stTypes = {
+		1: '单选题',
+		2: '多选题',
+		3: '判断题',
+		4: '填空题',
+	}
+
+	const popupRef = ref(null)
+	const scoreAnswerRef = ref(null)
+	const scoreAnswerTkRef = ref(null)
+	const startCountDown = ref(false);
+	const scoreAnswerJdRef = ref(null);
+
+	const data = reactive({
+		lxId: null,
+		lxName: '',
+		stTotal: 0,
+		stScore: 0,
+		biaoji: null,
+		endSecond: 0,
+		pageSize: 0,
+		toggleScreenFlag: 0,
+		toggleScreenSecond: 0,
+		zhuapai: 0,
+		duanluo: [],
+		markDB: [],
+		StListForSearch: [],
+	})
+
+	const yuduIndexQa = ref(null);
+
+	const questionData = ref([]);
+
+	const progress = reactive({
+		dlIndex: 0,
+		dtIndex: 0
+	})
+
+	const dlName = computed(() => {
+		if (data.StListForSearch && activeSt.value) {
+			return data.StListForSearch[activeSt.value.onlyNum - 1].paragraphName
+		} else {
+			return ''
+		}
+	})
+
+	watch(() => data.duanluo, (newVal) => {
+		// 计算已答试题数量
+	}, {
+		deep: true
+	})
+
+	const activeSt = computed(() => {
+		if (questionData.value.length) {
+			return questionData.value.length && questionData.value[progress.dlIndex].qas[progress.dtIndex];
+		} else {
+			return null
+		}
+	})
+
+	const isFistStId = computed(() => {
+		if (data.StListForSearch.length) {
+			return data.StListForSearch[0].stId == activeSt.value.stId
+		} else {
+			return false
+		}
+	});
+	const isLastStId = computed(() => {
+		if (data.StListForSearch.length) {
+			return data.StListForSearch[data.StListForSearch.length - 1].stId == activeSt.value.stId
+		} else {
+			return false
+		}
+	});
+
+	onLoad((option) => {
+	//	data.lxId = option.lxId;
+		data.lxId =6;
+		initKaoshi();
+	})
+
+	function getQaClass(qa) {
+		if (qa.marked && qa.marked === true) {
+			return 'paragraph-qa-block-mark';
+		} else {
+			if (qa.stTypeId == 1) {
+				if (checkDanxuanReply(qa)) {
+					return 'paragraph-qa-block-done';
+				} else {
+					return 'paragraph-qa-block-init';
+				}
+			} else if (qa.stTypeId == 2) {
+				if (checkDuoxuanReply(qa)) {
+					return 'paragraph-qa-block-done';
+				} else {
+					return 'paragraph-qa-block-init';
+				}
+			} else if (qa.stTypeId == 3) {
+				if (checkPanduanReply(qa)) {
+					return 'paragraph-qa-block-done';
+				} else {
+					return 'paragraph-qa-block-init';
+				}
+			} else if (qa.stTypeId == 4) {
+				if (checkTiankongReply(qa)) {
+					return 'paragraph-qa-block-done';
+				} else {
+					return 'paragraph-qa-block-init';
+				}
+			} else if (qa.stTypeId == 5) {
+				if (checkJiandaReply(qa)) {
+					return 'paragraph-qa-block-done';
+				} else {
+					return 'paragraph-qa-block-init';
+				}
+			} else if (qa.stTypeId == 6) {
+				if (checkYueduReply(qa)) {
+					return 'paragraph-qa-block-done';
+				} else {
+					return 'paragraph-qa-block-init';
+				}
+			}
+		}
+	}
+
+	function skipQuestion(dlIndex, dtIndex) {
+		progress.dlIndex = dlIndex;
+		progress.dtIndex = dtIndex;
+		handlePopupBack()
+		// 切换试题时清空阅读提解析
+		yuduIndexQa.value = null;
+	}
+
+	function answerCardItemClick(qa) {
+		const actQa = data.StListForSearch.find(item => item.stId == qa.stId);
+		skipQuestion(actQa.dlIndex, actQa.dtIndex)
+
+	}
+
+	function handleBack() {
+		uni.redirectTo({
+			url: "/pages/admin/Lianxi/list"
+		})
+	}
+
+	function onTimeUp() {
+		console.log('end')
+	}
+
+	function showAnswerCard() {
+		popupRef.value.open('top')
+	}
+
+	function handlePopupBack() {
+		popupRef.value.close()
+	}
+
+	function handlePrev() {
+		const qa = data.StListForSearch.find(item => item.stId == activeSt.value.stId);
+		const index = qa.num - 1;
+		if (index > 0) {
+			const result = data.StListForSearch[index - 1];
+			progress.dlIndex = result.dlIndex;
+			progress.dtIndex = result.dtIndex
+		}
+		// 切换试题时清空阅读提解析
+		yuduIndexQa.value = null;
+	}
+
+	function handleNext() {
+		const qa = data.StListForSearch.find(item => item.stId == activeSt.value.stId);
+		const index = qa.num - 1;
+		if (index < data.StListForSearch.length) {
+			const result = data.StListForSearch[index + 1];
+			progress.dlIndex = result.dlIndex;
+			progress.dtIndex = result.dtIndex
+		}
+		// 切换试题时清空阅读提解析
+		yuduIndexQa.value = null
+	}
+
+	function formatDuanluoList(dlData) {
+		let uIndex = 0; // 试题num
+		let iDuanluo = 0; // 段落num
+		let result = [];
+		for (const duanluo of data.duanluo) {
+			let paragraph = {
+				qas: [],
+			};
+			paragraph.name = duanluo.name;
+
+			let iQa = 0; // 当前试题序号
+			let order = 0; // 当前题型中第几题
+			for (const iDanxuan of duanluo.danxuan) {
+				iDanxuan.type = 'danxuan';
+				iDanxuan.marked = false;
+				iDanxuan.onlyNum = uIndex + 1;
+				iDanxuan.order = order;
+				iDanxuan.iQa = iQa;
+				iDanxuan.reply = iDanxuan.result;
+				paragraph.qas.push(iDanxuan);
+				uIndex++;
+				order++;
+				iQa++;
+
+				data.StListForSearch.push({
+					stId: iDanxuan.stId,
+					paragraphName: paragraph.name,
+					dlIndex: iDuanluo,
+					dtIndex: iDanxuan.iQa,
+					num: iDanxuan.onlyNum
+				})
+			}
+			order = 0;
+			for (const iDuoxuan of duanluo.duoxuan) {
+				iDuoxuan.type = 'duoxuan';
+				iDuoxuan.marked = false;
+				iDuoxuan.onlyNum = uIndex + 1;
+				iDuoxuan.order = order;
+				paragraph.qas.push(iDuoxuan);
+				iDuoxuan.reply = iDuoxuan.result;
+				iDuoxuan.iQa = iQa;
+				uIndex++;
+				order++;
+				iQa++;
+
+				data.StListForSearch.push({
+					stId: iDuoxuan.stId,
+					paragraphName: paragraph.name,
+					dlIndex: iDuanluo,
+					dtIndex: iDuoxuan.iQa,
+					num: iDuoxuan.onlyNum
+				})
+			}
+			order = 0;
+			for (const iPanduan of duanluo.panduan) {
+				iPanduan.type = 'panduan';
+				iPanduan.marked = false;
+				iPanduan.onlyNum = uIndex + 1;
+				iPanduan.order = order;
+				paragraph.qas.push(iPanduan);
+				iPanduan.reply = iPanduan.result;
+				iPanduan.iQa = iQa;
+				uIndex++;
+				order++;
+				iQa++;
+
+				data.StListForSearch.push({
+					stId: iPanduan.stId,
+					paragraphName: paragraph.name,
+					dlIndex: iDuanluo,
+					dtIndex: iPanduan.iQa,
+					num: iPanduan.onlyNum
+				})
+			}
+			order = 0;
+			for (const iTiankong of duanluo.tiankong) {
+				iTiankong.type = 'tiankong';
+				iTiankong.marked = false;
+				iTiankong.onlyNum = uIndex + 1;
+				iTiankong.order = order;
+				paragraph.qas.push(iTiankong);
+				iTiankong.reply = iTiankong.result.map(item => item[0]);
+				iTiankong.iQa = iQa;
+				uIndex++;
+				order++;
+				iQa++;
+
+				data.StListForSearch.push({
+					stId: iTiankong.stId,
+					paragraphName: paragraph.name,
+					dlIndex: iDuanluo,
+					dtIndex: iTiankong.iQa,
+					num: iTiankong.onlyNum
+				})
+			}
+			order = 0;
+			for (const iJianda of duanluo.jianda) {
+				iJianda.marked = 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,
+					num: iJianda.onlyNum
+				})
+			}
+			order = 0;
+			for (const iYuedu of duanluo.yuedu) {
+				iYuedu.marked = 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,
+					num: iYuedu.onlyNum
+				})
+			}
+
+			iDuanluo++;
+			questionData.value.push(paragraph)
+
+			console.log(questionData.value)
+		}
+	}
+
+	function handleBiaoji() {
+		activeSt.value.marked = !activeSt.value.marked;
+	}
+	// 切换阅读小题时更新当前试题解析
+	function onYueduChange(qa) {
+		yuduIndexQa.value = qa;
+	}
+
+	// 校验阅读解析
+	function checkYueduJiexi() {
+		let qa = yuduIndexQa.value;
+		let score = qa.userScore;
+		let reply = '';
+		let result = '';
+		let answer = qa.answer;
+		if (qa.stTypeId == 1) {
+			// 单选题
+			if (qa.reply && qa.reply.trim() !== '') {
+				reply = getLetterByIndex(qa.reply)
+			} else {
+				reply = '未答'
+			}
+
+			if (qa.result) {
+				result = getLetterByIndex(qa.result)
+			} else {
+				result = '无答案'
+			}
+			scoreAnswerRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 2) {
+			// 多选题
+
+			if (qa.reply && qa.reply.length) {
+				reply = qa.reply.map(item => {
+					if (item.trim()) {
+						return getLetterByIndex(item.trim())
+					}
+				}).join(',')
+			} else {
+				reply = '未答'
+			}
+			if (qa.result) {
+				result = qa.result.map(item => {
+					if (item.trim()) {
+						return getLetterByIndex(item.trim())
+					}
+				}).join(',')
+			} else {
+				result = '无答案'
+			}
+			scoreAnswerRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 3) {
+			// 判断题
+			if (qa.reply === '') {
+				reply = '未答'
+			} else if (qa.reply == 0) {
+				reply = '错误'
+			} else if (qa.reply == 1) {
+				reply = '正确'
+			}
+			if (qa.result == 0) {
+				result = '错误'
+			} else if (qa.result == 1) {
+				result = '正确'
+			}
+			scoreAnswerRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 4) {
+			let reply = qa.reply || [];
+			let result = qa.result || [];
+			// 填空题
+			scoreAnswerTkRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 5) {
+			// 简单题
+			let reply = qa.reply ? '未答' : qa.reply;
+			let result = qa.result;
+			scoreAnswerJdRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+
+	}
+
+	// 获取解析
+	function handleCheckJiexi() {
+		const qa = activeSt.value;
+		let score = qa.userScore;
+		let reply = '';
+		let result = '';
+		let answer = qa.answer;
+		if (qa.stTypeId == 1) {
+			// 单选题
+			if (qa.reply && qa.reply.trim() !== '') {
+				reply = getLetterByIndex(qa.reply)
+			} else {
+				reply = '未答'
+			}
+
+			if (qa.result) {
+				result = getLetterByIndex(qa.result)
+			} else {
+				result = '无答案'
+			}
+			scoreAnswerRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 2) {
+			// 多选题
+
+			if (qa.reply && qa.reply.length) {
+				reply = qa.reply.map(item => {
+					if (item.trim()) {
+						return getLetterByIndex(item.trim())
+					}
+				}).join(',')
+			} else {
+				reply = '未答'
+			}
+			if (qa.result) {
+				result = qa.result.map(item => {
+					if (item.trim()) {
+						return getLetterByIndex(item.trim())
+					}
+				}).join(',')
+			} else {
+				result = '无答案'
+			}
+			scoreAnswerRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 3) {
+			// 判断题
+			if (qa.reply === '') {
+				reply = '未答'
+			} else if (qa.reply == 0) {
+				reply = '错误'
+			} else if (qa.reply == 1) {
+				reply = '正确'
+			}
+			if (qa.result == 0) {
+				result = '错误'
+			} else if (qa.result == 1) {
+				result = '正确'
+			}
+			scoreAnswerRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 4) {
+			let reply = qa.reply || [];
+			let result = qa.result || [];
+			// 填空题
+			scoreAnswerTkRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 5) {
+			// 简单题
+			let reply = qa.reply;
+			let result = qa.result;
+			scoreAnswerJdRef.value.showPopup({
+				score,
+				reply,
+				result,
+				answer
+			})
+		}
+		if (qa.stTypeId == 6) {
+			// 简单题
+			checkYueduJiexi()
+		}
+
+	}
+
+	function initKaoshi() {
+		lxApi.getLianxiInfo({
+			lxId: data.lxId
+		}).then(res => {
+			const {
+				lxId,
+				lxName,
+				stTotal,
+				stScore,
+				biaoji,
+				endSecond,
+				pageSize,
+				toggleScreenFlag,
+				toggleScreenSecond,
+				zhuapai,
+				duanluoList
+			} = res.data;
+			data.lxId = lxId;
+			data.lxName = lxName;
+			data.stTotal = stTotal;
+			data.stScore = stScore;
+			data.biaoji = biaoji;
+			data.endSecond = endSecond;
+			data.pageSize = pageSize;
+			data.toggleScreenFlag = toggleScreenFlag;
+			data.toggleScreenSecond = toggleScreenSecond;
+			data.zhuapai = zhuapai;
+			data.duanluo = duanluoList;
+			formatDuanluoList(data.duanluo);
+			startCountDown.value = true;
+			uni.setNavigationBarTitle({
+				title: data.lxName
+			});
+		})
+	}
+</script>

+ 21 - 140
pages/score/kaoshiChengjiInfo.vue

@@ -43,54 +43,14 @@
 			</view>
 
 		</view>
-
-		<view class="kaoshi-bottom-box">
-			<button class="phone-green-btn bj-btn" hover-class="none" type="default" size="mini"
-				@click="handleBiaoji">{{activeSt && activeSt.marked ? '取标':'标记'}}</button>
-			<view @click="showAnswerCard" class="shiti-num-box">
-				<icon class="shiti-num-icon"></icon>
-				<text
-					class="active-num">{{activeSt ? activeSt.onlyNum: 0}}</text>/<text>{{data.StListForSearch.length}}</text>
-			</view>
-			<button class="phone-white-btn jx-btn" hover-class="none" type="default" size="mini"
-				@click="handleCheckJiexi">解析</button>
-		</view>
 		<template v-if="activeSt">
 			<button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-prev"
 				@click="handlePrev" v-if="!isFistStId">上一题</button>
 			<button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-next"
 				@click="handleNext" v-if="!isLastStId">下一题</button>
-			<button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-next"
-				@click="handleBack" v-if="isLastStId">交卷</button>
 		</template>
-
-		<!-- 答题卡 -->
-		<uni-popup ref="popupRef" background-color="#fff" :animation="false" :is-mask-click="false" :mask-click="false">
-			<view class="answer-card-popup">
-				<view class="icon-title-navBar-box">
-					<view @click="handlePopupBack" class="nav-bar-icon"> </view>
-					<text class="nav-bar-title">答题卡</text>
-				</view>
-				<view class="card-content-box">
-					<view class="answer-card-content" v-for="(paragraph,paragraphIndex) in questionData"
-						:key="paragraphIndex">
-						<view class="paragraph-title">
-							{{paragraph.name}}
-						</view>
-						<view class="paragraph-qa" v-for="(qa,qaIndex) in paragraph.qas" :key="qaIndex"
-							:class="getQaClass(qa)" @click="answerCardItemClick(qa)">{{qa.onlyNum}}
-						</view>
-					</view>
-				</view>
-			</view>
-		</uni-popup>
-		<!--
-		// 倒计时
-		<view v-if="!!data.endSecond">
-			<text>考试倒计时:</text>
-			<uni-countdown :show-day="false" :second="1000" @timeup="onTimeUp" :start="startCountDown"></uni-countdown>
-		</view>
-		-->
+		<button class="phone-white-btn jx-btn" hover-class="none" type="default" size="mini"
+			@click="handleCheckJiexi">解析</button>
 		<!-- 答案解析 -->
 		<scoreAndAnswerVue ref="scoreAnswerRef"></scoreAndAnswerVue>
 		<scoreAndAnswerAdminTiankong ref="scoreAnswerTkRef"></scoreAndAnswerAdminTiankong>
@@ -111,13 +71,13 @@
 	import {
 		onLoad
 	} from "@dcloudio/uni-app";
-	import * as lxApi from "@/api/lianxi.js"
-	import danxuan from "@/components/questions/danxuan.vue";
-	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 * as cjApi from "@/api/chengji.js"
+	import danxuan from "@/components/questionsChengji/yuedu.vue";
+	import duoxuan from "@/components/questionsChengji/duoxuan.vue";
+	import tiankong from "@/components/questionsChengji/tiankong.vue";
+	import panduan from "@/components/questionsChengji/panduan.vue";
+	import jianda from "@/components/questionsChengji/jianda.vue";
+	import yuedu from "@/components/questionsChengji/yuedu.vue";
 	import scoreAndAnswerVue from "@/components/scoreAndAnswer/scoreAndAnswerAdmin.vue";
 	import scoreAndAnswerAdminTiankong from "@/components/scoreAndAnswer/scoreAndAnswerAdminTiankong.vue";
 	import scoreAndAnswerAdminJianda from "@/components/scoreAndAnswer/scoreAndAnswerJianda.vue";
@@ -149,8 +109,8 @@
 	const scoreAnswerJdRef = ref(null);
 
 	const data = reactive({
-		lxId: null,
-		lxName: '',
+		hisId: null,
+		name: '',
 		stTotal: 0,
 		stScore: 0,
 		biaoji: null,
@@ -211,69 +171,12 @@
 	});
 
 	onLoad((option) => {
-	//	data.lxId = option.lxId;
-		data.lxId =6;
+		data.hisId = option.hisId;
+		data.name = option.name;
+		
 		initKaoshi();
 	})
 
-	function getQaClass(qa) {
-		if (qa.marked && qa.marked === true) {
-			return 'paragraph-qa-block-mark';
-		} else {
-			if (qa.stTypeId == 1) {
-				if (checkDanxuanReply(qa)) {
-					return 'paragraph-qa-block-done';
-				} else {
-					return 'paragraph-qa-block-init';
-				}
-			} else if (qa.stTypeId == 2) {
-				if (checkDuoxuanReply(qa)) {
-					return 'paragraph-qa-block-done';
-				} else {
-					return 'paragraph-qa-block-init';
-				}
-			} else if (qa.stTypeId == 3) {
-				if (checkPanduanReply(qa)) {
-					return 'paragraph-qa-block-done';
-				} else {
-					return 'paragraph-qa-block-init';
-				}
-			} else if (qa.stTypeId == 4) {
-				if (checkTiankongReply(qa)) {
-					return 'paragraph-qa-block-done';
-				} else {
-					return 'paragraph-qa-block-init';
-				}
-			} else if (qa.stTypeId == 5) {
-				if (checkJiandaReply(qa)) {
-					return 'paragraph-qa-block-done';
-				} else {
-					return 'paragraph-qa-block-init';
-				}
-			} else if (qa.stTypeId == 6) {
-				if (checkYueduReply(qa)) {
-					return 'paragraph-qa-block-done';
-				} else {
-					return 'paragraph-qa-block-init';
-				}
-			}
-		}
-	}
-
-	function skipQuestion(dlIndex, dtIndex) {
-		progress.dlIndex = dlIndex;
-		progress.dtIndex = dtIndex;
-		handlePopupBack()
-		// 切换试题时清空阅读提解析
-		yuduIndexQa.value = null;
-	}
-
-	function answerCardItemClick(qa) {
-		const actQa = data.StListForSearch.find(item => item.stId == qa.stId);
-		skipQuestion(actQa.dlIndex, actQa.dtIndex)
-
-	}
-
 	function handleBack() {
 		uni.redirectTo({
 			url: "/pages/admin/Lianxi/list"
@@ -475,10 +378,6 @@
 			console.log(questionData.value)
 		}
 	}
-
-	function handleBiaoji() {
-		activeSt.value.marked = !activeSt.value.marked;
-	}
 	// 切换阅读小题时更新当前试题解析
 	function onYueduChange(qa) {
 		yuduIndexQa.value = qa;
@@ -486,12 +385,13 @@
 
 	// 校验阅读解析
 	function checkYueduJiexi() {
+		debugger
 		let qa = yuduIndexQa.value;
 		let score = qa.userScore;
 		let reply = '';
 		let result = '';
 		let answer = qa.answer;
-		if (qa.stTypeId == 1) {
+		if (qa.stTypeId == 0) {
 			// 单选题
 			if (qa.reply && qa.reply.trim() !== '') {
 				reply = getLetterByIndex(qa.reply)
@@ -691,37 +591,18 @@
 	}
 
 	function initKaoshi() {
-		lxApi.getLianxiInfo({
-			lxId: data.lxId
+		cjApi.lookChengjiView({
+			hisId: data.hisId
 		}).then(res => {
 			const {
-				lxId,
-				lxName,
-				stTotal,
-				stScore,
-				biaoji,
-				endSecond,
-				pageSize,
-				toggleScreenFlag,
-				toggleScreenSecond,
-				zhuapai,
+				hisId,
 				duanluoList
 			} = res.data;
-			data.lxId = lxId;
-			data.lxName = lxName;
-			data.stTotal = stTotal;
-			data.stScore = stScore;
-			data.biaoji = biaoji;
-			data.endSecond = endSecond;
-			data.pageSize = pageSize;
-			data.toggleScreenFlag = toggleScreenFlag;
-			data.toggleScreenSecond = toggleScreenSecond;
-			data.zhuapai = zhuapai;
+			data.hisId = hisId;
 			data.duanluo = duanluoList;
 			formatDuanluoList(data.duanluo);
-			startCountDown.value = true;
 			uni.setNavigationBarTitle({
-				title: data.lxName
+				title: data.name
 			});
 		})
 	}