Browse Source

问答/笔记/跳转视频时间

canghailong 6 months ago
parent
commit
165e83d05a

+ 1 - 1
src/views/portal/index.vue

@@ -4,7 +4,7 @@
 			<Header />
 			<a-layout-content class="main-content-wrapper">
 				<div class="flc">
-					<router-view v-slot="{ Component }" :key="route.fullPath" style="width: 1200px"></router-view>
+					<router-view v-slot="{ Component }" :key="route.fullPath" style="width: 1200px;min-height: 90vh;"></router-view>
 				</div>
 			</a-layout-content>
 		</a-layout>

+ 32 - 14
src/views/student/classCentre/ask.vue

@@ -25,7 +25,10 @@
 					<div style="width: 100%">
 						<a-list-item-meta>
 							<template #title>
-								<div class="askName">{{ item.userIdName }}</div>
+								<div class="fcbc">
+									<div class="askName">{{ item.userIdName }}</div>
+									<div @click="videoSpeed(item)" style="cursor: pointer">{{ item.videoStopTime }}</div>
+								</div>
 							</template>
 							<template #avatar v-if="item.avatar">
 								<a-avatar :src="item.avatar" />
@@ -109,7 +112,7 @@
 		}
 	})
 	const count = 3
-	const emit = defineEmits({ videoStopTime: null })
+	const emit = defineEmits({ videoStopTime: null, videoSpeed: null })
 	const initLoading = ref(true)
 	const loading = ref(false)
 	const data = ref([])
@@ -128,6 +131,15 @@
 		},
 		pageSize: 10
 	})
+	//毫秒转 00:00:00
+	const formatTime = (milliseconds) => {
+		let totalSeconds = Math.floor(milliseconds / 1000)
+		const hours = Math.floor(totalSeconds / 3600)
+		totalSeconds %= 3600
+		const minutes = Math.floor(totalSeconds / 60)
+		const seconds = totalSeconds % 60
+		return [hours, minutes, seconds].map((val) => val.toString().padStart(2, '0')).join(':')
+	}
 	const getList = () => {
 		delete props.idsObj.parent
 		classCentre
@@ -143,7 +155,9 @@
 				data.records = data.records.map((r) => {
 					return {
 						...r,
-						loading: false
+						loading: false,
+						startTime: r.videoStopTime ?? 0,
+						videoStopTime: formatTime(r.videoStopTime ?? 0)
 					}
 				})
 				listData.value = data.records
@@ -205,23 +219,27 @@
 			.validate()
 			.then(() => {
 				submitLoading.value = true
-				classCentre
-					.askSubmitForm({
-						...props.idsObj,
-						...formDataAdd.value
-					})
-					.then(() => {
-						formRefAdd.value.resetFields()
-						getList()
-						emit('videoStopTime', (e) => {
-							videoStopTime.value = e * 1000
+				emit('videoStopTime', (e) => {
+					videoStopTime.value = e * 1000
+					classCentre
+						.askSubmitForm({
+							...props.idsObj,
+							...formDataAdd.value,
+							videoStopTime: videoStopTime.value
 						})
-					})
+						.then(() => {
+							formRefAdd.value.resetFields()
+							getList()
+						})
+				})
 			})
 			.finally(() => {
 				submitLoading.value = false
 			})
 	}
+	const videoSpeed = (e) => {
+		emit('videoSpeed', e)
+	}
 	// 调用这个函数将子组件的一些数据和方法暴露出去
 	defineExpose({
 		getList

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

@@ -10,11 +10,11 @@
 		<div v-if="itemObj.key == 2" style="height: 100%">
 			<handouts :itemObj="itemObj" :hourId="idsObj.hourId"></handouts>
 		</div>
-		<note v-if="itemObj.type == 2" :idsObj="idsObj" ref="noteRef" @videoStopTime="videoStopTime"></note>
+		<note v-if="itemObj.type == 2" :idsObj="idsObj" ref="noteRef" @videoSpeed="videoSpeed" @videoStopTime="videoStopTime"></note>
 		<div v-if="itemObj.key == 3" style="height: 100%">
 			<subtitleBox :url="itemObj.url" @videoSpeed="videoSpeed"></subtitleBox>
 		</div>
-		<askDiv v-if="itemObj.type == 4" :idsObj="idsObj" ref="noteRef" @videoStopTime="videoStopTime"></askDiv>
+		<askDiv v-if="itemObj.type == 4" :idsObj="idsObj" ref="noteRef" @videoSpeed="videoSpeed" @videoStopTime="videoStopTime"></askDiv>
 	</xn-form-container>
 </template>
 

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

@@ -90,10 +90,10 @@
 								<subtitleBox :url="danmuObj.url" v-if="tabsActiveKey == 2" @videoSpeed="videoSpeed"></subtitleBox>
 							</a-tab-pane>
 							<a-tab-pane key="3" tab="笔记" style="min-height: 800px">
-								<note :idsObj="idsObj" ref="noteRef" v-if="tabsActiveKey == 3" @videoStopTime="videoStopTime"></note>
+								<note :idsObj="idsObj" ref="noteRef" v-if="tabsActiveKey == 3" @videoSpeed="videoSpeed" @videoStopTime="videoStopTime"></note>
 							</a-tab-pane>
 							<a-tab-pane key="4" tab="问答" style="min-height: 800px">
-								<askDiv :idsObj="idsObj" ref="askDivRef" v-if="tabsActiveKey == 4" @videoStopTime="videoStopTime"></askDiv>
+								<askDiv :idsObj="idsObj" ref="askDivRef" v-if="tabsActiveKey == 4" @videoSpeed="videoSpeed" @videoStopTime="videoStopTime"></askDiv>
 							</a-tab-pane>
 						</a-tabs>
 					</a-card>

+ 34 - 14
src/views/student/classCentre/note.vue

@@ -24,7 +24,12 @@
 				<a-skeleton avatar :title="false" :loading="!!item.loading" active>
 					<div style="width: 100%">
 						<a-list-item-meta>
-							<template #title>{{ item.courseName }}</template>
+							<template #title>
+								<div class="fcbc">
+									<div>{{ item.courseName }}</div>
+									<div @click="videoSpeed(item)" style="cursor: pointer">{{ item.videoStopTime }}</div>
+								</div>
+							</template>
 							<template #avatar v-if="item.avatar">
 								<a-avatar :src="item.avatar" />
 							</template>
@@ -85,7 +90,7 @@
 		}
 	})
 	const count = 3
-	const emit = defineEmits({ videoStopTime: null })
+	const emit = defineEmits({ videoStopTime: null, videoSpeed: null })
 	const initLoading = ref(true)
 	const loading = ref(false)
 	const data = ref([])
@@ -104,6 +109,15 @@
 		},
 		pageSize: 10
 	})
+	//毫秒转 00:00:00
+	const formatTime = (milliseconds) => {
+		let totalSeconds = Math.floor(milliseconds / 1000)
+		const hours = Math.floor(totalSeconds / 3600)
+		totalSeconds %= 3600
+		const minutes = Math.floor(totalSeconds / 60)
+		const seconds = totalSeconds % 60
+		return [hours, minutes, seconds].map((val) => val.toString().padStart(2, '0')).join(':')
+	}
 	const getList = () => {
 		delete props.idsObj.parent
 		classCentre
@@ -119,7 +133,9 @@
 				data.records = data.records.map((r) => {
 					return {
 						...r,
-						loading: false
+						loading: false,
+						startTime: r.videoStopTime ?? 0,
+						videoStopTime: formatTime(r.videoStopTime ?? 0)
 					}
 				})
 				listData.value = data.records
@@ -174,23 +190,27 @@
 			.validate()
 			.then(() => {
 				submitLoading.value = true
-				classCentre
-					.notesSubmitForm({
-						...props.idsObj,
-						...formDataAdd.value
-					})
-					.then(() => {
-						formRefAdd.value.resetFields()
-						getList()
-						emit('videoStopTime', (e) => {
-							videoStopTime.value = e * 1000
+				emit('videoStopTime', (e) => {
+					videoStopTime.value = e * 1000
+					classCentre
+						.notesSubmitForm({
+							...props.idsObj,
+							...formDataAdd.value,
+							videoStopTime: videoStopTime.value
+						})
+						.then(() => {
+							formRefAdd.value.resetFields()
+							getList()
 						})
-					})
+				})
 			})
 			.finally(() => {
 				submitLoading.value = false
 			})
 	}
+	const videoSpeed = (e) => {
+		emit('videoSpeed', e)
+	}
 	// 调用这个函数将子组件的一些数据和方法暴露出去
 	defineExpose({
 		getList