Bläddra i källkod

feature:修改this的报错

zeng.chen 8 månader sedan
förälder
incheckning
8f62dff4ec
4 ändrade filer med 18 tillägg och 20 borttagningar
  1. 4 7
      app.js
  2. 5 4
      devices/ble_manager.js
  3. 8 8
      devices/bluetooth/bt_parse.js
  4. 1 1
      pages/piano/wallpaper/wallpaper.js

+ 4 - 7
app.js

@@ -24,10 +24,7 @@ App({
     is_debug: 2, // 1 测试环境 // 2正式环境
     client: null,
     oneInitBluetooth: true,
-    isIOS: false,
-    isAndroid: false,
-    isHuaWei: false,
-    btHelper: null,
+    mDeviceList: [],
     // 当前设备
     // device: {},
     // 设备列表,跟app同步字段
@@ -77,9 +74,9 @@ App({
         that.globalData.navBarHeight = res.statusBarHeight + custom.height + (custom.top - res.statusBarHeight) * 2;
         that.globalData.MenuButtonheight = custom.height;
         that.globalData.MenuButtonTop = custom.top;
-        var platform = res.platform;
-        that.globalData.isIOS = platform == "ios";
-        that.globalData.isAndroid = platform == "android";
+        // var platform = res.platform;
+        // that.globalData.isIOS = platform == "ios";
+        // that.globalData.isAndroid = platform == "android";
       }
     });
   },

+ 5 - 4
devices/ble_manager.js

@@ -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);
                     }

+ 8 - 8
devices/bluetooth/bt_parse.js

@@ -309,14 +309,14 @@ class BtParse {
 
                 // 仅用于记录设备音量,播控页面显示用
                 EventManager.fire(CmdEvent.volume({ volume: trueVolume }));
-                if (DeviceUtil.isAndroid) {
-                    const name = "";
-                    // todo 
-                    // DeviceManager.instance.name;
-                    if (name === "猫王·霹雳唱机") {
-                        // VolumeUtil.setVolume(trueVolume);
-                    }
-                }
+                // if (DeviceUtil.isAndroid) {
+                //     const name = "";
+                //     // todo 
+                //     // DeviceManager.instance.name;
+                //     if (name === "猫王·霹雳唱机") {
+                //         // VolumeUtil.setVolume(trueVolume);
+                //     }
+                // }
                 break;
 
             // 查询电量

+ 1 - 1
pages/piano/wallpaper/wallpaper.js

@@ -67,7 +67,7 @@ Page({
         const tempFilePaths = res.tempFilePaths;
         console.log('获取图片信息成功', res);
         wx.cropImage({
-          src: tempFilePaths, // 图片路径
+          src: tempFilePaths[0], // 图片路径
           cropScale: '1:1', // 裁剪比例
           success: (res) => {