From 08dad7b1683865b4a52c84bcdf05c4a542b343bf Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Wed, 13 Aug 2025 11:04:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/devicesSearch/ocrSearch.vue | 27 ++++++++++++++++++---- src/pages/devicesSearch/ocrSearch2.vue | 31 +++++++++++++++++++++----- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/pages/devicesSearch/ocrSearch.vue b/src/pages/devicesSearch/ocrSearch.vue index 247300a..9122d65 100644 --- a/src/pages/devicesSearch/ocrSearch.vue +++ b/src/pages/devicesSearch/ocrSearch.vue @@ -9,10 +9,10 @@ - + 设备编码 - + @@ -169,7 +169,7 @@ export default { cameraReady: false, deviceReadyTimeout: null, pluginCheckRetries: 0, - maxRetries: 10, + maxRetries: 5, // 聚焦相关状态 isFocusing: false, focusSuccess: false, @@ -181,6 +181,25 @@ export default { systemInfo: null } }, + onBackPress(options) { + console.log("进了-----") + // 相机打开时处理返回事件 + if (this.showCamera){ + console.log('关闭相机...'); + try { + this.stopCamera(); + } catch (error) { + console.error('关闭相机出错:', error); + } finally { + this.showCamera = false; + this.cameraStarted = false; + this.resetFocusState(); + } + return true; // 阻止默认返回行为 + } + // 其他情况下允许默认返回 + return false; + }, onShow() { this.initializeCordova(); // 获取设备信息用于相机配置 @@ -815,7 +834,7 @@ export default { } // 重置聚焦状态 this.resetFocusState(); - } + }, } } diff --git a/src/pages/devicesSearch/ocrSearch2.vue b/src/pages/devicesSearch/ocrSearch2.vue index edafaf2..7e3b6e6 100644 --- a/src/pages/devicesSearch/ocrSearch2.vue +++ b/src/pages/devicesSearch/ocrSearch2.vue @@ -9,10 +9,10 @@ - + 设备编码 - + @@ -54,7 +54,7 @@ {{ codeData.nextCheckTime }} - + {{ codeData.inOutNum }} @@ -70,12 +70,12 @@ {{ codeData.checkNum }} - {{ codeData.inspectionPerson }} + {{ codeData.thisCheckTime ? '王鹏' : '' }} {{ codeData.scrapTime }} - + {{}} @@ -169,7 +169,7 @@ export default { cameraReady: false, deviceReadyTimeout: null, pluginCheckRetries: 0, - maxRetries: 10, + maxRetries: 5, // 聚焦相关状态 isFocusing: false, focusSuccess: false, @@ -181,6 +181,25 @@ export default { systemInfo: null } }, + onBackPress(options) { + console.log("进了-----") + // 相机打开时处理返回事件 + if (this.showCamera){ + console.log('关闭相机...'); + try { + this.stopCamera(); + } catch (error) { + console.error('关闭相机出错:', error); + } finally { + this.showCamera = false; + this.cameraStarted = false; + this.resetFocusState(); + } + return true; // 阻止默认返回行为 + } + // 其他情况下允许默认返回 + return false; + }, onShow() { this.initializeCordova(); // 获取设备信息用于相机配置