|
@@ -13,12 +13,13 @@ class bleManager {
|
|
|
async checkBluetoothPermission(callback) {
|
|
|
// return new Promise((resolve, reject) => {
|
|
|
// 获取蓝牙权限
|
|
|
+ let _this = this;
|
|
|
const _app = getApp();
|
|
|
wx.getSetting({
|
|
|
success(res) {
|
|
|
if (res.authSetting["scope.bluetooth"]) {
|
|
|
_app.globalData.scopeBluetooth = true;
|
|
|
- this.hasPermission = true;
|
|
|
+ _this.hasPermission = true;
|
|
|
// console.log('checkBluetoothPermission success, now is', res)
|
|
|
if (callback) {
|
|
|
callback(true);
|
|
@@ -27,14 +28,14 @@ class bleManager {
|
|
|
|
|
|
} else if (res.authSetting["scope.bluetooth"] === undefined) {
|
|
|
_app.globalData.scopeBluetooth = false;
|
|
|
- this.hasPermission = false;
|
|
|
+ _this.hasPermission = false;
|
|
|
if (callback) {
|
|
|
callback(false);
|
|
|
}
|
|
|
wx.authorize({
|
|
|
scope: "scope.bluetooth",
|
|
|
complete() {
|
|
|
- this.checkBluetoothPermission()
|
|
|
+ _this.checkBluetoothPermission()
|
|
|
// resolve(_this.checkBluetoothPermission());
|
|
|
|
|
|
}
|
|
@@ -42,7 +43,7 @@ class bleManager {
|
|
|
|
|
|
} else {
|
|
|
_this.globalData.scopeBluetooth = false;
|
|
|
- this.hasPermission = false;
|
|
|
+ _this.hasPermission = false;
|
|
|
if (callback) {
|
|
|
callback(false);
|
|
|
}
|