From 151328fd33e4acc077c5ed14fc4d380dbf36992d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Mon, 2 Sep 2024 10:06:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=9C=AA=E5=BC=80=E5=90=AF=E7=9A=84=E5=BC=95?= =?UTF-8?q?=E5=AF=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/home.vue | 3 ++- stores/bluetooth.js | 32 +++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/pages/home/home.vue b/pages/home/home.vue index 85217a7..1426b33 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -88,7 +88,8 @@ title: '加载中', mask: true }) - const accountInfo = wx.getAccountInfoSync() + const accountInfo = uni.getAccountInfoSync() + console.log(accountInfo) getApp().globalData.appid = accountInfo.miniProgram.appId getApp().globalData.envVersion = accountInfo.miniProgram.envVersion this.deviceInfo = await this.getDeviceInfo() diff --git a/stores/bluetooth.js b/stores/bluetooth.js index ff42448..5e65a82 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -160,6 +160,15 @@ export const useBluetoothStore = defineStore('ble', { content: '蓝牙功能需要附近设备权限,请前往设置开启微信的附近设备权限后再试', showCancel: false, confirmText: '确定', + success(res) { + if (res.confirm) { + uni.openAppAuthorizeSetting({ + success (res) { + console.log(res) + } + }) + } + } }) } resolve(false) @@ -430,11 +439,15 @@ export const useBluetoothStore = defineStore('ble', { title: '提示', content: '安卓手机蓝牙功能需要定位权限,请前往设置开启微信的定位权限后再试', showCancel: false, - confirmText: '重试', success(res) { if (res.confirm) { - that.getBluetoothDevices() + uni.openAppAuthorizeSetting({ + success (res) { + console.log(res) + } + }) } + uni.navigateBack() } }) } @@ -464,6 +477,11 @@ export const useBluetoothStore = defineStore('ble', { content: '长时间未搜索到任何设备,请确认微信的附近设备权限开启后再试', showCancel: false, success() { + uni.openAppAuthorizeSetting({ + success (res) { + console.log(res) + } + }) uni.navigateBack() } }) @@ -507,7 +525,15 @@ export const useBluetoothStore = defineStore('ble', { title: '提示', content: '蓝牙尚未打开,请先打开蓝牙', showCancel: false, - confirmText: '确定', + success(res) { + if (res.confirm) { + wx.openSystemBluetoothSetting({ + success (res) { + console.log(res) + } + }) + } + } }) } else if(this.bluetoothStatus === 2 || this.bluetoothStatus === 3) { uni.showModal({