fix:修复鸿蒙系统权限bug
This commit is contained in:
parent
ac769296e8
commit
87ee56869c
@ -3,7 +3,7 @@
|
||||
"appid" : "__UNI__933D519",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.2",
|
||||
"versionCode" : "20",
|
||||
"versionCode" : "21",
|
||||
"transformPx" : false,
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
|
||||
@ -495,7 +495,7 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
if(searchNumber === 0 && searchTipFlag) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '长时间未搜索到任何设备,请确认微信的附近设备权限开启后再试',
|
||||
content: '长时间未搜索到任何设备,请确认微信的附近设备权限开启后再试(鸿蒙系统在设置-隐私-定位服务中开启位置信息权限)',
|
||||
showCancel: false,
|
||||
success() {
|
||||
uni.openAppAuthorizeSetting({
|
||||
@ -756,16 +756,33 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
return new Promise((resolve) => {
|
||||
uni.startBluetoothDevicesDiscovery({
|
||||
success: function () {
|
||||
timer2 = setTimeout(() => {
|
||||
uni.stopBluetoothDevicesDiscovery()
|
||||
clearInterval(timer1)
|
||||
resolve({ code: -1 })
|
||||
}, 10500)
|
||||
let searchFlag = false
|
||||
timer2 = setTimeout(async () => {
|
||||
uni.stopBluetoothDevicesDiscovery()
|
||||
clearInterval(timer1)
|
||||
if (!searchFlag) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '长时间未搜索到任何设备,请确认微信的附近设备权限开启后再试(鸿蒙系统在设置-隐私-定位服务中开启位置信息权限)',
|
||||
showCancel: false,
|
||||
success () {
|
||||
uni.openAppAuthorizeSetting({
|
||||
success (res) {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
resolve({ code: -1 })
|
||||
}, 10500)
|
||||
timer1 = setInterval(() => {
|
||||
uni.getBluetoothDevices({
|
||||
success(res) {
|
||||
console.log('设备列表', res)
|
||||
const deviceList = res.devices
|
||||
if(searchFlag === false && res.devices.length > 0) {
|
||||
searchFlag = true
|
||||
}
|
||||
for(let i = 0; i < deviceList.length; i++) {
|
||||
if(deviceList[i]?.name === that.currentLockInfo.name) {
|
||||
const uuid = deviceList[i]?.advertisServiceUUIDs[0]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user