Explorar el Código

Merge branch '2024鹅状元' of https://gogs.mtavip.com/wangguoyu/uniProject into 2024鹅状元

tanxue hace 5 meses
padre
commit
4ba74541de

+ 34 - 12
components/question/tiankong.vue

@@ -10,11 +10,36 @@
 </template>
 
 <script>
-	import FillItem from "./FillItem.vue";
-	
+	export default {
+		props: {
+			placeholders: { // 占位符
+				type: Array,
+				required: true
+			},
+			question: {
+				type: Object,
+			},
+			showError: {
+				type: Boolean,
+				default: false
+			}
+		},
+		methods: {
+			setResult(data) {
+				const {index,result} = data;
+				this.question.reply[index] = result;
+			}
+		}
+	}
 	
+</script>
+
+<script module="TK" lang="renderjs">
+	import FillItem from "./FillItem.vue";
 	export default {
-		name: 'FillInTheBlank',
+		components: {
+			FillItem
+		},
 		props: {
 			placeholders: { // 占位符
 				type: Array,
@@ -30,7 +55,7 @@
 		},
 		data() {
 			return {
-				answers: this.placeholders.map(() => '') // 初始化答案数组,与占位符数量一致
+				
 			};
 		},
 		computed: {
@@ -54,23 +79,20 @@
 			onBlur(data) {
 				const {index,result} = data;
 				this.question.reply[index] = result;
+				this.$ownerInstance.callMethod('setResult', data)
 			},
 			updateFn(e) {
-				// console.log('e',e.target.dataset.index);
 				const str = `popup${e.target.dataset.index}Ref`;
 				console.log(this.$refs[str],str)
 				this.$refs[str][0].showPopup();
 			},
 			initListener() {
-				question.result.forEach((item,index) => {
-					document.getElementById(`t_${item.stId}_${index}`).addEventListener('focus', (e) => this.updateFn(e))
+				this.question.result.forEach((item,index) => {
+					document.getElementById(`t_${this.question.stId}_${index}`).addEventListener('focus', (e) => this.updateFn(e))
 				})
-			}
+			},
 		},
-		mounted() {
-
-		}
-	};
+	}
 </script>
 
 <style scoped>

+ 1 - 1
components/questionJiexi/questionJiexi.vue

@@ -10,7 +10,7 @@
 				<view class="dajx-content-box">
 					<!-- 思路分析 -->
 					<view class="slfx-title"></view>
-					<view class="slfx-content"> {{data.jiangjie}}</view>
+					<view class="slfx-content"> {{data.answer}}</view>
 					<!-- <view class="slfx-content"> {{data.answer}}</view> -->
 					
 					<!-- 视频讲解 -->

+ 23 - 9
pages/unitTest/index.vue

@@ -7,19 +7,21 @@
 		</view>
 		
 		<view class="shiti-frame-box">
-			<w-swiper :list="list" :positionIndex="current" class="ezy-exam-swiper">
+			<w-swiper :list="list" :current="current" class="ezy-exam-swiper" @change="onSwiperChange">
 				<template v-slot:default="{item}">
 					<view class="body" v-if="item.mta_show">
 						<danxuan :question="item" v-if="item.type == '1'"></danxuan>
-						<panduan :question="item" v-if="item.type == '2'"></panduan>
+			  <!-- <panduan :question="item" v-if="item.type == '2'"></panduan> -->
 			  <!-- <tiankong :question="item" v-if="item.type == '3'"></tiankong> -->
 					</view>
 				</template>
 			</w-swiper>
-			<view class="exam-submit-btn" v-if="isLast" 
+			<view class="exam-submit-btn" v-if="current === list.length-1" 
 				@click="handleSubmit(uniPointsRef)"></view>
 		</view>
-		<view class="exam-tip-box">左右滑动查看更多题目</view>
+
+		<!--  左右滑动  -->
+		<view class="exam-tip-box" @click="handleCloseTishi" v-if="showTishi">左右滑动查看更多题目</view>
 
 		<!-- 答卷 -->
 		<chengji ref="chengjiRef" :list="list" :jieId="jieId" :zhangId="zhangId"
@@ -56,10 +58,10 @@
 	} from "vue";
 
 	const {setStudyStorage} = useStudyRouteParams();
+	
+	const showTishi = ref(true);
 
 	const {
-		isFirst,
-		isLast,
 		count,
 		total,
 		current,
@@ -69,12 +71,9 @@
 		jifen,
 		zhangId,
 		jieId,
-		nextZhang,
 		nianji,
 		xueqi,
 
-		nextQuestion,
-		prevQuestion,
 		handleSubmit,
 		initPage
 	} = useExam();
@@ -106,6 +105,21 @@
 			url: `/pages/study/index?nianji=${nianji.value}&xueqi=${xueqi.value}&zhangId=${zhangId.value}&jieId=${jieId.value}`
 		})
 	}
+	
+	function onSwiperChange(index) {
+		current.value = index;
+	}
+	
+	// 大鹅关闭追加缓存 --- 单独针对当前手机的缓存提示
+	function handleCloseTishi() {
+		uni.setStorageSync('isShowTishi','has');
+		showTishi.value = false;
+	}
+	// 大鹅显示追加缓存 --- 单独针对当前手机的缓存提示
+	function handleShowTishi() {
+		const isNotShow = Boolean(uni.getStorageSync('isShowTishi'));
+		showTishi.value = !isNotShow;
+	}
 </script>
 
 <style lang="scss" scoped>

+ 1 - 30
pages/unitTest/useUnit.js

@@ -45,14 +45,13 @@ export function useExam() {
 		list: [], // 试题列表
 		jieId: null, // 节Id
 		zhangId: null,
-		nextZhangId: null,
 		nianji: null,
 		xueqi: null,
 	})
 	
 	onLoad((options) => {
 		const {
-			jieId,zhangId,nextZhangId,nianji,xueqi
+			jieId,zhangId,nianji,xueqi
 		} = options;
 		data.jieId = jieId; // 需要路由参数 节Id
 		data.zhangId = zhangId;// 需要路由参数 章Id
@@ -64,35 +63,12 @@ export function useExam() {
 		initPage();
 	})
 	
-	// 当前试题
-	const activeQa = computed(() => data.list.length ? data.list[data.current] : null);
-	// 第一题
-	const isFirst = computed(() => {
-		if (!activeQa.value) return false;
-		return activeQa.value.id === data.list[0].id;
-	})
-	// 最后一题
-	const isLast = computed(() => {
-		if (!activeQa.value) return false;
-		const clength = data.list.length;
-		return activeQa.value.id === data.list[clength - 1].id;
-	})
 	watch(() => data.list, (val) => {
 		const list = data.list.filter(item => item.reply!==null);
 		data.count = list.length;
 	},{deep: true})
 
 
-	// 下一题
-	function nextQuestion() {
-		data.current = data.current + 1;
-	}
-
-	// 前一题
-	function prevQuestion() {
-		data.current = data.current - 1;
-	}
-
 	// 初始化页面数据
 	async function initPage() {
 		const [err, cdata] = await catchError(httpUnit.getExamData({
@@ -142,15 +118,10 @@ export function useExam() {
 
 	return {
 		...toRefs(data),
-		activeQa,
-		isFirst,
-		isLast,
 		rightAnswer,
 		wrongAnswer,
 		jifen,
 
-		nextQuestion,
-		prevQuestion,
 		handleSubmit,
 		initPage
 	}