From 9c7d3da158ad1871960696ae87b7f5f193b3f292 Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Fri, 29 Aug 2025 11:22:33 +0800 Subject: [PATCH] =?UTF-8?q?=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 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/devicesSearch/ocrSearch.vue b/src/pages/devicesSearch/ocrSearch.vue index e29a35d..e54fc7e 100644 --- a/src/pages/devicesSearch/ocrSearch.vue +++ b/src/pages/devicesSearch/ocrSearch.vue @@ -186,7 +186,9 @@ export default { isOverToday: false, isShow: false, message: '', - position: 'bottom' // 'top' | 'bottom' + position: 'bottom', + screenHeight: null, + screenWidth: null, } }, onBackPress(options) { @@ -244,6 +246,11 @@ export default { const systemInfo = uni.getSystemInfoSync(); console.log('设备信息:', systemInfo); this.systemInfo = systemInfo; + // 获取屏幕高度和宽度 + const screenHeight = systemInfo.screenHeight; // 屏幕高度:1000 + const screenWidth = systemInfo.screenWidth; // 屏幕宽度:600 + this.screenHeight = screenHeight; + this.screenWidth = screenWidth; } catch (error) { console.error('获取设备信息失败:', error); } @@ -510,7 +517,7 @@ export default { // 拍照前先进行聚焦 console.log('拍照前聚焦...'); console.log('开始拍照...'); - CameraPreview.takePicture({width:640, height:540, quality: 50}, async (base64PictureData) => { + CameraPreview.takePicture({width:this.screenWidth, height:this.screenHeight, quality: 50}, async (base64PictureData) => { console.log('拍照返回数据',base64PictureData); await this.processImage(base64PictureData); });