Browse Source

feature: 对蓝牙连接,授权,请求权限方法类合并

332777428@qq.com 3 months ago
parent
commit
51a74000d8

+ 2 - 3
pages/pageB/deviceConnect0/deviceConnect0.js

@@ -1,4 +1,3 @@
-const app = getApp();
 const constant = require('../../../utils/constant.js');
 
 Page({
@@ -57,7 +56,7 @@ Page({
     wx.getSetting({
       success(res) {
         if (res.authSetting["scope.userFuzzyLocation"]) {
-          app.getBluetoothStatus();
+          constant.app.getBluetoothStatus();
           that.setData({
             userFuzzyLocation: true,
           });
@@ -135,7 +134,7 @@ Page({
   setBluetooth() {
     wx.openSetting({
       complete() {
-        // app.getBluetoothStatus();
+        //constant.app.getBluetoothStatus();
       }
     })
   },

+ 8 - 10
pages/pageB/deviceConnect1/deviceConnect1.js

@@ -1,6 +1,4 @@
-const app = getApp();
-import routeUtil from '../../../utils/routeUtil.js';
-import routePath from '../../../utils/routePath.js'
+const constant = require('../../../utils/constant.js');
 
 Page({
   data: {
@@ -8,7 +6,7 @@ Page({
       showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
       title: '设置网络', //导航栏 中间的标题
     },
-    scopeBluetooth: app.globalData.scopeBluetooth,
+    scopeBluetooth: constant.app.globalData.scopeBluetooth,
     isShowPwd: false,
     is5GWifi: false,
     ssid: "",
@@ -28,7 +26,7 @@ Page({
   },
 
   getBluetoothStatus() {
-    app.getBluetoothStatus();
+    constant.app.getBluetoothStatus();
   },
 
   ///Wifi名称
@@ -59,7 +57,7 @@ Page({
   setPwd: function (e) {
     console.log("设置密码:", e.detail.value)
     var that = this;
-    app.globalData.pwdData = e.detail.value;
+    constant.app.globalData.pwdData = e.detail.value;
     that.setData({
       pwdData: e.detail.value,
     });
@@ -90,7 +88,7 @@ Page({
                     });
                   };
 
-                  app.globalData.ssid = ssid;
+                  constant.app.globalData.ssid = ssid;
                   wx.getStorage({
                     key: 'wifiInfo',
                     success(wifiRes) {
@@ -134,11 +132,11 @@ Page({
     //   return;
     // };
 
-    app.globalData.ssid = that.data.ssid;
-    app.globalData.pwdData = that.data.pwdData;
+    constant.app.globalData.ssid = that.data.ssid;
+    constant.app.globalData.pwdData = that.data.pwdData;
 
     var param = "?param=" + that.data.connectDevice;
-    routeUtil.jumpParam(routePath.deviceConnect2, param);
+    constant.routeUtil.jumpParam(constant.routePath.deviceConnect2, param);
   },
 
   notRoter() {