Bläddra i källkod

调整结束游戏的bug

yerong 4 år sedan
förälder
incheckning
35762183c0
4 ändrade filer med 13 tillägg och 19 borttagningar
  1. 1 1
      dist/wx
  2. 5 5
      src/pages/index/index.vue
  3. 3 2
      src/pages/start/index.vue
  4. 4 11
      src/utils/bluetooth.js

+ 1 - 1
dist/wx

@@ -1 +1 @@
-Subproject commit 3a4efe72255ad8407d5e67f44adfbb8e53a3a339
+Subproject commit a3a7976b3f4a78678c81e7370e5cc33f68a8b529

+ 5 - 5
src/pages/index/index.vue

@@ -136,6 +136,11 @@ export default {
     }
   },
   mounted() {
+    wx.login({
+      success(res){
+        console.log(res);
+      }
+    })
   },
   onShow() {
     userDetail().then((res) => {
@@ -150,11 +155,6 @@ export default {
   onUnload() {
   },
   onLoad($option) {
-    wx.login({
-      success(res){
-        console.log(res);
-      }
-    })
     //  判断存储是否登录
     let $token = wx.getStorageSync('token')
     if ($token) {

+ 3 - 2
src/pages/start/index.vue

@@ -341,6 +341,9 @@ export default {
       }
       $this.timeData = $datetime
       $this.played_time += 1
+      if ($this.played_time % 60 == 0){
+        $this.post_data()
+      }
     },
     // 往后端推送一次定时数据
     post_data() {
@@ -400,8 +403,6 @@ export default {
         $this.theta_list.shift()
         $this.beta_list.shift()
       }
-      console.log("专注度列表:", $this.att_list)
-      console.log("放松度列表:", $this.med_list)
 
       $this.attList.push($data['att'])
       $this.medList.push($data['med'])

+ 4 - 11
src/utils/bluetooth.js

@@ -29,8 +29,8 @@ export default {
       characteristicId: Cid,
       value: buffer,
       success: function (res) {
-        console.log('开启脑电数据包成功')
-        console.log(res)
+        // console.log('开启脑电数据包成功')
+        // console.log(res)
       },
       fail: function (err) {
         console.log('开启脑电数据包失败')
@@ -65,9 +65,9 @@ export default {
       characteristicId: Cid,
       value: buffer,
       success: function (res) {
-        console.log('开启教具脑控成功')
+        // console.log('开启教具脑控成功')
         // that.sendOpen()
-        console.log(res)
+        // console.log(res)
       },
       fail: function (err) {
         console.log('开启教具脑控失败')
@@ -474,26 +474,20 @@ export default {
   //监听玩具得状态
   watching_toy($this, deviceId, serviceId, Cid, Toast) {
     Toast.loading({
-      duration: 0,
       forbidClick: false,
       message: "正在创建连接"
     })
     let that = this
     let $count = 0
-    setTimeout(() => {
-      Toast.clear()
-    }, 5000)
     //关闭核销选项窗口
     // $this.pay_window = false
     wx.onBLECharacteristicValueChange((characteristic) => {
       try {
         let hexStr = that.ab2hex(characteristic.value)
-        console.log("收到" + hexStr);
         //连接玩具
         let $flag = that.connect_toy(hexStr, deviceId, serviceId, Cid, Toast)
         //连接不上设备
         if ($flag) {
-          Toast.clear()
           //连接成功 打开核销窗口
           // $this.pay_window = true
           $this.change_toy_connect_status(2)
@@ -506,7 +500,6 @@ export default {
         } else {
           $count++
           if ($count == 10) {
-            Toast.clear()
             $this.change_toy_connect_status(3)
             wx.offBLECharacteristicValueChange()
             that.watchingDevice($this)