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() // 获取设备信息用于相机配置