From 11a75699e7967d30b6f6ebf0bc3c4453f379cdf2 Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Mon, 14 Jul 2025 11:03:07 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E8=93=9D?= =?UTF-8?q?=E7=89=99=E5=88=9D=E5=A7=8B=E5=8C=96=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E4=B8=8D=E5=90=8C=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=9A=84=E8=93=9D=E7=89=99=E6=89=93=E5=BC=80=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/main/lockDetail.vue | 2 +- stores/bluetooth.js | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pages/main/lockDetail.vue b/pages/main/lockDetail.vue index f68c6be..2bb62fb 100644 --- a/pages/main/lockDetail.vue +++ b/pages/main/lockDetail.vue @@ -422,7 +422,7 @@ // #endif } if (code === 0) { - $bluetooth + await $bluetooth .syncRecord({ keyId: $bluetooth.currentLockInfo.keyId.toString(), uid: $user.userInfo.uid.toString() diff --git a/stores/bluetooth.js b/stores/bluetooth.js index fd3a977..5763d41 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -233,7 +233,7 @@ export const useBluetoothStore = defineStore('ble', { fail(err) { console.log('蓝牙初始化失败', err) // 系统蓝牙未打开 - if (err.errCode === 10001) { + if (err.errCode === 10001 || err.code === 10001) { if (that.bluetoothStatus === 2) { that.bluetoothStatus = 3 } else { @@ -883,6 +883,7 @@ export const useBluetoothStore = defineStore('ble', { if (this.bluetoothStatus === 1) { const initResult = await this.initBluetooth() if (!initResult) { + // #ifdef MP-WEIXIN uni.showModal({ title: '提示', content: '蓝牙尚未打开,请先打开蓝牙', @@ -897,6 +898,23 @@ export const useBluetoothStore = defineStore('ble', { } } }) + // #endif + // #ifdef APP-PLUS + const systemInfo = uni.getSystemInfoSync() + if (systemInfo.platform === 'android') { + const main = plus.android.runtimeMainActivity() + const Intent = plus.android.importClass('android.content.Intent') + const BluetoothAdapter = plus.android.importClass('android.bluetooth.BluetoothAdapter') + const intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) + main.startActivity(intent) + } else if (systemInfo.platform === 'ios') { + uni.showModal({ + title: '提示', + content: '蓝牙尚未打开,请先打开蓝牙', + showCancel: false + }) + } + // #endif } } else if (this.bluetoothStatus === 2 || this.bluetoothStatus === 3) { uni.showModal({ From e882aef71e5d5f638a83ed5e45b95b43ceec36de Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Mon, 14 Jul 2025 11:15:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E9=92=88=E5=AF=B9=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E5=B9=B3=E5=8F=B0=E6=B7=BB=E5=8A=A0=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=8C=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/setting/setting.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index 425316b..f2d3bc5 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -325,11 +325,20 @@ }) const upgrade = () => { + // #ifdef MP uni.showModal({ title: '提示', content: '小程序暂不支持升级功能,请下载星星锁APP进行升级', showCancel: false }) + // #endif + // #ifdef APP-PLUS + uni.showModal({ + title: '提示', + content: '星星锁Lite暂不支持升级功能,请下载星星锁APP进行升级', + showCancel: false + }) + // #endif } const asyncSetting = async () => { From 5b12b5f198b4bde7b8963953bbfc2223b808a3dc Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Mon, 14 Jul 2025 15:00:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=93=9D?= =?UTF-8?q?=E7=89=99=E8=BF=9E=E6=8E=A5=E5=92=8C=E5=85=B3=E9=97=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=B9=B3=E5=8F=B0=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E6=8F=90=E5=8D=87=E4=BB=A3=E7=A0=81=E5=8F=AF?= =?UTF-8?q?=E8=AF=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/addDevice/bindLock.vue | 2 ++ pages/feature/bindFace.vue | 12 ++++++------ pages/setting/setting.vue | 2 ++ stores/bluetooth.js | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pages/addDevice/bindLock.vue b/pages/addDevice/bindLock.vue index 6a5a722..91f7e73 100644 --- a/pages/addDevice/bindLock.vue +++ b/pages/addDevice/bindLock.vue @@ -90,8 +90,10 @@ }) if (addUserCode === 0) { this.closeBluetoothConnection() + // #ifdef MP this.closeAllBluetooth() this.initAndListenBluetooth() + // #endif } else if (addUserCode === -1) { uni.hideLoading() uni.showToast({ diff --git a/pages/feature/bindFace.vue b/pages/feature/bindFace.vue index 761c25b..f3dd856 100644 --- a/pages/feature/bindFace.vue +++ b/pages/feature/bindFace.vue @@ -116,15 +116,15 @@ diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index f2d3bc5..5e33d6a 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -347,7 +347,9 @@ lockId: $bluetooth.currentLockInfo.lockName.toString(), uid: $user.userInfo.uid.toString() }) + // #ifdef MP $bluetooth.closeBluetoothConnection() + // #endif if (code === 0) { const { code: resultCode } = await lockDataUploadRequest({ lockId: $bluetooth.currentLockInfo.lockId, diff --git a/stores/bluetooth.js b/stores/bluetooth.js index 5763d41..d8d60f8 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -249,7 +249,7 @@ export const useBluetoothStore = defineStore('ble', { } } // 蓝牙已经初始化 - if (err.errMsg === 'openBluetoothAdapter:fail already opened') { + if (err.errMsg === 'openBluetoothAdapter:fail already opened' || err.code === -1) { resolve(true) return }