From 452d7e5ffedde7cc52abda77087cd0e07f129672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Fri, 6 Sep 2024 09:46:08 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E5=A4=8D=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=98=BE=E7=A4=BA=E5=90=8E=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E6=B6=88=E5=A4=B1bug=202.=20=E6=B7=BB=E5=8A=A0=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E8=AE=BE=E5=A4=87=E5=A4=B1=E8=B4=A5=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91=203.=20=E8=AE=BE=E7=BD=AE=E9=A1=B5=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/home.vue | 4 +--- pages/passwordDetail/passwordDetail.vue | 2 -- pages/passwordList/passwordList.vue | 4 ---- pages/setting/setting.vue | 7 ++----- stores/bluetooth.js | 9 +++++++-- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/pages/home/home.vue b/pages/home/home.vue index 426f241..ab414a2 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -185,7 +185,7 @@ authUid: that.userInfo.uid.toString(), keyId: that.keyId.toString() }) - if(resetDeviceCode === 0) { + if(resetDeviceCode === 0 || resetDeviceCode === -2) { const { code, message } = await deleteLockRequest({ lockId: that.currentLockInfo.lockId }) @@ -213,8 +213,6 @@ title: '删除失败,请保持在锁附近', icon: 'none' }) - } else { - uni.hideLoading() } } else { const { code } = await deleteKeyRequest({ diff --git a/pages/passwordDetail/passwordDetail.vue b/pages/passwordDetail/passwordDetail.vue index 6a7a0bc..ca9feb0 100644 --- a/pages/passwordDetail/passwordDetail.vue +++ b/pages/passwordDetail/passwordDetail.vue @@ -106,8 +106,6 @@ export default { title: '删除失败,请保持在锁附近', icon: 'none' }) - } else { - uni.hideLoading() } } } diff --git a/pages/passwordList/passwordList.vue b/pages/passwordList/passwordList.vue index 6e1330a..43e4ce6 100644 --- a/pages/passwordList/passwordList.vue +++ b/pages/passwordList/passwordList.vue @@ -151,8 +151,6 @@ export default { title: '删除失败,请保持在锁附近', icon: 'none' }) - } else { - uni.hideLoading() } } } @@ -211,8 +209,6 @@ export default { title: '重置密码失败,请保持在锁附近', icon: 'none' }) - } else { - uni.hideLoading() } } } diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index c94c940..18eb25a 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -38,7 +38,7 @@ - + 有效期 @@ -204,7 +204,7 @@ export default { authUid: that.userInfo.uid.toString(), keyId: that.keyId.toString() }) - if(resetDeviceCode === 0) { + if(resetDeviceCode === 0 || resetDeviceCode === -2) { const { code, message } = await deleteLockRequest({ lockId: that.currentLockInfo.lockId }) @@ -216,7 +216,6 @@ export default { }) that.getLockList(that.lockSearch) that.backAndToast('删除成功', 2) - uni.navigateBack() } else { uni.hideLoading() uni.showToast({ @@ -230,8 +229,6 @@ export default { title: '删除失败,请保持在锁附近', icon: 'none' }) - } else { - uni.hideLoading() } } else { const { code } = await deleteKeyRequest({ diff --git a/stores/bluetooth.js b/stores/bluetooth.js index 3ab4424..784f5ce 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -609,7 +609,7 @@ export const useBluetoothStore = defineStore('ble', { }) }, // 连接蓝牙设备+获取设备服务+获取设备特征值 - connectBluetoothDevice() { + connectBluetoothDevice(number = 0) { const that = this return new Promise((resolve) => { if(that.bluetoothStatus !== 0) { @@ -681,11 +681,15 @@ export const useBluetoothStore = defineStore('ble', { } }) }, - fail(res) { + async fail(res) { if(res.errno === 1509007) { resolve(true) return } + if(res.errno === 1509001 && number < 1) { + // 重新连接 + resolve(await that.connectBluetoothDevice(number + 1)) + } uni.showToast({ title: '连接失败,请靠近设备并保持设备处于唤醒状态', icon: 'none' @@ -781,6 +785,7 @@ export const useBluetoothStore = defineStore('ble', { uni.stopBluetoothDevicesDiscovery() clearTimeout(timer2) clearInterval(timer1) + uni.hideLoading() uni.showToast({ title: '锁已被重置,请重新绑定', icon: 'none'