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