From f677a52ec84b04337562cc9767d32f70f16808ab Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Mon, 10 Jul 2023 18:17:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E9=94=99=E8=AF=AFsvg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DetailTable.vue | 120 ++++++++++++++++++++++++++++++++++++++++- src/pages/index.vue | 21 ++++++-- 2 files changed, 136 insertions(+), 5 deletions(-) diff --git a/src/components/DetailTable.vue b/src/components/DetailTable.vue index 355a9b0..29f42ff 100644 --- a/src/components/DetailTable.vue +++ b/src/components/DetailTable.vue @@ -48,14 +48,130 @@ const columns = ref([ return (

{row.resultSerial}

-

正确

+ + + + + + + + + + + + + + + + + + + + +
) } else if (row.result == 2) { return (

{row.resultSerial}

-

错误

+ + + + + + + + + + + + + + + + + + + + +
) } else { diff --git a/src/pages/index.vue b/src/pages/index.vue index 4b8aa4c..af90f87 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -380,7 +380,7 @@ import DetailTable from 'cpns/DetailTable' import Debug from 'cpns/Debug' import { startAutoCheckApi, breakOffAutoCheckApi, saveCheckResult } from '@/api' import { getProcessTaskInfoApi, getNextCoordApi } from '@/api/task' -import { getCharacterRecognitionResult } from '@/command' +import { getCharacterRecognitionResult, getCameraState } from '@/command' const accountStore = useAccountStore() const taskStore = useTaskStore() const imageStore = useImageStore() @@ -531,6 +531,7 @@ const nextBtn = async () => { } } +const isCameraOpen = ref(false) const check = async () => { if (!checked.value) { return @@ -538,7 +539,12 @@ const check = async () => { // 检查当前坐标点的结果是否正确 // 获取到结果后,传到后端保存 // 通过ws发送检查 - websocketsend(getCharacterRecognitionResult) + websocketsend(getCameraState) + if (isCameraOpen.value) { + websocketsend(getCharacterRecognitionResult) + } else { + MessagePlugin('error', { content: '请确保相机处于开机状态' }) + } } onMounted(async () => { @@ -617,6 +623,11 @@ const websocketonmessage = async e => { nextBtn() } break + case 'getCameraState': + const { cameraState } = data + const { isOpen } = cameraState + isCameraOpen.value = isOpen + break default: break } @@ -635,7 +646,11 @@ const websocketonerror = () => { // 发送消息 const websocketsend = data => { - websock.value.send(data) + if (websock.value) { + websock.value.send(data) + } else { + MessagePlugin('error', { content: 'ws连接错误' }) + } } const websocketclose = () => {