Explorar el Código

feature: 对君正方案预留处理方式

332777428@qq.com hace 3 meses
padre
commit
fa4a2ee838
Se han modificado 2 ficheros con 18 adiciones y 19 borrados
  1. 15 19
      pages/pageB/deviceConnect2/deviceConnect2.js
  2. 3 0
      utils/blue_ble/util.js

+ 15 - 19
pages/pageB/deviceConnect2/deviceConnect2.js

@@ -24,7 +24,6 @@ Page({
     customData: '',
     isSubmit: false,
     islanya: false,
-    isOnBluetooth: false,
     imageUrl: "./../../../img/f.png",
     connectDevice: {},
   },
@@ -124,25 +123,14 @@ Page({
       case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
         wx.hideLoading();
         if (options.result) {
-          if (that.data.isOnBluetooth) {
-            return;
-          };
-
           that.setData({
-            isOnBluetooth: true,
+            islanya: false,
+            devicesList: [],
           });
 
-          setTimeout(() => {
-            that.setData({
-              islanya: false,
-              devicesList: [],
-              isOnBluetooth: false,
-            });
-
-            var p = JSON.stringify(that.data.connectDevice);
-            var param = '?deviceId=' + options.data.deviceId + '&name=' + options.data.name + "&param=" + p;
-            routeUtil.jumpParam(routePath.deviceConnect3, param);
-          }, 200);
+          var p = JSON.stringify(that.data.connectDevice);
+          var param = '?deviceId=' + options.data.deviceId + '&name=' + options.data.name + "&param=" + p;
+          routeUtil.jumpParam(routePath.deviceConnect3, param);
         } else {
           wx.showModal({
             title: '提示',
@@ -196,8 +184,16 @@ Page({
     var isJungzheng2 = junzhengUtil.isJungzheng2(name);
 
     if (isJungzheng1 || isJungzheng2) {
-      var param = '?deviceId=' + deviceId + '&name=' + name + "&param=" + JSON.stringify(that.data.connectDevice);
-      routeUtil.jumpParam(routePath.deviceConnect4, param);
+      setTimeout(() => {
+        wx.hideLoading();
+        that.setData({
+          islanya: false,
+          devicesList: [],
+        });
+
+        var param = '?deviceId=' + deviceId + '&name=' + name + "&param=" + JSON.stringify(that.data.connectDevice);
+        routeUtil.jumpParam(routePath.deviceConnect4, param);
+      }, 500);
       return;
     }
 

+ 3 - 0
utils/blue_ble/util.js

@@ -64,6 +64,9 @@ class BleUtil {
     await that.stopScan();
     await that.disconnect(device);
 
+    const timeUtil = require('../../utils/timeUtil');
+    await timeUtil.delayMills(500);
+
     var res = await that.manager.startConnect(device);
     if (!res) {
       that.disconnect(device);