From 153f2ce4e26a431971fbdf34c57090a832a2f402 Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Mon, 24 Jul 2023 17:29:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E6=9C=BA=E7=8A=B6=E6=80=81=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Debug.vue | 10 ++++++---- src/pages/index.vue | 10 +++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/Debug.vue b/src/components/Debug.vue index ab73e9e..a5a9774 100644 --- a/src/components/Debug.vue +++ b/src/components/Debug.vue @@ -272,10 +272,12 @@ const websocketonmessage = e => { const websocketonopen = () => { console.log('客户端链接成功!!!') handleGetCameraState() - websocketsend(getCameraParametersInteger) - // 无法获取当前闪光灯是开是关。建议上层代码,初始化时候关闭闪光灯,然后在本地保存一个当前状态 - handleCloseFlashLight() - websocketsend(getFlashBrightnessAnalog) + setTimeout(() => { + websocketsend(getCameraParametersInteger) + // 无法获取当前闪光灯是开是关。建议上层代码,初始化时候关闭闪光灯,然后在本地保存一个当前状态 + handleCloseFlashLight() + websocketsend(getFlashBrightnessAnalog) + }, 1000) } const websocketonerror = () => { diff --git a/src/pages/index.vue b/src/pages/index.vue index b8f4dec..87c13e8 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -536,7 +536,13 @@ const check = async () => { if (isCameraOpen.value) { websocketsend(getCharacterRecognitionResult) } else { - MessagePlugin('error', { content: '请确保相机处于开机状态' }) + setTimeout(() => { + if (isCameraOpen.value) { + websocketsend(getCharacterRecognitionResult) + } else { + MessagePlugin('error', { content: '请确保相机处于开机状态' }) + } + }, 1000) } } @@ -544,6 +550,8 @@ onMounted(async () => { websocket.value = new socket() websocket.value.WebSocketSet(getSocketdata) getInitData() + // 刚进入页面需要检测相机是否启动 + websocketsend(getCameraState) }) const catCurrentTaskDetail = () => {