From 633b6ffd296902b690935f96688ae27baa844db6 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Mon, 1 Jun 2026 11:07:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=92=AD=E6=94=BE=E8=A7=86?= =?UTF-8?q?=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/utils/detectionLockDialog.ts | 2 ++ frontend/src/utils/resourceManageAutoplay.ts | 11 +++++++++++ frontend/src/views/home/components/preTest.vue | 5 ++++- frontend/src/views/resourceManage/index.vue | 12 +++++++++++- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 frontend/src/utils/resourceManageAutoplay.ts diff --git a/frontend/src/utils/detectionLockDialog.ts b/frontend/src/utils/detectionLockDialog.ts index 98b8b1c..af0127c 100644 --- a/frontend/src/utils/detectionLockDialog.ts +++ b/frontend/src/utils/detectionLockDialog.ts @@ -2,12 +2,14 @@ import { ElMessage, ElMessageBox } from 'element-plus' import router from '@/routers' import type { DetectionLockHolder } from '@/stores/modules/detectionLock' import mittBus, { STOP_DETECTION_TIMER_EVENT } from '@/utils/mittBus' +import { requestResourceManageAutoplayFirst } from '@/utils/resourceManageAutoplay' const stopDetectionTimer = () => { mittBus.emit(STOP_DETECTION_TIMER_EVENT) } const goResourceManage = async () => { + requestResourceManageAutoplayFirst() if (router.hasRoute('resourceManage')) { await router.push({ name: 'resourceManage' }) return diff --git a/frontend/src/utils/resourceManageAutoplay.ts b/frontend/src/utils/resourceManageAutoplay.ts new file mode 100644 index 0000000..1ba3595 --- /dev/null +++ b/frontend/src/utils/resourceManageAutoplay.ts @@ -0,0 +1,11 @@ +let shouldAutoplayFirstVideo = false + +export const requestResourceManageAutoplayFirst = () => { + shouldAutoplayFirstVideo = true +} + +export const consumeResourceManageAutoplayFirst = () => { + if (!shouldAutoplayFirstVideo) return false + shouldAutoplayFirstVideo = false + return true +} diff --git a/frontend/src/views/home/components/preTest.vue b/frontend/src/views/home/components/preTest.vue index 1ebc6eb..d559651 100644 --- a/frontend/src/views/home/components/preTest.vue +++ b/frontend/src/views/home/components/preTest.vue @@ -217,7 +217,10 @@ watch(webMsgSend, function (newValue, oldValue) { handleFatalError(step1, step1InitLog, '电压和电流过载!') } if (newValue.code === 4) { - handleFatalError(step1, step1InitLog, '过载检测成功!') + step1InitLog.value.push({ + type: 'info', + log: '过载测试成功!', + }) } break; case 'yjc_ytxjy': diff --git a/frontend/src/views/resourceManage/index.vue b/frontend/src/views/resourceManage/index.vue index b332c7b..2d51d1b 100644 --- a/frontend/src/views/resourceManage/index.vue +++ b/frontend/src/views/resourceManage/index.vue @@ -39,6 +39,7 @@ import ProTable from '@/components/ProTable/index.vue' import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface' import type { ResourceManage } from '@/api/resourceManage/interface' import { getResourceManageList, getResourceManagePlayUrl } from '@/api/resourceManage' +import { consumeResourceManageAutoplayFirst } from '@/utils/resourceManageAutoplay' import ResourceManagePopup from './components/resourceManagePopup.vue' import ResourcePlayerDialog from './components/resourcePlayerDialog.vue' @@ -51,7 +52,16 @@ const resourceManagePopup = ref() const resourcePlayerDialog = ref() const getTableList = async (params: ResourceManage.ReqResourceManageParams) => { - return getResourceManageList(params) + const response = await getResourceManageList(params) + const firstRecord = response.data.records?.[0] + + if (consumeResourceManageAutoplayFirst()) { + if (firstRecord) { + await handlePlay(firstRecord) + } + } + + return response } const formatFileSize = (size?: number) => {