Browse Source

讲义添加文件名称/文件id/文件路径
讲义添加开始时间/结束时间

canghailong 6 months ago
parent
commit
ef28a8db85

+ 11 - 3
src/views/student/classCentre/form.vue

@@ -8,7 +8,7 @@
 		:mask="false"
 	>
 		<div v-if="itemObj.key == 2" style="height: 100%">
-			<handouts :itemObj="itemObj" :hourId="idsObj.hourId"></handouts>
+			<handouts :itemObj="itemObj" :hourId="idsObj.hourId" :videoObj="props.videoObj" :classDetailParams="props.classDetailParams"></handouts>
 		</div>
 		<note v-if="itemObj.key == 6" :idsObj="idsObj" ref="noteRef" @videoSpeed="videoSpeed" @videoStopTime="videoStopTime"></note>
 		<div v-if="itemObj.key == 3" style="height: 100%">
@@ -27,11 +27,19 @@
 	const props = defineProps({
 		rightItem: {
 			type: [Array, Object],
-			required: () => {}
+			default: () => {}
 		},
 		idsObj: {
 			type: [Array, Object],
-			required: () => {}
+			default: () => {}
+		},
+		videoObj: {
+			type: [Array, Object],
+			default: () => {}
+		},
+		classDetailParams:{
+			type: [Array, Object],
+			default: () => {}
 		}
 	})
 	const itemObj = computed(() => {

+ 35 - 24
src/views/student/classCentre/handouts.vue

@@ -33,15 +33,27 @@
 		hourId: {
 			type: [String, Number],
 			default: 0
+		},
+		videoObj: {
+			type: Object,
+			default: () => {}
+		},
+		classDetailParams:{
+			type: [Array, Object],
+			default: () => {}
 		}
 	})
-	const pdfSrc = computed(()=>props.itemObj.url)
-	watch(() => pdfSrc.value, (newUrl, oldUrl) => {
-		showPdf.value = true
-		scrollPercent.value = 0
-		maxStr.value = 0
-	}, { immediate: true })
-	
+	const pdfSrc = computed(() => props.itemObj.url)
+	watch(
+		() => pdfSrc.value,
+		(newUrl, oldUrl) => {
+			showPdf.value = true
+			scrollPercent.value = 0
+			maxStr.value = 0
+		},
+		{ immediate: true }
+	)
+
 	function errorHandler(e) {
 		pdfSrc.value = ''
 		showPdf.value = false
@@ -71,28 +83,27 @@
 	const nowTimesStr = Date.now()
 	const outNowTimesStr = ref()
 	const addClassPlan = () => {
-		classCentre
-			.classPlanAdd({
-				hourId: props.hourId,
-				type: 2,
-				funcType: 2
-			})
-			.then((data) => {})
+		classCentre.classPlanAdd({
+			hourId: props.hourId,
+			type: 2,
+			funcType: 2
+		})
 	}
 	const addScrollPlan = () => {
 		const el = pdfRef.value?.$el
 		if (el && el.clientHeight == el.scrollHeight) {
 			maxStr.value = 100
 		}
-		classCentre
-			.classPlanAdd({
-				progress: showPdf.value ? maxStr.value : 0,
-				hourId: props.hourId,
-				stayTime: outNowTimesStr.value - nowTimesStr,
-				type: 1,
-				funcType: 2
-			})
-			.then((data) => {})
+		classCentre.classPlanAdd({
+			progress: showPdf.value ? maxStr.value : 0,
+			hourId: props.hourId,
+			stayTime: outNowTimesStr.value - nowTimesStr,
+			type: 1,
+			funcType: 2,
+			startTime: parseFloat(props.videoObj?.initialtime ?? 0),
+			endTime: Math.round(props.videoObj.currentTime * 1000),
+			...props.classDetailParams
+		})
 	}
 	function renderedHandler(e) {
 		showPdf.value = true
@@ -112,4 +123,4 @@
 		justify-content: space-between;
 		align-items: center;
 	}
-</style>
+</style>

+ 43 - 30
src/views/student/classCentre/index.vue

@@ -70,35 +70,42 @@
 						ref="rightNenuRef"
 						@videoSpeed="videoSpeed"
 						@videoStopTime="videoStopTime"
+						:videoObj="videoObj"
+						:classDetailParams="classDetailParams"
 					></rightMenu>
 				</a-card>
 				<a-card :bordered="false" class="mt-3">
 					<div>
 						<div>
-							<div v-for="(item,idx) in webCon" >
+							<div v-for="(item, idx) in webCon">
 								<a :href="item.href" target="_blank">{{ item.title }}</a>
 							</div>
 						</div>
 						<a-divider />
 						<div>
 							在小学和初中,我们已经接触过一些集合.例如,自然数的集合,同一平面内到一个定点的距离等于定长的点的集合(即圆)等.为了更有效地使用集合语言,我们需要进一步了解集合的有关知识.下面先从集合的含义开始.
-							看下面的例子:<br/>
-							(1)1~10之间的所有偶数;<br/>
-							(2)立德中学今年人学的全体高一学生;<br/>
-							(3)所有的正方形;<br/>
-							(4)到直线l的距离等于定长d的所有点<br/>
-							(5)方程x’-3x+2=0的所有实数根;<br/>
-							(6)地球上的四大洋.<br/>
-							例(1)中,我们把1~10之间的每一个偶数作为元素,这些元素的全体就是一个集合;同样地,<br/>
+							看下面的例子:<br />
+							(1)1~10之间的所有偶数;<br />
+							(2)立德中学今年人学的全体高一学生;<br />
+							(3)所有的正方形;<br />
+							(4)到直线l的距离等于定长d的所有点<br />
+							(5)方程x’-3x+2=0的所有实数根;<br />
+							(6)地球上的四大洋.<br />
+							例(1)中,我们把1~10之间的每一个偶数作为元素,这些元素的全体就是一个集合;同样地,<br />
 							例(2)中,把立德中学今年人学的每一位高一学生作为元素,这些元素的全体也是一个集合.
 						</div>
 					</div>
 				</a-card>
 				<div style="display: flex; justify-content: center">
-					<a-card :bordered="false" class="mt-2" style="width: 100%;padding-right: 30px;">
+					<a-card :bordered="false" class="mt-2" style="width: 100%; padding-right: 30px">
 						<a-tabs v-model:activeKey="tabsActiveKey">
 							<a-tab-pane key="1" tab="讲义" style="height: 800px">
-								<handouts :itemObj="itemObj" :hourId="classHourData.id" v-if="classHourData"></handouts>
+								<handouts
+									:itemObj="itemObj"
+									:hourId="classHourData.id"
+									v-if="classHourData"
+									:videoObj="videoObj"
+								></handouts>
 							</a-tab-pane>
 							<a-tab-pane key="2" tab="字幕" style="height: 800px">
 								<subtitleBox :url="danmuObj.url" v-if="tabsActiveKey == 2" @videoSpeed="videoSpeed"></subtitleBox>
@@ -258,6 +265,12 @@
 	const allTime = ref()
 	const biNum = ref()
 	const currentTime = ref()
+	const videoObj = computed(() => {
+		return {
+			initialtime: initialtime.value,
+			currentTime: videoRef.value?.currentTime
+		}
+	})
 	const videoStart = () => {
 		videoContext.value = videoRef.value
 		if (initialtime.value > 0) {
@@ -386,15 +399,15 @@
 	}
 	const classDetailParams = computed(() => {
 		return {
-			hourName: classHourData.value.name,
-			chapterName: classHourData.value.name,
-			courseName: classDetail.value.courseName,
-			hourId: classHourData.value.id,
+			hourName: classHourData.value?.name,
+			chapterName: classHourData.value?.name,
+			courseName: classDetail.value?.courseName,
+			hourId: classHourData.value?.id,
 			chapterId: selectedKeys.value[0],
-			courseId: classDetail.value.courseId,
-			fileId: classHourData.value.courseRelates.find((r) => r.funcType == 1)?.relateId,
-			fileName: classHourData.value.courseRelates.find((r) => r.funcType == 1)?.name,
-			filePath: classHourData.value.courseRelates.find((r) => r.funcType == 1)?.url
+			courseId: classDetail.value?.courseId,
+			fileId: classHourData.value?.courseRelates.find((r) => r.funcType == 1)?.relateId,
+			fileName: classHourData.value?.courseRelates.find((r) => r.funcType == 1)?.name,
+			filePath: classHourData.value?.courseRelates.find((r) => r.funcType == 1)?.url
 		}
 	})
 	//足迹
@@ -415,25 +428,25 @@
 	}
 	const webCon = ref([
 		{
-			title:'1.1 集合的概念',
-			href:'/webEmpty'
+			title: '1.1 集合的概念',
+			href: '/webEmpty'
 		},
 		{
-			title:'1.2 集合间的基本关系',
-			href:'/webEmpty'
+			title: '1.2 集合间的基本关系',
+			href: '/webEmpty'
 		},
 		{
-			title:'1.3 集合的基本运算',
-			href:'/webEmpty'
+			title: '1.3 集合的基本运算',
+			href: '/webEmpty'
 		},
 		{
-			title:'1.4 充分条件与必要条件',
-			href:'/webEmpty'
+			title: '1.4 充分条件与必要条件',
+			href: '/webEmpty'
 		},
 		{
-			title:'1.5 全称量词与存在量词',
-			href:'/webEmpty'
-		},
+			title: '1.5 全称量词与存在量词',
+			href: '/webEmpty'
+		}
 	])
 	onMounted(() => {
 		getClassData()

+ 11 - 1
src/views/student/classCentre/rightMenu.vue

@@ -14,6 +14,8 @@
 			:rightItem="rightItem"
 			@videoSpeed="videoSpeed"
 			@videoStopTime="videoStopTime"
+			:videoObj="props.videoObj"
+			:classDetailParams="props.classDetailParams"
 		></rightContent>
 	</div>
 </template>
@@ -33,7 +35,15 @@
 		},
 		idsObj: {
 			type: [Array, Object],
-			required: () => {}
+			default: () => {}
+		},
+		videoObj:{
+			type: [Array, Object],
+			default: () => {}
+		},
+		classDetailParams:{
+			type: [Array, Object],
+			default: () => {}
 		}
 	})
 	import {