Ver código fonte

路由切换/跳转论坛(纠错/技术/普通)

canghailong 7 meses atrás
pai
commit
b51b23cdbf

+ 5 - 3
src/views/forum/addForum.vue

@@ -179,8 +179,10 @@
 				resourceId: route.query.id
 			}
 		}
-		let videoUrl = decodeURIComponent(atob(route.query.videoUrl))
-		let html = `<p>${route.query.title}</p><video controls name="media" style="width:100%; height: auto;"><source src="${videoUrl}"></video>`
-		formData.value.postContent = html
+		let videoUrl = route.query.videoUrl ? decodeURIComponent(atob(route.query.videoUrl)) : ''
+		if (videoUrl) {
+			let html = `<p>${route.query.title}</p><video controls name="media" style="width:100%; height: auto;"><source src="${videoUrl}"></video>`
+			formData.value.postContent = html
+		}
 	}
 </script>

+ 14 - 9
src/views/portal/components/Header.vue

@@ -4,7 +4,7 @@
 	管理员 -->
 	<div v-if="userInfo.eduIdentity == 2" class="fcbc">
 		<div class="headerBtn">
-			<a-menu v-model:selectedKeys="current" mode="horizontal">
+			<a-menu v-model:selectedKeys="current" mode="horizontal" @select="menuSelect">
 				<a-menu-item key="student/resourceCenter">资源中心</a-menu-item>
 				<a-menu-item key="student/courseCenter">课程中心</a-menu-item>
 				<a-sub-menu key="myList">
@@ -60,14 +60,19 @@
 	const current = ref([route.path.slice(1)]) // 默认选中“资源中心”
 	const emit = defineEmits(['onChangeCurrent'])
 	const userInfo = tool.data.get('USER_INFO')
-	watch(
-		() => current.value,
-		(newVal, oldVal) => {
-			if (newVal != oldVal) {
-				emit('onChangeCurrent', newVal)
-			}
-		}
-	)
+	
+	watch(route, (newValue) => {
+		current.value = []
+		nextTick(()=>{
+			current.value = [newValue.path.slice(1)]
+		})
+	})
+	const menuSelect = (obj) => {
+		const pathLength = obj.keyPath.length
+		const path = '/' + obj.keyPath[pathLength - 1]
+		router.push({ path })
+		current.value = obj.selectedKeys
+	}
 	const jump = (url) => {
 		router.push({
 			path: url

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

@@ -1,7 +1,7 @@
 <template>
 	<div style="overflow-y: auto">
 		<a-layout>
-			<Header @onChangeCurrent="onChangeCurrent" />
+			<Header />
 			<a-layout-content class="main-content-wrapper">
 				<div class="flc">
 					<router-view v-slot="{ Component }" :key="route.fullPath" style="width: 1200px"></router-view>
@@ -19,11 +19,6 @@
 	const route = useRoute()
 	const router = useRouter()
 	const ResourceDetailsRef = ref(null)
-	const onChangeCurrent = (current) => {
-		router.push({
-			path: '/' + current
-		})
-	}
 </script>
 
 <style scoped>

+ 1 - 7
src/views/resourceDetails/components/EqualItem.vue

@@ -74,13 +74,7 @@
 		// emit('handlerItem', item)
 		EventBus.emit('openResourceDetailsInner', { id: props.item.id })
 	}
-
-	watch(
-		() => props.item,
-		(val) => {
-			console.log('item有变化吗', val)
-		}
-	)
+	
 	const handerPublish = () => {
 		tallTag.value = false
 		emit('publish')

+ 0 - 6
src/views/resourceDetails/components/TallItem.vue

@@ -131,12 +131,6 @@
 
 		// listUnpublishedView.value.setData(tableData.value)
 	}
-	watch(
-		() => props.item,
-		(val) => {
-			console.log('item有变化吗', val)
-		}
-	)
 
 	const handerfollw = async () => {
 		await giveComment({ id: props.item.id })

+ 0 - 1
src/views/resourceDetails/components/TallList.vue

@@ -236,7 +236,6 @@
 	const getPageCommentNew = (data) => {
 		list({ ...currentPage, ...data })
 			.then((res) => {
-				console.log('下面列表获取getPageCommentNew', res)
 				if (res.code == 200) {
 					equalList.value = res.data.records
 					currentPage.current = res.data.current

+ 0 - 8
src/views/resourceDetails/components/VideoDetails.vue

@@ -216,7 +216,6 @@
 		window.open(src)
 	}
 	const handlerShareDialog = () => {
-		console.log('打开分享弹窗')
 		getShareLink({ id: route.query.id })
 			.then((res) => {
 				if (res.code == 200) {
@@ -226,7 +225,6 @@
 			.catch((err) => {})
 	}
 	const handlerCollection = async () => {
-		console.log('打开收藏', itemData.value)
 		const id = route.query.id
 		if (id != undefined && id != '') {
 			if (starTag.value == true) {
@@ -280,7 +278,6 @@
 					itemData.value.keywordList.forEach((item) => {
 						tags.value.push(item.wordName)
 					})
-					console.log('应该施舍你们', tags.value)
 					//关键的资源在线地址
 					// resSrc.value = sysConfig.FILE_URL + itemData.value.fileUrl
 					resSrc.value = sysConfig.FILE_URL + itemData.value.priviewFileUrl
@@ -289,7 +286,6 @@
 					// imagess.value = 'http://192.168.1.245:10005/education/' + itemData.value.priviewFileUrl
 
 					// VideoDetailsRef.value.setData(res.sdata)
-					console.log('发消息去请求网卡罗')
 					emit('onGetPageCommentNew', {
 						resourceType: itemData.value.resourceType,
 						resourceTwoType: itemData.value.resourceTwoType
@@ -300,7 +296,6 @@
 	}
 
 	const upDataList = (item) => {
-		console.log('upDataList', item)
 		resourcecentreDetail({ id: item.id })
 			.then((res) => {
 				if (res.code == 200) {
@@ -336,7 +331,6 @@
 	watch(
 		() => route,
 		(newRoute) => {
-			console.log('路由发生变化', newRoute)
 			fetchData() // 手动刷新数据的方法
 		},
 		{ deep: true, immediate: true }
@@ -352,8 +346,6 @@
 		}
 	}
 	const openResourceDetailsInner = (data) => {
-		console.log('收到消息了吗', data)
-
 		router.push({
 			path: '/portal/resourceDetails',
 			query: {

+ 0 - 1
src/views/resourceDetails/index.vue

@@ -95,7 +95,6 @@
 	}
 	const forumData = computed(() => {
 		return {
-			postType: 2,
 			id: route.query.id,
 			title: itemData.value.fileName ,
 		}

+ 21 - 5
src/views/student/classCentre/form.vue

@@ -13,9 +13,12 @@
 		</div>
 		<div v-if="itemObj.key == 3" style="height: 100%">
 			<div v-if="subtitle">{{ subtitle }}</div>
-			<div v-for="(item, idx) in itemObj.srtInfoList" :key="idx">
-				<div>{{ item.startTime }}~{{ item.endTime }}</div>
-				<div style="cursor: pointer; padding: 10px 0" @click="videoSpeed(item)">{{ item.text }}</div>
+			<a-input v-model:value="subtitleVal" allowClear placeholder="请输入" />
+			<div class="mt-2 subtitleBox pb-4">
+				<div v-for="(item, idx) in subtitleList" :key="idx">
+					<div>{{ item.startTime }}~{{ item.endTime }}</div>
+					<div style="cursor: pointer; padding: 10px 0" @click="videoSpeed(item)">{{ item.text }}</div>
+				</div>
 			</div>
 		</div>
 		<div v-if="itemObj.type == 2 || itemObj.type == 4">
@@ -165,8 +168,6 @@
 				} catch (error) {
 					subtitle.value = '字幕解析失败'
 				}
-
-				console.log('解析之后的字幕内容', textList)
 			})
 			.catch(function (error) {
 				console.log(error)
@@ -187,6 +188,17 @@
 	function errorHandler() {
 		showPdf.value = false
 	}
+	// 模糊查询函数
+	const subtitleVal = ref()
+	const subtitleList = computed(() => {
+		return itemObj.value.srtInfoList?.filter((item) => {
+			if (subtitleVal.value) {
+				return item.text.includes(subtitleVal.value)
+			} else {
+				return true
+			}
+		})
+	})
 	// 调用这个函数将子组件的一些数据和方法暴露出去
 	defineExpose({
 		onOpen
@@ -202,4 +214,8 @@
 		height: 750px;
 		overflow-y: auto;
 	}
+	.subtitleBox {
+		height: 100%;
+		overflow-y: auto;
+	}
 </style>

+ 39 - 22
src/views/student/classCentre/index.vue

@@ -73,9 +73,10 @@
 								</div>
 							</a-tab-pane>
 							<a-tab-pane key="2" tab="字幕">
-								<div style="height: 900px; overflow-y: auto">
+								<a-input v-model:value="subtitleVal" allowClear placeholder="请输入" />
+								<div style="height: 900px; overflow-y: auto" class="mt-2">
 									<div v-if="subtitle">{{ subtitle }}</div>
-									<div v-for="(item, idx) in danmuObj.srtInfoList" :key="idx">
+									<div v-for="(item, idx) in subtitleList" :key="idx">
 										<div>{{ item.startTime }}~{{ item.endTime }}</div>
 										<div style="cursor: pointer; padding: 10px 0" @click="videoSpeed(item)">{{ item.text }}</div>
 									</div>
@@ -205,24 +206,29 @@
 			timeStamp1.value = parseInt(e.target.currentTime) //播放进度 (秒)
 			biNum.value = Math.floor((timeStamp1.value / allTime.value) * 10000) / 100 //暂时没用到
 			currentTime.value = e.target.currentTime
-			if (newsschedule.value <= currentTime.value) {
-				//请求接口获取的参数就是判断当前观看的时长是否小于当前时间 小于当前时间就禁止拖动进度条
+			if (videoJumpTime.value) {
+				videoJumpTime.value = false
+				newsschedule.value = currentTime.value
+			} else {
+				if (newsschedule.value <= currentTime.value) {
+					//请求接口获取的参数就是判断当前观看的时长是否小于当前时间 小于当前时间就禁止拖动进度条
 
-				if (e.srcElement.currentTime - currTime.value > 3) {
-					//这里拖动进度条时间 - 当前观看的时长 > 3秒 这边判定它为拖动进度条
-					e.srcElement.currentTime = currTime.value > maxTime.value ? currTime.value : maxTime.value
-					let newsVal = initialtime.value
-					if (newsVal) {
-						videoContext.value.currentTime = newsVal
+					if (e.srcElement.currentTime - currTime.value > 3) {
+						//这里拖动进度条时间 - 当前观看的时长 > 3秒 这边判定它为拖动进度条
+						e.srcElement.currentTime = currTime.value > maxTime.value ? currTime.value : maxTime.value
+						let newsVal = initialtime.value
+						if (newsVal) {
+							videoContext.value.currentTime = newsVal
+						}
+						//当前用户记录观看时间 大于 实施播放时间
+						if (currTime.value > newsVal) {
+							videoContext.value.currentTime = currTime.value
+						}
+						console.log('快进了')
 					}
-					//当前用户记录观看时间 大于 实施播放时间
-					if (currTime.value > newsVal) {
-						videoContext.value.currentTime = currTime.value
-					}
-					console.log('快进了')
+					currTime.value = e.srcElement.currentTime
+					maxTime.value = currTime.value > maxTime.value ? currTime.value : maxTime.value
 				}
-				currTime.value = e.srcElement.currentTime
-				maxTime.value = currTime.value > maxTime.value ? currTime.value : maxTime.value
 			}
 		}
 	}
@@ -234,7 +240,9 @@
 	const askEdit = (e) => {
 		rightNenuRef.value.selectBtn({ key: 7, type: 4 }, e)
 	}
+	const videoJumpTime = ref(false)
 	const videoSpeed = (e) => {
+		videoJumpTime.value = true
 		currentTimenew.value = e.startTime
 	}
 	//获取字幕内容,发送一个get请求
@@ -259,7 +267,6 @@
 							}
 						})
 					danmuObj.value.srtInfoList = textList
-					console.log('解析之后的字幕内容', textList)
 				} catch (error) {
 					subtitle.value = '字幕解析失败'
 				}
@@ -282,7 +289,6 @@
 	const forumData = computed(() => {
 		let item = findNodeByKey(classTimeList.value, selectedKeys.value[0])
 		return {
-			postType: 2,
 			id: selectedKeys.value[0],
 			title: item?.name,
 			videoUrl: btoa(encodeURIComponent(videoRef.value?.src))
@@ -295,8 +301,8 @@
 	const subtitle = ref()
 	const getVideoTime = () => {
 		classCentre.theLastDetail().then((data) => {
-			initialtime.value = parseFloat(data.endTime)/1000
-			currentTimenew.value = parseFloat(data.endTime)/1000
+			initialtime.value = parseFloat(data.endTime) / 1000
+			currentTimenew.value = parseFloat(data.endTime) / 1000
 		})
 	}
 	getVideoTime()
@@ -340,7 +346,7 @@
 			classCentre
 				.classPlanAdd({
 					startTime: parseFloat(initialtime.value),
-					endTime: Math.round(videoRef.value.currentTime*1000),
+					endTime: Math.round(videoRef.value.currentTime * 1000),
 					progress: Math.round(progress),
 					hourId: selectedKeys.value[0],
 					stayTime: outNowTimesStr.value - nowTimesStr
@@ -362,6 +368,17 @@
 				})
 			})
 	}
+	// 模糊查询函数
+	const subtitleVal = ref()
+	const subtitleList = computed(() => {
+		return danmuObj.value.srtInfoList?.filter((item) => {
+			if (subtitleVal.value) {
+				return item.text.includes(subtitleVal.value)
+			} else {
+				return true
+			}
+		})
+	})
 </script>
 <style scoped lang="less">
 	.classTitle {

+ 0 - 1
src/views/student/exam/paper/do.vue

@@ -179,7 +179,6 @@
 
 	const forumData = computed(() => {
 		return {
-			postType: 2,
 			id: route.query.id,
 			title: form.name ,
 		}

+ 0 - 1
src/views/student/exam/paper/read.vue

@@ -110,7 +110,6 @@
 	})
 	const forumData = computed(() => {
 		return {
-			postType: 2,
 			id: route.query.id,
 			title: form.value.name ,
 		}

+ 42 - 32
src/views/student/forumBtn/index.vue

@@ -1,31 +1,38 @@
 <template>
-	<div class="redressBox" @click="jumpRedressUrl">
-		<a-tooltip
-			title="纠错"
-			v-if="props.isShow.includes(2)"
-			:getPopupContainer="(trigger) => trigger.parentElement"
-			placement="left"
-		>
-			<CommentOutlined style="font-size: 40px" />
-		</a-tooltip>
-		<a-tooltip
-			title="技术"
-			v-if="props.isShow.includes(1)"
-			:getPopupContainer="(trigger) => trigger.parentElement"
-			class="ml-2"
-			placement="left"
-		>
-			<CommentOutlined style="font-size: 40px" />
-		</a-tooltip>
-		<a-tooltip
-			title="讨论"
-			v-if="props.isShow.includes(3)"
-			:getPopupContainer="(trigger) => trigger.parentElement"
-			class="ml-2"
-			placement="left"
-		>
-			<CommentOutlined style="font-size: 40px" />
-		</a-tooltip>
+	<div class="redressBox">
+		<div @click="jumpRedressUrl(2)">
+			<a-tooltip
+				title="纠错"
+				v-if="props.isShow.includes(2)"
+				:getPopupContainer="(trigger) => trigger.parentElement"
+				placement="left"
+			>
+				<CommentOutlined style="font-size: 40px" />
+			</a-tooltip>
+		</div>
+
+		<div @click="jumpRedressUrl(1)">
+			<a-tooltip
+				title="技术"
+				v-if="props.isShow.includes(1)"
+				:getPopupContainer="(trigger) => trigger.parentElement"
+				class="ml-2"
+				placement="left"
+			>
+				<CommentOutlined style="font-size: 40px" />
+			</a-tooltip>
+		</div>
+		<div @click="jumpRedressUrl(3)">
+			<a-tooltip
+				title="讨论"
+				v-if="props.isShow.includes(3)"
+				:getPopupContainer="(trigger) => trigger.parentElement"
+				class="ml-2"
+				placement="left"
+			>
+				<CommentOutlined style="font-size: 40px" />
+			</a-tooltip>
+		</div>
 	</div>
 </template>
 
@@ -33,19 +40,22 @@
 	import { useRoute, useRouter } from 'vue-router'
 	const router = useRouter()
 	const props = defineProps({
-		isShow:{
-			type:Array,
-			default:[1,2,3]
+		isShow: {
+			type: Array,
+			default: [1, 2, 3]
 		},
 		forumData: {
 			type: Object,
 			default: () => {}
 		}
 	})
-	const jumpRedressUrl = () => {
+	const jumpRedressUrl = (t) => {
 		router.push({
 			path: '/forum/addForum',
-			query: props.forumData
+			query: {
+				...props.forumData,
+				postType: t
+			}
 		})
 	}
 </script>