Просмотр исходного кода

视频封面/讲义宽度适应/切换章节关闭右侧

canghailong 6 месяцев назад
Родитель
Сommit
d14d191b00

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

@@ -7,7 +7,7 @@
 		@close="onClose"
 		:mask="false"
 	>
-		<div v-if="itemObj.key == 2" style="height: 100%;">
+		<div v-if="itemObj.key == 2" style="height: 100%">
 			<handouts :itemObj="itemObj" :hourId="idsObj.hourId"></handouts>
 		</div>
 		<div v-if="itemObj.key == 3" style="height: 100%">
@@ -137,7 +137,8 @@
 	}
 	// 调用这个函数将子组件的一些数据和方法暴露出去
 	defineExpose({
-		onOpen
+		onOpen,
+		onClose
 	})
 </script>
 <style scoped lang="less">

+ 2 - 2
src/views/student/classCentre/handouts.vue

@@ -1,15 +1,15 @@
 <template>
-	<div style="height: 900px">
+	<div style="height: 900px;overflow-y: auto;">
 		<div v-if="!showPdf">渲染pdf失败</div>
 		<div class="mb-4" v-if="showPdf">
 			<a-button type="primary" @click="downPdf">下载讲义</a-button>
 		</div>
 		<vue-office-pdf
 			:src="props.itemObj.url"
-			style="width: 100%; height: 100%"
 			@error="errorHandler"
 			ref="scrollDiv"
 			@scroll="handleScroll"
+			:options="{width:'100%'}"
 		/>
 	</div>
 </template>

+ 5 - 0
src/views/student/classCentre/index.vue

@@ -56,6 +56,7 @@
 						Controlslist="nodownload noplaybackrate noremoteplayback disablePictureInPicture"
 						@timeupdate="timeUpdate"
 						:currentTime="currentTimenew"
+						:poster="videoPoster"
 					>
 						<source :src="videoUrl" type="video/mp4" />
 						<source :src="videoUrl" type="video/ogg" />
@@ -128,6 +129,9 @@
 		}
 		return null
 	}
+	const videoPoster = computed(()=>{
+		return classTimeData.value.filter((r) => r.funcType == 0)[0]?.url
+	})
 	const getClassData = () => {
 		classCentre.addViewCount({ courseId: route.query.id })
 		classCentre.courseDetail({ courseId: route.query.id }).then((data) => {
@@ -143,6 +147,7 @@
 	}
 	const classHourData = ref()
 	const menuClick = (e) => {
+		rightNenuRef.value.onClose();
 		classCentre.courseTimeDetail({ id: e?.key ? e.key : selectedKeys.value[0] }).then((data) => {
 			classHourData.value = data
 			classTimeData.value = data.courseRelates.map((r) => {

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

@@ -124,8 +124,12 @@
 	const videoSpeed = (e) => {
 		emit('videoSpeed', e)
 	}
+	const onClose = ()=>{
+		formRef.value.onClose()
+	}
 	defineExpose({
-		selectBtn
+		selectBtn,
+		onClose
 	})
 </script>
 <style scoped lang="less">