From e2150515ac0f387eb26843af0c65cfe71f25d985 Mon Sep 17 00:00:00 2001 From: web <candymxq888@outlook.com> Date: 星期五, 13 六月 2025 14:52:37 +0800 Subject: [PATCH] fix:添加检测数据的定时器功能 --- src/views/screen/flow/graphic/index.vue | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/views/screen/flow/graphic/index.vue b/src/views/screen/flow/graphic/index.vue index a769c19..59a7f1f 100644 --- a/src/views/screen/flow/graphic/index.vue +++ b/src/views/screen/flow/graphic/index.vue @@ -1,5 +1,5 @@ <script setup> -import {onMounted, ref} from "vue"; +import {onMounted, onUnmounted, ref} from "vue"; import {getUserType} from '@/utils/auth.js' import {getFlowPointList} from '@/api/screen/index' import {getFlowVideoData} from '@/api/screen/graphic/index.js' @@ -16,6 +16,7 @@ const playerData = ref([]) const showFullScreen = ref(false) const fullIndex = ref() +let timer = null // 全屏弹窗 const handleFullScreen = (index) => { @@ -67,12 +68,24 @@ getFlowVideoData({pointId: id, pointName: searchVal.value}).then(async res => { playerData.value = res.data }) + + if(timer) clearTimeout(timer) + + timer = setInterval(() => { + getFlowVideoData({pointId: id, pointName: searchVal.value}).then(async res => { + playerData.value = res.data + }) + }, 10000) } onMounted(() => { getMoitorList() getPlayerList(route.params.id || '') +}) + +onUnmounted(() => { + if(timer) clearTimeout(timer) }) </script> @@ -121,7 +134,7 @@ <div class="item" v-for="(item, index) in playerData" :key="index"> <div class="title">{{ item.pointName }}</div> <div class="item-video" :id="`player${index}`"> - <VideoPlayer :item="item" :autoPlay="false" /> + <VideoPlayer :item="item" :autoPlay="true" /> </div> <div class="info"> <div class="info-list"> -- Gitblit v1.9.3