Przeglądaj źródła

Merge branch 'main' of https://gogs.mtavip.com/wangguoyu/uniProject into main

tanxue 1 miesiąc temu
rodzic
commit
761511bd1b

+ 122 - 0
components/kaoshixuzhi/examCountDown.vue

@@ -0,0 +1,122 @@
+<template>
+	<view class="exam-count-down-content">
+		<view v-if="data.status === 'before'">
+			<view class="exam-count-down-timer">{{formatTime}} </view>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		reactive,
+		onUnmounted,
+		computed,
+		watch
+	} from 'vue';
+
+	const STATUS = {
+		init: null,
+		moreThenAnHour: 'more',
+		before: 'before', // 等待参加
+		after: 'after',
+	};
+	const props = defineProps({
+		count: {
+			type: Number,
+			default: 10
+		}
+	})
+
+	const Emits = defineEmits(['time-end'])
+
+	const data = reactive({
+		curCount: 0,
+		status: STATUS.init,
+		timer: null
+	})
+
+	const formatTime = computed(() => {
+		if (data.curCount > 3600) {
+			return '';
+		}
+		const minute = (Math.floor(data.curCount / 60)).toString().padStart(2, '0');
+		const second = (Math.floor(data.curCount % 60)).toString().padStart(2, '0');
+		return `${minute}:${second}`;
+	})
+
+	watch(() => data.curCount, (newVal) => {
+		if (newVal > 3600) {
+			data.status = STATUS.moreThenAnHour;
+		} else if (newVal <= 3600 && newVal > 0) {
+			data.status = STATUS.before;
+		} else {
+			data.status = STATUS.after;
+		}
+
+	}, {
+		immediate: true
+	})
+
+	// 执行组件 组件启动
+	function init() {
+		console.log('init')
+		data.curCount = props.count;
+		if (data.curCount > 0) {
+			countDown(data.curCount);
+		}
+	}
+	// 终止组件 恢复初始化
+	function termination() {
+		clearTimer();
+		resetCurCount();
+		resetCurStatus();
+	}
+
+	function resetCurCount() {
+		curCount = 0;
+	}
+
+	function resetCurStatus() {
+		data.status = STATUS.init;
+	}
+
+	function clearTimer() {
+		clearInterval(data.timer);
+		data.timer = null;
+	}
+	// 倒计时业务执行
+	function countDown(TIME_COUNT) {
+		// 参数非数字 异常禁止执行
+		if (typeof TIME_COUNT !== 'number') {
+			return false;
+		}
+		// 参数小于等于0 不需要倒计时
+		if (TIME_COUNT <= 0) {
+			return false;
+		}
+		// 执行业务
+		if (!data.timer) {
+			data.timer = setInterval(() => {
+				// 倒计时存在 执行倒计时业务
+				if (data.curCount > 0) {
+					data.curCount--;
+					if (data.curCount <= 0) {
+						Emits('time-end', true)
+						data.clearTimer();
+					}
+				}
+			}, 1000);
+		}
+	}
+	onUnmounted(() => {
+		clearTimer()
+	})
+	
+	defineExpose({
+		init,termination
+	})
+</script>
+
+<style>
+
+</style>

+ 214 - 0
package-lock.json

@@ -0,0 +1,214 @@
+{
+  "name": "hbproject",
+  "version": "1.0.0",
+  "lockfileVersion": 1,
+  "requires": true,
+  "dependencies": {
+    "@vue/devtools-api": {
+      "version": "6.6.4",
+      "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.6.4.tgz",
+      "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g=="
+    },
+    "asynckit": {
+      "version": "0.4.0",
+      "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
+      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
+    },
+    "axios": {
+      "version": "1.8.4",
+      "resolved": "https://registry.npmmirror.com/axios/-/axios-1.8.4.tgz",
+      "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==",
+      "requires": {
+        "follow-redirects": "^1.15.6",
+        "form-data": "^4.0.0",
+        "proxy-from-env": "^1.1.0"
+      }
+    },
+    "call-bind-apply-helpers": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+      "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+      "requires": {
+        "es-errors": "^1.3.0",
+        "function-bind": "^1.1.2"
+      }
+    },
+    "combined-stream": {
+      "version": "1.0.8",
+      "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
+      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+      "requires": {
+        "delayed-stream": "~1.0.0"
+      }
+    },
+    "crypto-js": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
+      "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
+    },
+    "delayed-stream": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
+      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
+    },
+    "dunder-proto": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
+      "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+      "requires": {
+        "call-bind-apply-helpers": "^1.0.1",
+        "es-errors": "^1.3.0",
+        "gopd": "^1.2.0"
+      }
+    },
+    "es-define-property": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
+      "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="
+    },
+    "es-errors": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
+      "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="
+    },
+    "es-object-atoms": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
+      "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
+      "requires": {
+        "es-errors": "^1.3.0"
+      }
+    },
+    "es-set-tostringtag": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
+      "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
+      "requires": {
+        "es-errors": "^1.3.0",
+        "get-intrinsic": "^1.2.6",
+        "has-tostringtag": "^1.0.2",
+        "hasown": "^2.0.2"
+      }
+    },
+    "follow-redirects": {
+      "version": "1.15.9",
+      "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz",
+      "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="
+    },
+    "form-data": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.2.tgz",
+      "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==",
+      "requires": {
+        "asynckit": "^0.4.0",
+        "combined-stream": "^1.0.8",
+        "es-set-tostringtag": "^2.1.0",
+        "mime-types": "^2.1.12"
+      }
+    },
+    "function-bind": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
+      "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="
+    },
+    "get-intrinsic": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+      "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+      "requires": {
+        "call-bind-apply-helpers": "^1.0.2",
+        "es-define-property": "^1.0.1",
+        "es-errors": "^1.3.0",
+        "es-object-atoms": "^1.1.1",
+        "function-bind": "^1.1.2",
+        "get-proto": "^1.0.1",
+        "gopd": "^1.2.0",
+        "has-symbols": "^1.1.0",
+        "hasown": "^2.0.2",
+        "math-intrinsics": "^1.1.0"
+      }
+    },
+    "get-proto": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
+      "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+      "requires": {
+        "dunder-proto": "^1.0.1",
+        "es-object-atoms": "^1.0.0"
+      }
+    },
+    "gopd": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
+      "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="
+    },
+    "has-symbols": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
+      "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="
+    },
+    "has-tostringtag": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
+      "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
+      "requires": {
+        "has-symbols": "^1.0.3"
+      }
+    },
+    "hasown": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
+      "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
+      "requires": {
+        "function-bind": "^1.1.2"
+      }
+    },
+    "jsencrypt": {
+      "version": "3.3.2",
+      "resolved": "https://registry.npmmirror.com/jsencrypt/-/jsencrypt-3.3.2.tgz",
+      "integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A=="
+    },
+    "math-intrinsics": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+      "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="
+    },
+    "mime-db": {
+      "version": "1.52.0",
+      "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
+      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
+    },
+    "mime-types": {
+      "version": "2.1.35",
+      "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
+      "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+      "requires": {
+        "mime-db": "1.52.0"
+      }
+    },
+    "pinia": {
+      "version": "2.3.1",
+      "resolved": "https://registry.npmmirror.com/pinia/-/pinia-2.3.1.tgz",
+      "integrity": "sha512-khUlZSwt9xXCaTbbxFYBKDc/bWAGWJjOgvxETwkTN7KRm66EeT1ZdZj6i2ceh9sP2Pzqsbc704r2yngBrxBVug==",
+      "requires": {
+        "@vue/devtools-api": "^6.6.3",
+        "vue-demi": "^0.14.10"
+      }
+    },
+    "proxy-from-env": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+    },
+    "ts-md5": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmmirror.com/ts-md5/-/ts-md5-1.3.1.tgz",
+      "integrity": "sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg=="
+    },
+    "vue-demi": {
+      "version": "0.14.10",
+      "resolved": "https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.10.tgz",
+      "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg=="
+    }
+  }
+}

+ 210 - 0
pages/course/common/catalogue.vue

@@ -0,0 +1,210 @@
+<template>
+	<view>
+		<uni-collapse class="chapter-collapse" accordion>
+			<uni-collapse-item v-for="(zhangItem, zhangIndex) in props.options.zhangList" :key="zhangIndex"
+				:title="zhangItem.name" :open="isCurrentZhang(zhangIndex)">
+				<uni-collapse class="chapter-collapse" accordion>
+					<uni-collapse-item v-for="(jieItem, jieIndex) in zhangItem.jieList" :key="'jie-'+jieIndex"
+						:title="jieItem.name" :open="isCurrentJie(zhangIndex,jieIndex)">
+						<view class="section-header">{{ jieItem.name }}</view>
+						<view v-for="(video, vidIndex) in jieItem.kejianList" :key="'vid-'+video.kjId"
+							class="video-item" @click="handleVideoClick(zhangIndex, jieIndex, vidIndex,video)">
+							<view class="video-info">
+								<text class="video-name"
+									:class="{ active: isCurrentVideo(zhangIndex, jieIndex, vidIndex) }">
+									{{ video.name }}
+								</text>
+								<view class="progress-container">
+									<progress :percent="calcProgress(video)" stroke-width="4"
+										:activeColor="video.curProcess >= 100 ? '#4cd964' : '#007aff'" />
+								</view>
+							</view>
+						</view>
+					</uni-collapse-item>
+				</uni-collapse>
+			</uni-collapse-item>
+		</uni-collapse>
+	</view>
+</template>
+
+<script setup>
+	import {
+		getKechengList,
+		kejianInfo
+	} from "@/api/course.js";
+	import {
+		onLoad,
+		onReady
+	} from "@dcloudio/uni-app"
+
+	import {
+		ref,
+		reactive,
+		defineProps,
+		defineEmits,
+		onMounted,
+		watchEffect,
+		defineExpose
+	} from 'vue';
+	const props = defineProps({
+		options: {
+			type: Object,
+			default: () => {}
+		},
+		currentVideo: {
+			type: Object,
+			default: () => {}
+		},
+
+	})
+	let currentPos = ref({
+		zhangIndex: -1,
+		jieIndex: -1,
+		vidIndex: -1
+	});
+	const Emits = defineEmits(['kejianInfo', 'playNext']);
+	// 初始化时定位第一个未完成视频
+	onMounted(() => {
+		loadProgressFromCache();
+		findFirstUnfinished();
+	});
+	const loadProgressFromCache = () => {
+		props.options.zhangList.forEach(zhang => {
+			zhang.jieList.forEach(jie => {
+				jie.kejianList.forEach(video => {
+					const cached = uni.getStorageSync(`video_${video.kjId}`);
+					if (cached) {
+						video.curProcess = (cached / uni.getStorageSync(
+							`duration_${video.kjId}`)) * 100 || 0;
+						video.maxProcess = Math.max(video.maxProcess, video.curProcess);
+					}
+				});
+			});
+		});
+	};
+	// 查找第一个未完成视频
+	const findFirstUnfinished = () => {
+		for (let z = 0; z < props.options.zhangList.length; z++) {
+			const zhang = props.options.zhangList[z];
+			for (let j = 0; j < zhang.jieList.length; j++) {
+				const jie = zhang.jieList[j];
+				for (let v = 0; v < jie.kejianList.length; v++) {
+					const video = jie.kejianList[v];
+					if (video.curProcess < 100) {
+						updateCurrentPosition(z, j, v, video);
+						return;
+					}
+				}
+			}
+		}
+	};
+	// 判断是否当前章
+	const isCurrentZhang = (zhangIndex) => {
+		return currentPos.value.zhangIndex === zhangIndex;
+	};
+
+	// 判断是否当前节(需要同时匹配章和节)
+	const isCurrentJie = (zhangIndex, jieIndex) => {
+		return currentPos.value.zhangIndex === zhangIndex &&
+			currentPos.value.jieIndex === jieIndex;
+	};
+
+	// 判断是否当前视频
+	const isCurrentVideo = (z, j, v) => {
+		return currentPos.value.zhangIndex === z &&
+			currentPos.value.jieIndex === j &&
+			currentPos.value.vidIndex === v;
+	};
+
+	// 计算进度
+	const calcProgress = (video) => {
+		return Math.min(video.curProcess, 100);
+	};
+
+	// 点击视频处理
+	const handleVideoClick = (z, j, v, video) => {
+		console.log('video', video);
+		// currentPos.value = {
+		// 	zhangIndex: z,
+		// 	jieIndex: j,
+		// 	vidIndex: v
+		// };
+		updateCurrentPosition(z, j, v, video);
+		kejianInfo({
+			kjId: video.kjId
+		}).then(res => {
+			console.log('res', res);
+			Emits('kejianInfo', {
+				...res.data,
+				kjId: video.kjId
+			})
+		})
+		// 这里添加实际播放逻辑
+	};
+	// 更新播放位置
+	const updateCurrentPosition = (z, j, v, video) => {
+		currentPos.value = {
+			zhangIndex: z,
+			jieIndex: j,
+			vidIndex: v
+		};
+		video.curProcess = uni.getStorageSync(`video_${video.kjId}`) /
+			uni.getStorageSync(`duration_${video.kjId}`) * 100 || 0;
+	};
+	// 播放下一个视频
+	let playNextVideo = () => {
+		let {
+			zhangIndex,
+			jieIndex,
+			vidIndex
+		} = currentPos.value;
+		const chapters = props.options.zhangList;
+
+		// 1. 同节的下一个视频
+		const currentSection = chapters[zhangIndex].jieList[jieIndex];
+		if (vidIndex < currentSection.kejianList.length - 1) {
+			vidIndex++;
+			return playVideoAt(zhangIndex, jieIndex, vidIndex);
+		}
+
+		// 2. 同章的下一节
+		const currentChapter = chapters[zhangIndex];
+		if (jieIndex < currentChapter.jieList.length - 1) {
+			for (let j = jieIndex + 1; j < currentChapter.jieList.length; j++) {
+				if (currentChapter.jieList[j].kejianList.length > 0) {
+					return playVideoAt(zhangIndex, j, 0);
+				}
+			}
+		}
+
+		// 3. 后续章节
+		for (let z = zhangIndex + 1; z < chapters.length; z++) {
+			for (let j = 0; j < chapters[z].jieList.length; j++) {
+				if (chapters[z].jieList[j].kejianList.length > 0) {
+					return playVideoAt(z, j, 0);
+				}
+			}
+		}
+
+		uni.showToast({
+			title: '已播放所有课程',
+			icon: 'none'
+		});
+	};
+	// 辅助方法
+	const playVideoAt = (z, j, v) => {
+		const video = props.options.zhangList[z].jieList[j].kejianList[v];
+		updateCurrentPosition(z, j, v, video);
+		Emits('kejianInfo', {
+			...video,
+			kjId: video.kjId
+		});
+	};
+	defineExpose({
+	  playNextVideo
+	});
+</script>
+
+<style lang="scss">
+
+</style>

+ 6 - 10
pages/course/kechengInfo.vue

@@ -14,7 +14,6 @@
 				<text>1人学习</text>
 			</view>
 		</view>
-
 		<!-- 选项卡 -->
 		<view class="course-tabs">
 			<text :class="['tab-item', activeTab === '目录' ? 'active' : '']" @click="activeTab = '目录'">目录</text>
@@ -22,12 +21,10 @@
 			<text :class="['tab-item', activeTab === '评论' ? 'active' : '']" @click="activeTab = '评论'">评论</text>
 			<text :class="['tab-item', activeTab === '考试' ? 'active' : '']" @click="activeTab = '考试'">考试</text>
 		</view>
-
 		<!-- 目录内容 -->
-		<view v-if="activeTab === '目录'" class="course-content">
-			<catalogue ref="catalogueRef" @kejianInfo='getKejianInfo' :options="kejianUserVo" 
+		<view v-if="activeTab == '目录'" class="course-content">
+			<catalogue  ref="catalogueRef"  @kejianInfo='getKejianInfo' :options="kejianUserVo"
 				:current-video="currentVideo"></catalogue>
-
 		</view>
 
 	</view>
@@ -64,10 +61,10 @@
 	onLoad((options) => {
 		console.log('options', options);
 		kcId.value = options.kcId
-		getKechengData()
+
 	});
 	onMounted(() => {
-
+		getKechengData()
 	});
 
 	function getKechengData() {
@@ -75,8 +72,8 @@
 			kcId: kcId.value
 		}).then(res => {
 			console.log('res', res);
-			kejianUserVo.value = res.data.kejianUserVo
 			activeTab.value = '目录'
+			kejianUserVo.value = res.data.kejianUserVo
 		})
 	}
 
@@ -90,7 +87,7 @@
 			url: 'https://www.w3school.com.cn/example/html5/mov_bbb.mp4',
 			kjId: data.kjId
 		};
-		
+
 		setTimeout(() => {
 			if (!videoContext) {
 				videoContext = uni.createVideoContext(videoId.value, this);
@@ -109,7 +106,6 @@
 	const handleVideoEnd = () => {
 		catalogueRef.value.playNextVideo();
 	};
-
 	const handleVideoLoaded = (e) => {
 		uni.setStorageSync(`duration_${currentVideo.value.kjId}`, e.detail.duration);
 	};

+ 1 - 2
pages/exam/index.vue

@@ -27,8 +27,6 @@
 	const activeKs = ref(null);
 	const scrollRef = ref(null);
 	const examNoticeInfo = ref(null);
-	const textareaHtml = ref(null);
-	const examNoticeShowFlag = ref(false);
 	const ksxzRef = ref(null);
 
 	const tabData = [{
@@ -115,6 +113,7 @@
 		}
 
 	}
+
 </script>
 
 <style lang="scss">