From 67e91c9ae7db96f11af4db11e53e2a93fa26bda8 Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Thu, 14 Aug 2025 17:51:23 +0800 Subject: [PATCH] =?UTF-8?q?ocr=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/devicesSearch/ocrSearch.vue | 1 - .../toolsLease/ocrScan/ocrOutScan.vue | 18 ++++++++++++++++++ src/pages/picking/outbound/codeOutScan.vue | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/pages/devicesSearch/ocrSearch.vue b/src/pages/devicesSearch/ocrSearch.vue index 617cb4a..a2cd47d 100644 --- a/src/pages/devicesSearch/ocrSearch.vue +++ b/src/pages/devicesSearch/ocrSearch.vue @@ -182,7 +182,6 @@ export default { } }, onBackPress(options) { - console.log("进了-----") // 相机打开时处理返回事件 if (this.showCamera){ console.log('关闭相机...'); diff --git a/src/pages/materialsStation/toolsLease/ocrScan/ocrOutScan.vue b/src/pages/materialsStation/toolsLease/ocrScan/ocrOutScan.vue index f49d5a8..ab0a646 100644 --- a/src/pages/materialsStation/toolsLease/ocrScan/ocrOutScan.vue +++ b/src/pages/materialsStation/toolsLease/ocrScan/ocrOutScan.vue @@ -138,6 +138,24 @@ export default { systemInfo: null, } }, + onBackPress(options) { + // 相机打开时处理返回事件 + 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() // 获取设备信息用于相机配置 diff --git a/src/pages/picking/outbound/codeOutScan.vue b/src/pages/picking/outbound/codeOutScan.vue index 15b848e..1db86da 100644 --- a/src/pages/picking/outbound/codeOutScan.vue +++ b/src/pages/picking/outbound/codeOutScan.vue @@ -144,6 +144,24 @@ export default { systemInfo: null, } }, + onBackPress(options) { + // 相机打开时处理返回事件 + 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() // 获取设备信息用于相机配置