Переглянути джерело

完成代理商接口对接,未完成代理商页面确认

yerong 4 роки тому
батько
коміт
c275bf86da

+ 1 - 1
dist/wx

@@ -1 +1 @@
-Subproject commit 577446b07fc8e2578028ab49d3bc5cfcd256e1aa
+Subproject commit 7d7a14a079317519a9749acd98ca32babcfe0d38

+ 2 - 12
src/components/device/device.vue

@@ -132,13 +132,7 @@ export default {
         // show: true,
       },
       //'水柱音箱', '喷雾恐龙(大)', '喷雾恐龙(小)', '轨道车', '碰碰车', '小车(大)', '小车(中)', '小车(小)', '飞行器(大)', '飞行器(小)', '水母灯'
-      toy_list: [
-        {
-          id: 1,
-          name: "水柱音箱",
-          img: "https://img.shuimuai.com/web/toy_car.png",
-        },
-      ],
+      toy_list: [],
       toy_action: 1,
       connect_show: false,
       // connect_show: true,
@@ -146,11 +140,7 @@ export default {
       connect_toy: 0,
       code: "jellyfish1234",
       device: {},
-      canWrite: false,
       _deviceId: "",
-      _serviceId: "",
-      _characteristicId: "",
-      chs: [],
       _device_index: false,
     };
   },
@@ -307,6 +297,7 @@ export default {
           console.log("成功连接");
           //成功连接脑环蓝牙
           $this.change_device_status(2);
+          bluetooth.watch_bluetooth_status($this)
           // $this.getBLEDeviceServices($this.device.deviceId)
         },
         fail(err) {
@@ -342,7 +333,6 @@ export default {
     //  开始游戏的方法
     game_start() {
       game_store.commit("setToyIndex", $this.toy_action - 1);
-      // bluetooth.sendConnect($this.toy_action - 1, $this._deviceId, $this._serviceId, $this._characteristicId)
       console.log("device.vue", $this._deviceId);
     },
   },

+ 6 - 6
src/components/index/login.vue

@@ -71,12 +71,12 @@ export default {
 
     }
     // 测试注释
-    else {
-      // 跳转到关于水母页面
-      mpvue.reLaunch({
-        url: "/pages/none/main"
-      })
-    }
+    // else {
+    //   // 跳转到关于水母页面
+    //   mpvue.reLaunch({
+    //     url: "/pages/none/main"
+    //   })
+    // }
   }
 }
 </script>

+ 0 - 1
src/components/index/personal.vue

@@ -212,7 +212,6 @@ export default {
   }
   ,
   onShow() {
-    console.log(1)
     reload_userinfo($this)
   }
   ,

+ 3 - 3
src/pages/user_center/index.vue

@@ -79,6 +79,8 @@
 
 <script>
 import utils from '@/utils/index'
+import {reload_userinfo} from "../../utils/user";
+import bluetooth from "../../utils/bluetooth";
 
 var $this
 export default {
@@ -126,9 +128,7 @@ export default {
     $this = this;
   },
   onLoad() {
-    $this.userinfo = wx.getStorageSync('userinfo')
-    $this.userinfo['validity_time'] = utils.formatTime($this.userinfo['validity_time'])
-    $this.userinfo['level_name'] = utils.get_level_name($this.userinfo['level'])
+    reload_userinfo($this)
   },
 }
 </script>

+ 1 - 3
src/pages/user_center/recharge/index.css

@@ -107,9 +107,7 @@
   font-family: Microsoft YaHei;
   font-weight: 400;
   color: #4B4B4B;
-  line-height: 24px;
   width: 200px;
-  height: 30px;
 }
 
 .boy_logo {
@@ -117,5 +115,5 @@
   height: 184px;
 }
 .ext_container{
-  height: 420px;
+  height: 320px;
 }

+ 1 - 1
src/pages/user_center/recharge/index.vue

@@ -197,7 +197,7 @@
         </view>
         <view class="sub-title">
           <text class="text-gray">
-            {{ selection_card.goods_name }}卡,我们将以快递形式发出,请填写收货地址.
+            {{ selection_card.goods_name }},请到实体店店员处领取邀请卡
           </text>
         </view>
         <div class="button_group flex justify-around">

+ 8 - 0
src/requests/user.js

@@ -63,3 +63,11 @@ export function userCheckInvite($invite_code) {
   }
   return fly.post('user/check-invite', $params);
 }
+
+//刷新登录时间
+export function userUpdateLoginTime(){
+  let $params = {
+    access_token: wx.getStorageSync('token')
+  }
+  return fly.post('user/update-login-time', $params);
+}

+ 18 - 0
src/utils/bluetooth.js

@@ -1,4 +1,9 @@
+var $this = this
 export default {
+  test_name: 'hello world',
+  deviceId: "",
+  serviceId: "",
+  cid: "",
   // 发送开启脑电数据包指令
   sendOpen(deviceId, serviceId, Cid) {
     // 向蓝牙设备发送一个0x00的16进制数据
@@ -373,5 +378,18 @@ export default {
     }
     let $power = parseInt(hex.substr(8, 2))
     return $power
+  },
+
+//  监听蓝牙连接状态
+  watch_bluetooth_status($that) {
+    wx.onBLEConnectionStateChange((res) => {
+      // 该方法回调中可以用于处理连接意外断开等异常情况
+      if (res.connected == false) {
+        //断开蓝牙连接
+        $that.status = 0
+        //断开玩具连接
+        $that.connect_toy = 0
+      }
+    })
   }
 }

+ 4 - 1
src/utils/user.js

@@ -1,7 +1,9 @@
 import {userDetail} from "../requests/user";
-import {formatBirthday,formatTime} from "./index";
+import {formatBirthday, formatTime} from "./index";
+import utils from "./index";
 import user_store from '../store/index'
 
+
 //刷新用户信息
 
 export function reload_userinfo($this) {
@@ -10,6 +12,7 @@ export function reload_userinfo($this) {
     $this.userinfo = $data.data;
     $this.userinfo.birthday = formatBirthday($this.userinfo.birthday)
     $this.userinfo['validity_time'] = formatTime($this.userinfo['validity_time'])
+    $this.userinfo['level_name'] = utils.get_level_name($this.userinfo['level'])
     // $this.userinfo.play_time = Math.ceil($this.userinfo.play_time / 60)
     user_store.commit('set_userinfo', $this.userinfo)
   })