Kaynağa Gözat

微信小程序1.5.0版本
添加脑环电量低于20%检测
修改邀请卡注册码的验证

rong air 4 yıl önce
ebeveyn
işleme
8ab2e8e482
1 değiştirilmiş dosya ile 35 ekleme ve 44 silme
  1. 35 44
      src/components/device/device.vue

+ 35 - 44
src/components/device/device.vue

@@ -113,8 +113,8 @@
         </button>
       </div>
     </van-popup>
-    <van-toast id="van-toast" />
-    <van-dialog id="van-dialog" />
+    <van-toast id="van-toast"/>
+    <van-dialog id="van-dialog"/>
 
     <!--    <van-popup-->
     <!--      :show="start_show"-->
@@ -142,7 +142,7 @@ import toy_connecting from "@/components/device/toy/connecting";
 import gameIng from "@/pages/start/index";
 //获取个人信息
 import Toast from "../../../static/vant/toast/toast";
-import { game_devices } from "../../requests/game";
+import {game_devices} from "../../requests/game";
 import game_store from "@/store/game";
 import bluetooth from "@/utils/bluetooth";
 import ble_store from "../../store/bluetooth";
@@ -203,47 +203,38 @@ export default {
     },
     //扫描连接蓝牙
     scan_to_bluetooth() {
-      wx.getSystemInfoAsync({
-        success(res) {
-          console.log(res);
-          if (res.bluetoothEnabled == false || res.locationEnabled == false) {
-            Toast.fail("请打开蓝牙和位置信息");
-          } else {
-            wx.scanCode({
-              onlyFromCamera: true,
-              success: (res) => {
-                wx.vibrateShort({
-                  type: "heavy",
-                });
-
-                let $data = res;
-                if ($data.result) {
-                  let url = decodeURIComponent($data.result);
-                  let $code = url.match(/\?ring=(.*)/)
-                    ? url.match(/\?ring=(.*)/)
-                    : url.match(/\?code=(.*)/);
-                  // 判断新的标识值
-                  $this.code = $code[1].toUpperCase();
-                  console.log("头环码", $code);
-                  //打开蓝牙设备
-                  wx.openBluetoothAdapter({
-                    success(res) {
-                      //判断已经打开连接了
-                      if (res["errMsg"] == "openBluetoothAdapter:ok") {
-                        $this.startBluetoothDevicesDiscovery();
-                      }
-                    },
-                    fail(err) {
-                      if (err["errCode"] == 10001) {
-                        Toast.fail({
-                          message: "请打开蓝牙和位置信息!",
-                        });
-                      } else {
-                        Toast.fail({
-                          message: "蓝牙连接失败",
-                        });
-                      }
-                    },
+      wx.scanCode({
+        onlyFromCamera: true,
+        success: (res) => {
+          wx.vibrateShort({
+            type: "heavy",
+          });
+
+          let $data = res;
+          if ($data.result) {
+            let url = decodeURIComponent($data.result);
+            let $code = url.match(/\?ring=(.*)/)
+              ? url.match(/\?ring=(.*)/)
+              : url.match(/\?code=(.*)/);
+            // 判断新的标识值
+            $this.code = $code[1].toUpperCase();
+            console.log("头环码", $code);
+            //打开蓝牙设备
+            wx.openBluetoothAdapter({
+              success(res) {
+                //判断已经打开连接了
+                if (res["errMsg"] == "openBluetoothAdapter:ok") {
+                  $this.startBluetoothDevicesDiscovery();
+                }
+              },
+              fail(err) {
+                if (err["errCode"] == 10001) {
+                  Toast.fail({
+                    message: "请打开蓝牙和位置信息!",
+                  });
+                } else {
+                  Toast.fail({
+                    message: "蓝牙连接失败",
                   });
                 }
               },