Browse Source

feature: 合并相同功能

Damon 8 months ago
parent
commit
701420e1b3
1 changed files with 12 additions and 15 deletions
  1. 12 15
      pages/index/index.js

+ 12 - 15
pages/index/index.js

@@ -581,20 +581,6 @@ Page({
     }
   },
 
-  onUnload() {
-    var that = this;
-    if (!strings.isEmpty(that.data.intervalId)) {
-      clearInterval(that.data.intervalId);
-      that.data.intervalId = null;
-    }
-    if (app.globalData.client === null) {
-      return;
-    };
-    app.globalData.client.end(true);
-    app.globalData.client.end(true);
-    app.globalData.client = null;
-  },
-
   onTapIndex(e) {
     var that = this;
     var index = e.currentTarget.dataset.index;
@@ -1036,8 +1022,19 @@ Page({
 
   ///销毁蓝牙
   onUnload() {
+    var that = this;
+    if (!strings.isEmpty(that.data.intervalId)) {
+      clearInterval(that.data.intervalId);
+      that.data.intervalId = null;
+    }
     BtHelper.getInstance().disconnect();
-  }
+    if (app.globalData.client === null) {
+      return;
+    };
+    app.globalData.client.end(true);
+    app.globalData.client.end(true);
+    app.globalData.client = null;
+  },
 })
 
 // 去掉此功能,先留着吧