瀏覽代碼

调整了教具电量

叶振荣 3 年之前
父節點
當前提交
137821879a
共有 6 個文件被更改,包括 101 次插入184 次删除
  1. 41 31
      src/components/device/device.vue
  2. 0 2
      src/components/device/toy/connecting.vue
  3. 1 116
      src/components/index/regist.vue
  4. 2 1
      src/main.js
  5. 13 11
      src/pages/start/index.vue
  6. 44 23
      src/utils/bluetooth.js

+ 41 - 31
src/components/device/device.vue

@@ -117,10 +117,10 @@
     <van-toast id="van-toast"/>
     <van-dialog id="van-dialog"/>
 
-<!--    <view style="width: 100%;height: 300px;">-->
-<!--      <view>脑环Mac:{{ device.deviceId }}</view>-->
-<!--      <view>教具UUID:{{ toy_UUID }}</view>-->
-<!--    </view>-->
+    <!--    <view style="width: 100%;height: 300px;">-->
+    <!--      <view>脑环Mac:{{ device.deviceId }}</view>-->
+    <!--      <view>教具UUID:{{ toy_UUID }}</view>-->
+    <!--    </view>-->
     <!--    <van-popup-->
     <!--      :show="start_show"-->
     <!--      :closeable="false"-->
@@ -148,7 +148,6 @@ import gameIng from "@/pages/start/index";
 import Toast from "../../../static/vant/toast/toast";
 import {game_devices, getDeviceBySn, setDeviceInDb} from "../../requests/game";
 import game_store from "@/store/game";
-import bluetooth from "@/utils/bluetooth";
 import {getNowDate} from "../../utils";
 
 let $this;
@@ -251,16 +250,26 @@ export default {
     scan_to_bluetooth() {
       wx.scanCode({
         onlyFromCamera: true,
+        scanType:['barCode', 'qrCode'],
         success: (res) => {
-
           let $data = res;
           if ($data.result) {
             let url = decodeURIComponent($data.result);
-            let $code = url.match(/\?ring=(.*)/)
+            let $code = ""
+
+            //二维码
+            if (res.scanType=="QR_CODE"){
+              $code = url.match(/\?ring=(.*)/)
               ? url.match(/\?ring=(.*)/)
               : url.match(/\?code=(.*)/);
+              $code = $code[1].toUpperCase();
+            }else{
+              //一维码
+              $code = res.result.toUpperCase();
+            }
+
             // 判断新的标识值
-            $this.code = $code[1].toUpperCase();
+            $this.code = $code
             console.log("头环码", $code);
             game_store.setters.setDeviceSn($this.code)
             //设备信息
@@ -294,7 +303,7 @@ export default {
                             }
                           },
                           fail(err) {
-                            let $msg = bluetooth.GetopenBluetoothAdapterError(
+                            let $msg = $this.$bluetooth.GetopenBluetoothAdapterError(
                               err["errCode"]
                             );
                             setTimeout(() => {
@@ -307,7 +316,7 @@ export default {
                       }
                     },
                     fail(err) {
-                      let $msg = bluetooth.GetopenBluetoothAdapterError(
+                      let $msg = $this.$bluetooth.GetopenBluetoothAdapterError(
                         err["errCode"]
                       );
                       setTimeout(() => {
@@ -328,7 +337,7 @@ export default {
                       }
                     },
                     fail(err) {
-                      let $msg = bluetooth.GetopenBluetoothAdapterError(
+                      let $msg = $this.$bluetooth.GetopenBluetoothAdapterError(
                         err["errCode"]
                       );
                       setTimeout(() => {
@@ -343,6 +352,9 @@ export default {
             });
           }
         },
+        fail(res){
+          console.log(res)
+        }
       });
     },
     //关闭窗口的方法
@@ -358,7 +370,7 @@ export default {
       // $this.choose_toy_window.show = false;
       $this.choose_toy_window.show = true;
       $this.toy_connected = false
-      bluetooth.SendOrder("09");
+      $this.$bluetooth.SendOrder("09");
     },
     // 选好玩具
     choose_ok() {
@@ -377,7 +389,7 @@ export default {
       //连接玩具
       $this.current_hex = `03 00 ${$hex} 00 0a`;
 
-      bluetooth.sendConnectOneToMore($hex);
+      $this.$bluetooth.sendConnectOneToMore($hex);
 
       //设置5秒后是否已经连接
       setTimeout(() => {
@@ -408,7 +420,7 @@ export default {
         $this.connect_show = false;
         $this.device_bg = false;
 
-        bluetooth.SendOrder("09")
+        $this.$bluetooth.SendOrder("09")
 
         $this.change_toy_connect_status(0);
         //断开蓝牙连接
@@ -529,21 +541,19 @@ export default {
 
           let $system = wx.getSystemInfoSync()
           if ($system.platform == 'ios') {
-            bluetooth.getBLEDeviceServices($this.device.deviceId)
-            bluetooth.watchingDevice($this)
+            $this.$bluetooth.getBLEDeviceServices($this.device.deviceId)
+            $this.$bluetooth.watchingDevice($this)
           } else {
-            bluetooth.openNotify($this)
-            bluetooth.watch_bluetooth_status($this);
-          }
-
-
-          //录入库
-          //读取信息逐个写入
-          if (!$this.device_finded) {
-            setTimeout(() => {
-              bluetooth.SendOrder("02")
-              setDeviceInDb($this, $this.device.deviceId)
-            }, 3000)
+            $this.$bluetooth.openNotify($this)
+            $this.$bluetooth.watch_bluetooth_status($this);
+            //录入库
+            //读取信息逐个写入
+            if (!$this.device_finded) {
+              setTimeout(() => {
+                $this.$bluetooth.SendOrder("02")
+                setDeviceInDb($this, $this.device.deviceId)
+              }, 3000)
+            }
           }
 
 
@@ -598,8 +608,8 @@ export default {
       //不在游戏状态
       $this.connect_toy = 0;
       $this.connect_show = true;
-      bluetooth.watchingDevice($this);
-      bluetooth.watch_bluetooth_status($this);
+      $this.$bluetooth.watchingDevice($this);
+      $this.$bluetooth.watch_bluetooth_status($this);
       // let $ble_status = ble_store.getters.getBluetoothLinkStatus();
       // if ($ble_status == false) {
       //   //断开蓝牙连接
@@ -613,7 +623,7 @@ export default {
         $this.connect_toy = 0;
         $this.connect_show = false;
         $this.device_status = 0;
-        bluetooth.watch_bluetooth_status($this);
+        $this.$bluetooth.watch_bluetooth_status($this);
         $this.device.deviceId = "";
         $this.toy_UUID = "";
         $this.$forceUpdate();

+ 0 - 2
src/components/device/toy/connecting.vue

@@ -285,7 +285,6 @@
 import { gameStart } from "@/requests/game";
 import Toast from "../../../../static/vant/toast/toast";
 import game_store from "../../../store/game";
-import bluetooth from "../../../utils/bluetooth";
 
 let $this;
 export default {
@@ -352,7 +351,6 @@ export default {
               mpvue.navigateTo({
                 url: "/pages/start/main",
                 success() {
-                  wx.offBLECharacteristicValueChange();
                   // 记录消费方式 选择时间卡还是次卡
                   game_store.setters.setPlayTime($res["play_time"]);
                   game_store.setters.setOverPlayTime($res["play_time"]);

+ 1 - 116
src/components/index/regist.vue

@@ -96,122 +96,7 @@
       round
     >
       <div class="protocol_content padding-lr">
-        <!-- <div>
-          <h1 style="font-size:22px; line-height:100%; margin:15px 0px; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:center; widows:0">
-            <span style="font-family:宋体; font-size:22px; font-weight:bold">隐私协议</span></h1>
 
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">欢迎您使用</span><span style="font-family:宋体; font-size:12px">水母智脑小程序</span><span style="font-family:宋体; font-size:12px">(以下简称:“本应用”)!</span><br /><span style="font-family:宋体; font-size:12px">本应用尊重并保护所有使用服务用户的个人隐私权。为了给您提供更准确、更有个性化的服务,本应用会按照本隐私权政策的规定使用和披露您的个人信息。但本应用将以高度的勤勉、审慎义务对待这些信息。除本隐私权政策另有规定外,在未征得您事先许可的情况下,本应用不会将这些信息对外披露或向第三方提供。本应用会不时更新本隐私权政策。</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">您在同意本应用服务使用协议之时,即视为您已经同意本隐私权政策全部内容。本隐私权政策属于本应用服务使用协议不可分割的一部分。</span><br /><br />
-            <view style="width: 100%;height: 10px;"></view>
-            <span style="font-family:宋体; font-size:12px;">1.</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">适用范围</span><br /><span style="font-family:宋体; font-size:12px">(a)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">在您注册本应用帐号时,您根据本应用要求提供的个人注册信息;</span><br /><span style="font-family:宋体; font-size:12px">(b)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">在您使用本应用网络服务,或访问本应用平台网页时,本应用自动接收并记录的您的浏览器和计算机上的信息,包括但不限于您的IP地址、浏览器的类型、使用的语言、访问日期和时间、软硬件特征信息及您需求的网页记录等数据;</span><br /><span style="font-family:宋体; font-size:12px">(c)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">本应用通过合法途径从商业伙伴处取得的用户个人数据。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <br /><span style="font-family:宋体; font-size:12px">您了解并同意,以下信息不适用本隐私权政策:</span><br /><span style="font-family:宋体; font-size:12px">(a)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">您在使用本应用平台提供的搜索服务时输入的关键字信息;</span><br /><span style="font-family:宋体; font-size:12px">(b)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">本应用收集到的您在本应用发布的有关信息数据,包括但不限于参与活动、成交信息及评价详情;</span><br /><span style="font-family:宋体; font-size:12px">(c)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">违反法律规定或违反本应用规则行为及本应用已对您采取的措施。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <br /><span style="font-family:宋体; font-size:12px">2.</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">信息使用</span><br /><span style="font-family:宋体; font-size:12px">(a)本应用不会向任何无关第三方提供、出售、出租、分享或交易您的个人信息,除非事先得到您的许可,或该第三方和本应用(含本应用关联公司)单独或共同为您提供服务,且在该服务结束后,其将被禁止访问包括其以前能够访问的所有这些资料。</span><br /><span style="font-family:宋体; font-size:12px">(b)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">本应用亦不允许任何第三方以任何手段收集、编辑、出售或者无偿传播您的个人信息。任何本应用平台用户如从事上述活动,一经发现,本应用有权立即终止与该用户的服务协议。</span><br /><span style="font-family:宋体; font-size:12px">(c)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">为服务用户的目的,本应用可能通过使用您的个人信息,向您提供您感兴趣的信息,包括但不限于向您发出产品和服务信息,或者与本应用合作伙伴共享信息以便他们向您发送有关其产品和服务的信息(后者需要您的事先同意)。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <br /><span style="font-family:宋体; font-size:12px">3.</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">信息披露</span><br /><span style="font-family:宋体; font-size:12px">在如下情况下,本应用将依据您的个人意愿或法律的规定全部或部分的披露您的个人信息:</span><br /><span style="font-family:宋体; font-size:12px">(a)经您事先同意,向第三方披露;</span><br /><span style="font-family:宋体; font-size:12px">(b)为提供您所要求的产品和服务,而必须和第三方分享您的个人信息;</span><br /><span style="font-family:宋体; font-size:12px">(c)根据法律的有关规定,或者行政或司法机构的要求,向第三方或者行政、司法机构披露;</span><br /><span style="font-family:宋体; font-size:12px">(d)如您出现违反中国有关法律、法规或者本应用服务协议或相关规则的情况,需要向第三方披露;</span><br /><span style="font-family:宋体; font-size:12px">(e)如您是适格的知识产权投诉人并已提起投诉,应被投诉人要求,向被投诉人披露,以便双方处理可能的权利纠纷;</span><br /><span style="font-family:宋体; font-size:12px">(f)在本应用平台上创建的某一交易中,如交易任何一方履行或部分履行了交易义务并提出信息披露请求的,本应用有权决定向该用户提供其交易对方的联络方式等必要信息,以促成交易的完成或纠纷的解决。</span><br /><span style="font-family:宋体; font-size:12px">(g)</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">其它本应用根据法律、法规或者网站政策认为合适的披露。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <br /><span style="font-family:宋体; font-size:12px">4.</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">信息存储和交换</span><br /><span style="font-family:宋体; font-size:12px">本应用收集的有关您的信息和资料将保存在本应用及(或)其关联公司的服务器上,这些信息和资料可能传送至您所在国家、地区或本应用收集信息和资料所在地的境外并在境外被访问、存储和展示。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <br /><span style="font-family:宋体; font-size:12px">5.</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">Cookie的使用</span><br /><span style="font-family:宋体; font-size:12px">(a)在您未拒绝接受cookies的情况下,本应用会在您的计算机上设定或取用cookies</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">,以便您能登录或使用依赖于cookies的本应用平台服务或功能。本应用使用cookies可为您提供更加周到的个性化服务,包括推广服务。</span><br /><span style="font-family:宋体; font-size:12px">(b)您有权选择接受或拒绝接受cookies。您可以通过修改浏览器设置的方式拒绝接受cookies。但如果您选择拒绝接受cookies,则您可能无法登录或使用依赖于cookies的本应用网络服务或功能。</span><br /><span style="font-family:宋体; font-size:12px">(c)通过本应用所设cookies所取得的有关信息,将适用本政策。</span></p>
-          <p style="background-color:#ffffff; font-size:12px; line-height:115%; margin:0pt"><br /><span style="font-family:宋体; font-size:12px">6.</span><span style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">信息安全</span><br /><span style="font-family:宋体; font-size:12px">(a)本应用帐号均有安全保护功能,请妥善保管您的用户名及密码信息。本应用将通过对用户密码进行加密等安全措施确保您的信息不丢失,不被滥用和变造。尽管有前述安全措施,但同时也请您注意在信息网络上不存在“完善的安全措施”。</span><br /><span style="font-family:宋体; font-size:12px">(b)在使用本应用网络服务进行网上交易时,您不可避免的要向交易对方或潜在的交易对</span><span style="font-family:宋体; font-size:12px">方披露自己的个人信息,</span><span style="font-family:宋体; font-size:12px">如</span><span style="font-family:宋体; font-size:12px">个人信息泄密,尤其是本应用用户名及密码发生泄露,请您立即联络本应用客服,以便本应用采取相应措施</span><span style="font-family:宋体; font-size:12px">。</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <br /><span style="font-family:宋体; font-size:12px">7.本隐私政策的更改</span><br /><br /><span style="font-family:宋体; font-size:12px">(a)如果决定更改隐私政策,我们会在本政策中、本公司网站中以及我们认为适当的位置发布这些更改,以便您了解我们如何收集、使用您的个人信息,哪些人可以访问这些信息,以及在什么情况下我们会透露这些信息。</span><br /><span style="font-family:宋体; font-size:12px">(b)本公司保留随时修改本政策的权利,因此请经常查看。如对本政策作出重大更改,本公司会通过网站通知的形式告知。</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <br /><span style="font-family:宋体; font-size:12px">&#xa0;</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">&#xa0;</span></p>
-          <h1 style="font-size:22px; line-height:100%; margin:17pt 0pt 16.5pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:center; widows:0">
-            <span style="font-family:宋体; font-size:22px; font-weight:bold">服务协议</span></h1>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">一、总则</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">此份协议是注册用户接受</span><span style="font-family:宋体; font-size:12px">深圳水母智脑科技有限公司</span><span style="font-family:宋体; font-size:12px">(以下简称</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">)产品和服务时适用的通用条款。因此,请您在注册成为</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">用户前或接受</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的产品和服务之前,请您详细地阅读本注册用户协议的所有内容。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">1、注册用户了解并同意:</span></p>
-          <p style="font-size:12px; line-height:115%; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">只要注册用户点击“同意”按钮并完成注册,</span><span style="font-family:宋体; font-size:12px">水母智脑就视</span><span style="font-family:宋体; font-size:12px">注册用户已接受了本注册用户协议及</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的各项服务规则(包括填写实名的联系方式等等),并愿意受其约束。如果发生纠纷,注册用户不得以未仔细阅读为由进行抗辩。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">随着市场经营情况的变化,</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">有权随时更改本注册用户协议及相关服务规则。修改本注册用户协议时,</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">将于相关页面公告修改的事实,有权不对注册用户进行个别通知。注册用户应该在每次登录前查询网站的相关公告,以了解注册用户协议及其他服务规则的变化。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">2、若注册用户不同意本注册用户协议或相关服务规则,或者不同意</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">作出的修改,注册用户可以主动停止使用</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">提供的产品和服务,如果在</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">修改协议或服务规则后,注册用户仍继续使用</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">提供的产品和服务,即表示注册用户同意</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">对本注册用户协议及相关服务规则所做的所有修改。由于注册用户在注册用户协议变更后因未熟悉公告规定而引起的损失,</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">将不会承担任何责任。</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">3、</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的各项电子服务的所有权和运作权归</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">。</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">提供的服务将完全按照其发布的服务条款和操作规则严格执行。注册用户必须完全同意所有服务条款并完成注册程序,才能成为</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的注册用户。注册用户确认:本协议条款是处理双方权利义务的当然约定依据,除非违反国家强制性法律,否则始终有效。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">二、服务简介</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">1、</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">运用自己的</span><span style="font-family:宋体; font-size:12px">程序</span><span style="font-family:宋体; font-size:12px">系统通过互联网</span><span style="font-family:宋体; font-size:12px">产品</span><span style="font-family:宋体; font-size:12px">为注册用户提供网络服务。同时,注册用户必须自行配备上网的所需设备,包括个人电脑、调制解调器或其他必备上网装置。自行负担个人上网所支付的与此服务有关的电话费用、网络费用。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">2、基于</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">所提供的网络服务的重要性,注册用户应同意:提供详尽、准确的个人资料。不断更新注册资料,符合及时、详尽、准确的要求。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">3、</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">对注册用户的电子邮件、手机号等隐私资料进行保护,承诺不会在未获得注册用户许可的情况下擅自将注册用户的个人资料信息出租或出售给任何第三方,但以下情况除外:注册用户同意让第三方共享资料;注册用户同意公开其个人资料,享受为其提供的产品和服务;</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">需要听从法庭传票、法律命令或遵循法律程序;</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">发现注册用户违反了</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">服务条款或</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">其它使用规定。</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">4、关于注册用户隐私的具体协议以</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的隐私声明为准。如果注册用户提供的资料包含有不正确的信息,</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">保留结束注册用户使用网络服务资格的权利。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">三、账户密码和安全性</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">注册用户一旦注册成功,成为</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的合法的注册用户。您可随时根据需要改变您的密码。注册用户将对注册用户名和密码安全负全部责任。另外,每个注册用户都要对以其注册用户名进行的所有活动和事件负全责。注册用户若发现任何非法使用注册用户帐户或存在安全漏洞的情况,请立即通告</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">。</span></p>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">四、拒绝提供担保</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">注册用户个人对网络服务的使用承担风险。</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">对此不作任何类型的担保,不论是明确的或隐含的,但是不对商业性的隐含担保、特定目的和不违反规定的适当担保作限制。</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">不担保服务一定能满足注册用户的要求,也不担保服务不会受中断,对服务的及时性,安全性,出错发生都不作担保。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">五、有限责任</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">对任何直接、间接、偶然、特殊及继起的损害不负责任,这些损害可能来自:不正当使用网络服务,在网上购买商品或进行同类型服务,在网上进行交易,非法使用网络服务或注册用户传送的信息有所变动。这些行为都有可能会导致</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的形象受损,所以</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">事先提出这种损害的可能性。</span></p>
-          <p style="font-size:12px; line-height:115%; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">六、通告</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">所有发给注册用户的通告都可通过重要页面的公告或电子邮件或常规的信件传送。</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的活动信息也将定期通过页面公告及电子邮件方式向注册用户发送。注册用户协议条款的修改、服务变更、或其它重要事件的通告会以电子邮箱或者短信进行通知。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">七、注册用户的建议奖励</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">注册用户在他们发表的一些良好建议以及一些比较有价值的策划方案时,</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">愿意展示用户的构想落于实现,这其中</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">会对一些比较好的注册用户反馈信息进行不等的产品奖励或者是积分奖励,但如出现用户策划与广告销售商之间的矛盾</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">不承担任何责任。</span></p>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">八、责任限制</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">1、如因不可抗力或其他</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">无法控制的原因使</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">销售系统崩溃或无法正常使用导致网上交易无法完成或丢失有关的信息、记录等,</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">不承担责任。但是</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">会尽可能合理地协助处理善后事宜,并努力使客户免受经济损失。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">2、除了</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的使用条件中规定的其它限制和除外情况之外,在中国法律法规所允许的限度内,对于因交易而引起的或与之有关的任何直接的、间接的、特殊的、附带的、后果性的或惩罚性的损害,或任何其它性质的损害,</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">、</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">的董事、管理人员、雇员、代理或其它代表在任何情况下都不承担责任。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">九、法律管辖和适用</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">1、本协议的订立、执行和解释及争议的解决均应适用中国法律。</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">2、如发生</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">服务条款与中国法律相抵触时,则这些条款将完全按法律规定重新解释,而其它合法条款则依旧保持对注册用户产生法律效力和影响。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">3、本协议的规定是可分割的,如本协议任何规定被裁定为无效或不可执行,该规定可被删除而其余条款应予以执行。</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">4、如双方就本协议内容或其执行发生任何争议,双方应尽力友好协商解决;协商不成时,任何一方均可向</span><span style="font-family:宋体; font-size:12px">水母智脑</span><span style="font-family:宋体; font-size:12px">所在地的人民法院提起诉讼。</span></p>
-          <p style="font-size:12px; line-height:115%;  orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">十、其他规定</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">1、如本用户协议中的任何内容无论因何种原因完全或部分无效或不具有执行力,本用户协议的其余内容仍应有效并且对协议各方有约束力。</span>
-          </p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">2、本用户协议中的标题仅为方便而设,不具法律或契</span><span style="font-family:宋体; font-size:12px">约效果。</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">&#xa0;</span></p>
-          <p style="font-size:12px; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0">
-            <span style="font-family:宋体; font-size:12px">深圳水母智脑科技有限公司</span></p>
-        </div> -->
         <div>
           <h1 style="margin-top:17pt; margin-bottom:16.5pt; text-align:center; page-break-inside:avoid; page-break-after:avoid; line-height:240%; widows:0; orphans:0; font-size:22pt">
             <span style="font-family:'宋体'">隐私协议</span></h1>
@@ -354,7 +239,7 @@ export default {
           phone: $this.phone,
           is_register: 0
       }}
-      
+
       userGetCode($params).then((res) => {
         let $data = res.data;
         Toast.success($data["errmsg"]);

+ 2 - 1
src/main.js

@@ -2,7 +2,7 @@ import Vue from 'vue'
 import App from './App'
 import Fly from 'flyio/dist/npm/wx'
 import store from '@/store/index'
-
+import bluetooth from "@/utils/bluetooth";
 
 
 var fly = new Fly()
@@ -17,6 +17,7 @@ fly.config.headers = {
 
 Vue.prototype.$fly = fly
 Vue.prototype.$store = store
+Vue.prototype.$bluetooth = bluetooth
 Vue.config.productionTip = false
 App.mpType = 'app'
 

+ 13 - 11
src/pages/start/index.vue

@@ -1,9 +1,9 @@
 <template>
   <div id="playing_container">
-<!--    <view style="width: 100%;height: 100px;color: white">-->
-<!--      <view>脑环Mac:{{ deviceId }}</view>-->
-<!--      <view>教具UUID:{{ toy_UUID }}</view>-->
-<!--    </view>-->
+    <!--    <view style="width: 100%;height: 100px;color: white">-->
+    <!--      <view>脑环Mac:{{ deviceId }}</view>-->
+    <!--      <view>教具UUID:{{ toy_UUID }}</view>-->
+    <!--    </view>-->
     <!--    计费面板模块-->
     <div class="game_panel padding-top-sm">
       <van-row gutter="16">
@@ -236,7 +236,6 @@
 
 <script>
 import util, {formatSeconds} from "../../utils/index";
-import bluetooth from "../../utils/bluetooth";
 import game_store from "@/store/game";
 import Toast from "../../../static/vant/toast/toast";
 import {gameAddLine, gameEnd} from "../../requests/game";
@@ -360,7 +359,7 @@ export default {
     //游戏结束方法
     game_finished() {
       if (!$this.executed) {
-        bluetooth.sendControlClose();
+        $this.$bluetooth.sendControlClose();
 
         $this.$emit("closePop", true);
 
@@ -414,9 +413,11 @@ export default {
         keepScreenOn: true,
       });
 
-      bluetooth.watchingDevice($this);
-      bluetooth.sendControl();
-      bluetooth.sendToyPower_CheckReconected()
+      $this.$bluetooth.watchingDevice($this);
+      $this.$bluetooth.sendControl();
+      setTimeout(() => {
+        $this.$bluetooth.sendToyPower_CheckReconected()
+      },2000)
     },
 
     // ArrayBuffer转16进度字符串示例
@@ -619,6 +620,7 @@ export default {
     }
   },
   mounted() {
+    console.log($this.$bluetooth.ToyPower)
     $this.executed = false;
     $this.deviceId = "";
     $this.toy_UUID = "";
@@ -634,12 +636,12 @@ export default {
       $this.start_game();
 
       //打开蓝牙监听
-      bluetooth.watch_bluetooth_status($this);
+      $this.$bluetooth.watch_bluetooth_status($this);
     }
 
     // const $sendSmPack = setInterval(()=>{
     //   if ($this.game_status == 1){
-    //     bluetooth.SendOrder("04")
+    //     $this.$bluetooth.SendOrder("04")
     //   }
     // },1500)
   },

+ 44 - 23
src/utils/bluetooth.js

@@ -18,6 +18,8 @@ var current_toy_UUID = "";
 //标记是否打开脑控
 var FlagOpenControl = false;
 
+var ToyPower = 0;
+
 
 //2021年11月10日14:59:38
 // 0为旧 1为新
@@ -50,7 +52,7 @@ function getServicesAndCharateristc() {
 
 export default {
   //变量
-  connect_toy, control_close, current_toy_id, current_toy_UUID,
+  connect_toy, control_close, current_toy_id, current_toy_UUID,ToyPower,
 
   // 打开大包数据
   sendOpenBigData() {
@@ -67,13 +69,15 @@ export default {
   // 开启脑控
   sendControl() {
     let that = this;
-    let $SendControlIntv = setInterval(() => {
-      if (FlagOpenControl) {
-        clearInterval($SendControlIntv)
-      } else {
-        that.SendOrder('07')
-      }
-    }, 1000);
+    that.SendOrder('07')
+
+    // let $SendControlIntv = setInterval(() => {
+    //   if (FlagOpenControl) {
+    //     clearInterval($SendControlIntv)
+    //   } else {
+    //     that.SendOrder('07')
+    //   }
+    // }, 1000);
   },
   // 关闭脑控
   sendControlClose() {
@@ -104,22 +108,34 @@ export default {
   //获取教具电量
   sendToyPower_CheckReconected() {
     let that = this;
+    let $connect_false_count = 0;
     let toy_intv = setInterval(() => {
       let $game_status = game_store.getters.getGameStatus();
       if ($game_status == 1) {
-        if (!connect_toy) {
-          wx.showToast({
-            title: `教具已断开`
-          })
-          //调用重连教具
-          that.SendOrder("09")
-          that.ReconnectToy()
-          clearInterval(toy_intv)
-        } else {
-        that.SendOrder('8a')
-        }
+        // if (!connect_toy) {
+        //   // $connect_false_count += 1;
+        //   clearInterval(toy_intv)
+        // } else {
+          // $connect_false_count = 0;
+          that.SendOrder('8a')
+          // connect_toy = false
+        // }
+
+        //3次获取不到电量则重新连接
+        // if ($connect_false_count == 3) {
+        //   wx.showToast({
+        //     title: `教具已断开`
+        //   })
+        //   //调用重连教具
+        //   that.SendOrder("09")
+        //   that.ReconnectToy()
+        //   //教具断开 打开脑控也关闭
+        //   FlagOpenControl = false
+        //   $connect_false_count = 0;
+        //   clearInterval(toy_intv)
+        // }
       }
-    }, 3000)
+    }, 10000)
   },
 
   //  获取大包数据 进行绘制图表
@@ -220,6 +236,7 @@ export default {
           // game_store.setters.setGameStatus(0);
           // 结束状态更改为1
         } else {
+          //关闭脑控
           game_store.setters.setGameStatus(0);
           // 清空链接得设备 三值
           game_store.setters.clearDeviceToy();
@@ -427,12 +444,13 @@ export default {
       //2021年10月21日16:30:07
       // 获取教具电量
       if (hexStr.toUpperCase().indexOf("AADD8A") != -1) {//接收教具电量状态
-        let $_hexStr = hexStr.substr(6);
+        let $_hexStr = hexStr.substr(hexStr.toUpperCase().indexOf("AADD8A")+6);
         let $power = parseInt($_hexStr.substr(0, 2), 16)
         let $voltage = parseInt($_hexStr.substr(2, 2), 16)
 
-        $this.toy_power = Math.round(that.CalBLEPower($voltage));
-
+        // $this.toy_power = Math.round(that.CalBLEPower($voltage));
+        $this.toy_power = $power
+        ToyPower = $power;
         //连接上教具的标识
         //FF为无效
         if ($power != 0) {
@@ -707,7 +725,9 @@ export default {
 
   //重连教具
   ReconnectToy() {
+    current_device_mac = game_store.getters.getDeviceId();
     let $game_status = game_store.getters.getGameStatus();
+
     let that = this;
     try {
       //发送UUID
@@ -734,6 +754,7 @@ export default {
         })
       }
       let connect_toy_intv = setInterval(() => {
+        $game_status = game_store.getters.getGameStatus();
         if ($game_status == 1) {
 
           if (connect_toy == false) {