From b844a1afe6de85fe33a077769182cfb98c654e3c Mon Sep 17 00:00:00 2001 From: Liuyf Date: Thu, 6 Mar 2025 19:05:48 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90=E5=BC=80=E9=94=81?= =?UTF-8?q?=E9=A1=B5-=E8=AE=BE=E7=BD=AE-=E4=B8=8A=E4=BC=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=97=AE=E9=A2=981=E3=80=91=20=20=20=20=20=20https://?= =?UTF-8?q?www.tapd.cn/tapd=5Ffe/69273997/bug/detail/1169273997001004065?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/uploadLockData/uploadLockData.vue | 25 ++++++++++++++++++++++--- stores/bluetooth.js | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pages/uploadLockData/uploadLockData.vue b/pages/uploadLockData/uploadLockData.vue index f7a9eea..d78294e 100644 --- a/pages/uploadLockData/uploadLockData.vue +++ b/pages/uploadLockData/uploadLockData.vue @@ -2,7 +2,7 @@ - 本操作将上传锁内数据到服务器,过程可能需要几分钟,请耐心等待 + 本操作将上传锁内数据到服务器,过程可能需要几分钟,请耐心等待 { if (pending.value && !flag) return + const netWork = await $basic.getNetworkType() + if (!netWork) { + return + } pending.value = true uni.showLoading({ title: `上传中${progress.value}/7` @@ -45,6 +51,7 @@ uid: $user.userInfo.uid.toString(), countReq: 10 }) + console.log('code value :', code) if (code === 0) { if (typeList[progress.value] === 'setting') { const { code: resultCode } = await lockDataUploadRequest({ @@ -61,8 +68,12 @@ }) if (code === 0) { if (data.lockSettingInfo.catEyeConfig[0]) { - data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime =Number(data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime) - data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance = Number(data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance) + data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime = Number( + data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.recordTime + ) + data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance = Number( + data.lockSettingInfo.catEyeConfig[0].catEyeModeConfig.detectionDistance + ) } $bluetooth.updateCurrentLockSetting(data) } @@ -103,6 +114,14 @@ progress.value++ } await asyncData(true) + } else if (code === -21 || code === -4) { + pending.value = false + $bluetooth.closeBluetoothConnection() + uni.hideLoading() + uni.showToast({ + title: '蓝牙未打开或在访问附近设备权限未开启', + icon: 'none' + }) } else { pending.value = false $bluetooth.closeBluetoothConnection() diff --git a/stores/bluetooth.js b/stores/bluetooth.js index 1fde736..66c2baa 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -3030,7 +3030,7 @@ export const useBluetoothStore = defineStore('ble', { console.log('写入未执行', this.bluetoothStatus) this.getBluetoothStatus() return { - code: -1 + code: -21 } }