From 709d9fe796a9152cd543f4f3785052a511f295f5 Mon Sep 17 00:00:00 2001 From: yueliuli <1628111725@qq.com> Date: Fri, 8 May 2026 14:52:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/hazard_inspect/ItemList.vue | 6 ++-- src/pages/nav/HazardCheckResult/index.vue | 42 ++++++++-------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/components/hazard_inspect/ItemList.vue b/src/components/hazard_inspect/ItemList.vue index 9bee426..661bbc6 100644 --- a/src/components/hazard_inspect/ItemList.vue +++ b/src/components/hazard_inspect/ItemList.vue @@ -18,8 +18,8 @@ const props = defineProps({ const emit = defineEmits(['click']) // 点击项,向外抛出数据 -function handleItemClick(item: string, index: number) { - emit('click', item, index) +function handleItemClick(index: number) { + emit('click', index) } @@ -38,7 +38,7 @@ function handleItemClick(item: string, index: number) { - + {{ index + 1 }} diff --git a/src/pages/nav/HazardCheckResult/index.vue b/src/pages/nav/HazardCheckResult/index.vue index 0bf9023..6c3453a 100644 --- a/src/pages/nav/HazardCheckResult/index.vue +++ b/src/pages/nav/HazardCheckResult/index.vue @@ -131,9 +131,9 @@ const totalFrames = computed(() => { return maxEndFrame + 100 }) -function handleTimelineHazardClick(hazardId: string) { - selectedHazard.value = Number(hazardId) - handleJumpToHazard(Number(hazardId)) +function handleTimelineHazardClick(hazardId: number) { + selectedHazard.value = hazardId + handleJumpToHazard(hazardId) } function handleFrameChange(frame: number) { @@ -209,7 +209,7 @@ function getData() { } // 点击隐患列表项,更新选中隐患 -function handleHazardClick(item: string, index: number) { +function handleHazardClick(index: number) { selectedHazard.value = index handleJumpToHazard(selectedHazard.value) @@ -221,10 +221,10 @@ function handleJumpToHazard(index: number) { // 实现跳转到指定时间点的逻辑 // console.log(`跳转到时间点: ${seconds}`) - handleJumpToTimePoint(seconds) + handleJumpToTimePoint(seconds, 'pause') } -function handleJumpToTimePoint(seconds: number) { +function handleJumpToTimePoint(seconds: number, action: string = 'play') { // 校验:必须是数字且大于等于0 if (Number.isNaN(seconds) || seconds < 0) return @@ -236,23 +236,10 @@ function handleJumpToTimePoint(seconds: number) { // 直接设置 currentTime 实现跳转 videoEl.currentTime = seconds currentFrame.value = Math.floor(seconds * 30) - - // 跳转后自动暂停 - videoEl.pause() -} - -function handlePlayAndSeek(item: any[]) { - const seconds = item[0] - if (Number.isNaN(seconds) || seconds < 0) - return - - const videoEl = videoRef.value - if (!videoEl) - return - - videoEl.currentTime = seconds - currentFrame.value = Math.floor(seconds * 30) - videoEl.play() + if (action === 'play') + videoEl.play() + else if (action === 'pause') + videoEl.pause() } function getAudioRecData(res: any) { @@ -373,8 +360,7 @@ onMounted(async () => { getData() if (data.value.隐患列表.length > 0) { - selectedHazard.value = 0 - handleJumpToHazard(0) + handleHazardClick(0) } }) @@ -432,7 +418,7 @@ onMounted(async () => { :current-frame="currentFrame" :total-frames="totalFrames" :hazard-ranges="data.隐患范围字典 as Record" - @hazard-click="(id: number) => handleTimelineHazardClick(String(id))" + @hazard-click="(id: number) => handleTimelineHazardClick(id)" @frame-change="handleFrameChange" /> @@ -483,8 +469,8 @@ onMounted(async () => { :data="data.对话列表" :current-time="videoCurrentTime" :keywords="keywords" - @click="(item: any[]) => handleJumpToTimePoint(Number(item[0]))" - @play="(item: any[]) => handlePlayAndSeek(item)" + @click="(item: any[]) => handleJumpToTimePoint(Number(item[0]), 'pause')" + @play="(item: any[]) => handleJumpToTimePoint(Number(item[0]), 'play')" />