yerong 4 년 전
부모
커밋
8b8cfb5ba0

+ 0 - 1
.gitignore

@@ -1,6 +1,5 @@
 .DS_Store
 node_modules/
-dist/
 npm-debug.log*
 yarn-debug.log*
 yarn-error.log*

+ 1 - 0
dist/wx

@@ -0,0 +1 @@
+Subproject commit c887d694e2421fdaa1cc80338277ab05e4e5d454

+ 4 - 4
src/components/device/device.vue

@@ -6,10 +6,10 @@
           <div class="line"></div>
           <div class="title">我的设备</div>
         </div>
-        <div class="my_msg" @click="get_toy_list">
-          <text class="cuIcon-mark"></text>
-          <text class="under_line">获取设备列表</text>
-        </div>
+<!--        <div class="my_msg" @click="get_toy_list">-->
+<!--          <text class="cuIcon-mark"></text>-->
+<!--          <text class="under_line">获取设备列表</text>-->
+<!--        </div>-->
       </div>
       <div v-if="connect_toy==0">
 

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

@@ -51,10 +51,10 @@ export default {
       }
 
     }
-    // else {
-    //   // 跳转到关于水母页面
-    //   this.$emit('changeStatus', 'scan')
-    // }
+    else {
+      // 跳转到关于水母页面
+      this.$emit('changeStatus', 'scan')
+    }
   }
 }
 </script>

+ 66 - 54
src/components/index/regist.vue

@@ -1,15 +1,15 @@
 <template>
   <div id="index_login_container" class="animation-slide-right">
-    <view class="solid-bottom text-xl padding text-center">
+    <view class="text-xl padding text-center">
       <img class="back regist_back_btn" @click="goIndex" src="https://img.shuimuai.com/fanhui.png"/>
-      <text class=" text-bold title_color">{{ title }}</text>
+      <text class=" text-bold title_color">会员{{ title }}</text>
     </view>
     <view class="text-df text-center slogen">请输入手机号码,以便更好的享受我们的服务</view>
     <div class="register_form_container text-center">
       <form action="">
         <view class="cu-form-group">
           <view class="title">手机号码</view>
-          <input placeholder="请输入手机号" v-model="phone" maxlength="11"/>
+          <input placeholder="请输入手机号" v-model="phone" maxlength="11" @input="check_auth"/>
           <view class="cu-capsule radius">
             <view class='cu-tag bg-blue '>
               +86
@@ -21,10 +21,11 @@
         </view>
         <view class="cu-form-group">
           <view class="title">验证码</view>
-          <input placeholder="输入验证码" name="input" v-model="verfiy_code" maxlength="6"/>
-          <button class='cu-btn bg-primary text-white shadow' :disabled="time_out > 0" @click="get_verify_code">
-            <template v-if="time_out>0">{{ time_out }}后</template>
-            获取验证码
+          <input placeholder="输入验证码" name="input" v-model="verfiy_code" maxlength="6" @input="check_auth"/>
+          <button class='cu-btn bg-primary text-white shadow' :disabled="time_show" @click="get_verify_code">
+            <van-count-down v-if="time_show" :auto-start="time_start" class="control-count-down" @finish="time_finished"
+                            :time="time_count * 1000" format="ss"/>
+            <text>获取验证码</text>
           </button>
         </view>
       </form>
@@ -33,11 +34,14 @@
     <div class="text-center padding">
       <button class="cu-btn lg cu-btn-primary text-white text-center" open-type="getUserInfo"
               @getuserinfo="get_Userinfo"
-              v-if="auth_login">
-        微信授权登录
-      </button>
-      <button class="cu-btn lg cu-btn-primary text-white text-center" @click="wechat_login" v-else>微信授权登录
+              :disabled="btn_disabled">
+        {{ title }}
       </button>
+<!--      -->
+<!--      <button class="cu-btn lg cu-btn-primary text-white text-center" @click="wechat_login"-->
+<!--              :disabled="btn_disabled"-->
+<!--              v-else>{{ title }}-->
+<!--      </button>-->
     </div>
     <view class="text-center text-xs">
       <text class="text-gray">如果您在我们的实体店,请在店员的指导下链接脑环</text>
@@ -68,6 +72,10 @@ export default {
         avatarUrl: "",
         gender: ""
       },
+      btn_disabled: true,
+      time_show: false,
+      time_start: false,
+      time_count: 60
     }
   },
   watch: {
@@ -76,8 +84,18 @@ export default {
         wx.hideKeyboard()
       }
     }
+
   },
   methods: {
+    check_auth() {
+      let $reg = /(13\d|14[579]|15[^4\D]|17[^49\D]|18\d)\d{8}/
+      let $verify_reg = /\d{6}/
+      if ($reg.test($this.phone) && $verify_reg.test($this.verfiy_code)) {
+        $this.btn_disabled = false
+      } else {
+        $this.btn_disabled = true
+      }
+    },
     //跳转到首页
     goIndex() {
       this.$emit('changeStatus', 'login')
@@ -101,16 +119,6 @@ export default {
     //微信授权登录
     wechat_login($userinfo) {
       console.log('登录')
-      let $reg = /(13\d|14[579]|15[^4\D]|17[^49\D]|18\d)\d{8}/
-      if ($reg.test($this.phone) == false) {
-        Toast.fail('请输入正确手机号')
-        return false;
-      }
-      $reg = /\d{6}/
-      if ($reg.test($this.verfiy_code) == false) {
-        Toast.fail('请输入正确的验证码')
-        return false;
-      }
       Toast.loading({
         duration: 0, // 持续展示 toast
         forbidClick: true,
@@ -128,36 +136,35 @@ export default {
         $params['portrait'] = $this._userinfo.avatarUrl
         $params['sex'] = $this._userinfo.gender
       }
-      //用户注册
-      userRegister($params).then((res) => {
-        let $data = res.data
-        if (!$data['code']) {
+
+      if ($this.title == "注册") {
+        userRegister($params).then((res) => {
+          let $data = res.data
+          if (!$data['code']) {
+            Toast.clear()
+            $this.login_success($data)
+          } else {
+            Toast.fail($data['errmsg'])
+          }
+        })
+      } else if ($this.title == "登录") {
+        userLogin($params).then((res) => {
+          let $data = res.data
           Toast.clear()
-          $this.login_success($data)
-        } else if ($data['code'] == 201) {
-          // 判断用户已经注册了 就进行登录的操作
-          $params = {
-            phone: $this.phone,
-            code: $this.verfiy_code,
+          if (!$data['code']) {
+            $this.login_success($data)
+          } else {
+            Toast.fail($data['errmsg'])
           }
-          userLogin($params).then((res) => {
-            let $data = res.data
-            Toast.clear()
-            if (!$data['code']) {
-              $this.login_success($data)
-            } else {
-              Toast.fail($data['errmsg'])
-            }
-          })
-        } else if ($data['code'] == 204) {
-          Toast.fail($data['errmsg'])
-        }
-      })
+        })
+      }
+
     },
     //登录成功
     login_success($data) {
       Toast.success($data['errmsg'])
       $this.$store.commit('set_token', $data['data'])
+      $this.$store.commit('set_login')
       $this.$emit('change_login_status', true)
       $this.$store.commit('set_invite_code', $this.invite)
       //获取用户信息
@@ -168,22 +175,27 @@ export default {
     },
     //打开倒计时
     open_time_down() {
-      $this.time_out = 60
-      setInterval(() => {
-        if ($this.time_out > 0) {
-          $this.time_out = $this.time_out - 1
-        }
-      }, 1000)
+      $this.time_count = 60
+      $this.time_start = $this.time_show = true
+    },
+    //倒计时结束
+    time_finished() {
+      $this.time_start = $this.time_show = false
     },
     //  获取用户信息
     get_Userinfo(e) {
-      $this._userinfo = e.mp.detail.userInfo
-      $this.wechat_login()
+      console.log(e)
+      if (e.mp.detail.errMsg == "getUserInfo:fail auth deny") {
+        Toast.fail('请进行授权登录')
+      } else {
+        $this._userinfo = e.mp.detail.userInfo
+        $this.wechat_login()
+      }
     }
   },
   mounted() {
-    // $this.invite = $this.$store.getters.get_invite_code ? $this.$store.getters.get_invite_code : wx.getStorageSync('code')
-    $this.invite = 3
+    $this.invite = $this.$store.getters.get_invite_code ? $this.$store.getters.get_invite_code : wx.getStorageSync('code')
+    // $this.invite = 3
     console.log('regist-invite', $this.invite)
     mpvue.login({
       success($res) {

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

@@ -86,9 +86,9 @@ export default {
     // 修改界面的文字
     change_title($status) {
       if ($status == 0) {
-        this.regist_title = "注册会员"
+        this.regist_title = "注册"
       } else if ($status == 1) {
-        this.regist_title = "会员登录"
+        this.regist_title = "登录"
       }
     },
     //跳转页面

+ 3 - 1
src/pages/index/main.json

@@ -4,6 +4,8 @@
     "van-col": "../../../static/vant/col/index",
     "van-popup": "../../../static/vant/popup/index",
     "van-overlay": "../../../static/vant/overlay/index",
-    "van-toast": "../../../static/vant/toast/index"
+    "van-toast": "../../../static/vant/toast/index",
+        "van-count-down":"../../../static/vant/count-down/index"
+
   }
 }

+ 66 - 142
src/pages/start/index.vue

@@ -290,149 +290,9 @@ export default {
       wx.onBLECharacteristicValueChange((characteristic) => {
         console.log("收到" + $this.ab2hex(characteristic.value));
         let hexStr = $this.ab2hex(characteristic.value)
-
-        if (hexStr.substring(0, 10) == 'aadd0a0000') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '未找到教具',
-            icon: 'none',
-            duration: 1500
-          })
-          console.log("无连接设备")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0001') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到水柱音箱',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-          console.log("水柱音箱")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0002') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到喷雾恐龙(大)',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("喷雾恐龙(大)")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0003') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到喷雾恐龙(小)',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("喷雾恐龙(小)")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0004') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到轨道车',
-            icon: 'success',
-            duration: 1500
-          })
+        let $flag = bluetooth.connect_toy(hexStr)
+        if ($flag) {
           bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("轨道车")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0005') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到碰碰车',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("碰碰车")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0006') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到小车(大)',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("小车(大)")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0007') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到小车(中)',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("小车(中)")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0008') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到小车(小)',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("小车(小)")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a0009') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到飞行器(大)',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("飞行器(大)")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a000a') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到飞行器(小)',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("飞行器(小)")
-        }
-        if (hexStr.substring(0, 10) == 'aadd0a000b') {
-          wx.hideLoading()
-          wx.showToast({
-            title: '已连接到水母灯)',
-            icon: 'success',
-            duration: 1500
-          })
-          bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-          $this.connect_toy = 2
-
-          console.log("水母灯")
-        }
-        if (hexStr.substring(0, 10) == 'aadd070000') {
-          bluetooth.sendOpen($this._deviceId, $this._serviceId, $this._characteristicId)
         }
       })
     },
@@ -453,6 +313,70 @@ export default {
     $this._deviceId = game_store.getters.getDeviceId
     $this.toy_index = game_store.getters.getToyIndex
     $this.getBLEDeviceServices($this._deviceId)
+
+    //  模拟蓝牙输入值
+    //55 55 20 01 00 02 1b 03 33 04 18 00 15 d7 00 75 37 00 0d da 00 0d 9b 00 10 c2 00 0a f9 00 01 fb 00 04 5a 39
+    let hex = "5555200100021b033304180015d7007537000dda000d9b0010c2000af90001fb00045a39"
+    //当s1为 00时 数据有效
+    let $s1 = hex.substr(8, 2)
+
+    //专注度数据
+    let $att = parseInt("0x" + hex.substr(12, 2))
+    console.log('att', $att)
+    //放松度数据
+    let $med = parseInt("0x" + hex.substr(16, 2))
+    console.log('$med', $med)
+
+    //Delta数据
+    let $delta_1 = hex.substr(hex.indexOf('0418') + 4, 2)
+    let $delta_2 = hex.substr(hex.indexOf('0418') + 6, 2)
+    let $delta_3 = hex.substr(hex.indexOf('0418') + 8, 2)
+    let $delta = "0x" + $delta_1 << 16 | "0x" + $delta_2 << 8 | "0x" + $delta_3
+    console.log('Delta', parseInt("0x" +$delta))
+
+    //Theta数据
+    let $theta_1 = hex.substr(hex.indexOf('0418') + 10, 2)
+    let $theta_2 = hex.substr(hex.indexOf('0418') + 12, 2)
+    let $theta_3 = hex.substr(hex.indexOf('0418') + 14, 2)
+    let $theta = "0x" + $theta_1 << 16 | "0x" + $theta_2 << 8 | "0x" + $theta_3
+    console.log('Theta', parseInt("0x" +$theta))
+
+
+    //low_Alpha
+    let $low_alpha_1 = hex.substr(hex.indexOf('0418') + 16, 2)
+    let $low_alpha_2 = hex.substr(hex.indexOf('0418') + 18, 2)
+    let $low_alpha_3 = hex.substr(hex.indexOf('0418') + 20, 2)
+    let $low_alpha = "0x" + $low_alpha_1 << 16 | "0x" + $low_alpha_2 << 8 | "0x" + $low_alpha_3
+    console.log('low_alpha', $low_alpha)
+
+    //high_Alpha
+    let $high_alpha_1 = hex.substr(hex.indexOf('0418') + 22, 2)
+    let $high_alpha_2 = hex.substr(hex.indexOf('0418') + 24, 2)
+    let $high_alpha_3 = hex.substr(hex.indexOf('0418') + 26, 2)
+    let $high_alpha = "0x" + $high_alpha_1 << 16 | "0x" + $high_alpha_2 << 8 | "0x" + $high_alpha_3
+    console.log('high_alpha', $high_alpha)
+
+    let $alpha = ($high_alpha << 8) | $low_alpha
+    console.log('Alpha', parseInt("0x" +$alpha))
+
+    //low_beta
+    let $low_beta_1 = hex.substr(hex.indexOf('0418') + 28, 2)
+    let $low_beta_2 = hex.substr(hex.indexOf('0418') + 30, 2)
+    let $low_beta_3 = hex.substr(hex.indexOf('0418') + 32, 2)
+    let $low_beta = "0x" + $low_beta_1 << 16 | "0x" + $low_beta_2 << 8 | "0x" + $low_beta_3
+    console.log('$low_beta', $low_beta)
+
+    //high_beta
+    let $high_beta_1 = hex.substr(hex.indexOf('0418') + 34, 2)
+    let $high_beta_2 = hex.substr(hex.indexOf('0418') + 36, 2)
+    let $high_beta_3 = hex.substr(hex.indexOf('0418') + 38, 2)
+    let $high_beta = "0x" + $low_beta_1 << 16 | "0x" + $low_beta_2 << 8 | "0x" + $low_beta_3
+    console.log('$high_beta', $high_beta)
+
+    //Beta数据
+    let $beta = ($high_beta << 8) | $low_beta
+    console.log('Beta', parseInt("0x" +$beta))
+
   },
   created() {
     $this = this;

+ 15 - 6
src/pages/user_center/edit/confirm_phone_finally/index.vue

@@ -52,6 +52,7 @@
 
 <script>
 import Toast from '../../../../../static/vant/toast/toast';
+import {userChangePhone, userGetCode} from "../../../../requests/user";
 
 var $this
 export default {
@@ -88,7 +89,7 @@ export default {
       let $param = {
         phone: $this.new_phone
       }
-      $this.$fly.post('user/get-code', $param).then((res) => {
+      userGetCode($param).then((res) => {
         let $data = res.data
         if ($data.code != 200) {
           Toast.fail($data.errmsg)
@@ -98,11 +99,19 @@ export default {
     //确认修改
     confirm_modify() {
       // 修改成功跳转个人首页
-      // mpvue.reLaunch({
-      //   url:"/pages/user_center/edit/main"
-      // })
-      mpvue.navigateBack({
-        delta: 2
+      let $params = {
+        code: $this.sms,
+        new_phone: $this.new_phone,
+        old_phone: $this.phone
+      }
+      userChangePhone($params).then((res) => {
+        let $data = res.data
+        if ($data.code == 0) {
+          Toast.success($data.errmsg)
+          mpvue.navigateBack({
+            delta: 2
+          })
+        }
       })
     }
   }

+ 37 - 15
src/pages/user_center/edit/confirm_phone_first/index.vue

@@ -19,9 +19,17 @@
         :custom-style=custom_style
       >
         <van-button slot="button" size="small" type="primary" @click="sand_sms"
-        >发送验证码
-        </van-button
+                    class="flex"
+                    v-if="time_show==false"
         >
+          <text>发送验证码</text>
+        </van-button>
+        <view v-else slot="button" class="flex align-center">
+          <van-count-down v-if="time_show" :auto-start="time_start" class="control-count-down" @finish="time_finished"
+                          :time="time_count * 1000" format="ss"/>
+          <text>后发送验证码</text>
+        </view>
+
       </van-field>
       <div class="padding bottom_button">
         <button class="cu-btn lg cu-btn-primary text-white text-center " @click="to_finally_confirm">确定修改</button>
@@ -33,7 +41,7 @@
 
 <script>
 import Toast from '../../../../../static/vant/toast/toast';
-import {userGetCode,userLogin} from "@/requests/user";
+import {userGetCode, userCheckCode} from "@/requests/user";
 
 var $this
 export default {
@@ -50,7 +58,10 @@ export default {
             box-shadow: 0px 3px 7px 0px rgba(159, 159, 159, 0.84);
             border-radius: 10px;
             margin: 30px auto;
-      `
+      `,
+      time_show: false,
+      time_start: false,
+      time_count: 60
     }
   },
   methods: {
@@ -64,7 +75,7 @@ export default {
     //  发送验证码
     sand_sms() {
       Toast.loading({
-        duration:0
+        duration: 0
       })
       let $param = {
         phone: $this.base_phone
@@ -72,28 +83,39 @@ export default {
       userGetCode($param).then((res) => {
         Toast.clear()
         let $data = res.data
-        if ($data.code != 200) {
-          Toast.success($data.errmsg)
-        }
+        $this.start_count_down()
+        Toast.success($data.errmsg)
       })
     },
     //跳转最终修改手机的页面
     to_finally_confirm() {
       Toast.loading({
-        duration:0
+        duration: 0
       })
-      userLogin({phone: $this.base_phone, code: $this.sms}).then((res) => {
-                Toast.clear()
+      let $params = {phone: $this.base_phone, code: $this.sms}
+      userCheckCode($params).then((res) => {
+        Toast.clear()
         let $data = res.data
         if ($data.code == 0) {
-          mpvue.navigateTo({
-            url: "/pages/user_center/edit/confirm_phone_finally/main"
+          Toast.success({
+            message: $data.errmsg,
+            onClose() {
+              mpvue.navigateTo({
+                url: "/pages/user_center/edit/confirm_phone_finally/main"
+              })
+            }
           })
-          $this.$store.commit('set_token', $data['data'])
-        }else{
+        } else {
           Toast.fail($data.errmsg)
         }
       })
+    },
+    start_count_down() {
+      $this.time_count = 60
+      $this.time_start = $this.time_show = true
+    },
+    time_finished() {
+      $this.time_start = $this.time_show = false
     }
   }
   ,

+ 2 - 1
src/pages/user_center/edit/confirm_phone_first/main.json

@@ -6,6 +6,7 @@
     "van-cell-group": "../../../../static/vant/cell-group/index",
     "van-field": "../../../../static/vant/field/index",
     "van-button": "../../../../static/vant/button/index",
-    "van-toast": "../../../../static/vant/toast/index"
+    "van-toast": "../../../../static/vant/toast/index",
+    "van-count-down":"../../../../static/vant/count-down/index"
   }
 }

+ 29 - 0
src/requests/user.js

@@ -25,3 +25,32 @@ export function userDetail() {
   }
   return fly.post('user/user-detail', $params)
 }
+
+//校验验证码
+export function userCheckCode($params) {
+  let $token = store.getters.get_token
+  $params['access_token'] = $token
+  return fly.post('user/check-code', $params)
+}
+
+
+//修改手机号码
+export function userChangePhone($params) {
+  let $token = store.getters.get_token
+  $params['access_token'] = $token
+  return fly.post('user/change-phone', $params)
+}
+
+//修改性别
+export function userChangeSex($params) {
+  let $token = store.getters.get_token
+  $params['access_token'] = $token
+  return fly.post('user/change-sex', $params)
+}
+
+//修改生日
+export function userChangeBirthday($params) {
+  let $token = store.getters.get_token
+  $params['access_token'] = $token
+  return fly.post('user/change-birthday', $params)
+}

+ 3 - 1
src/store/index.js

@@ -14,8 +14,10 @@ export default new Vuex.Store({
   mutations: {
     set_token(state, token) {
       wx.setStorageSync('token', token)
-      wx.setStorageSync('is_login', true)
       state.token = token
+    },
+    set_login(state) {
+      wx.setStorageSync('is_login', true)
       state.is_login = true
     },
     set_invite_code(state, code) {

+ 107 - 0
src/utils/bluetooth.js

@@ -170,4 +170,111 @@ export default {
       }
     })
   },
+  // 通过字节码获取玩具
+  connect_toy(hexStr) {
+    let $toys = [
+      {
+        id: 1,
+        hex: 'aadd0a0000',
+        msg: "无连接设备",
+        flag: false
+      },
+      {
+        id: 1,
+        hex: 'aadd0a0001',
+        msg: "已连接到水柱音箱",
+        flag: true
+      },
+      {
+        id: 2,
+        hex: 'aadd0a0002',
+        msg: "已连接到喷雾恐龙(大)",
+        flag: true
+      },
+      {
+        id: 3,
+        hex: 'aadd0a0003',
+        msg: "已连接到喷雾恐龙(小)",
+        flag: true
+      },
+      {
+        id: 4,
+        hex: 'aadd0a0004',
+        msg: "已连接到轨道车",
+        flag: true
+      },
+      {
+        id: 5,
+        hex: 'aadd0a0005',
+        msg: "已连接到碰碰车",
+        flag: true
+      },
+      {
+        id: 6,
+        hex: 'aadd0a0006',
+        msg: "已连接到小车(大)",
+        flag: true
+      },
+      {
+        id: 7,
+        hex: 'aadd0a0007',
+        msg: "已连接到小车(中)",
+        flag: true
+      },
+      {
+        id: 8,
+        hex: 'aadd0a0008',
+        msg: "已连接到小车(小)",
+        flag: true
+      },
+      {
+        id: 9,
+        hex: 'aadd0a0009',
+        msg: '已连接到飞行器(大)',
+        flag: true
+      },
+      {
+        id: 10,
+        hex: 'aadd0a000a',
+        msg: "已连接到飞行器(小)",
+        flag: true
+      },
+      {
+        id: 11,
+        hex: 'aadd0a000b',
+        msg: "已连接到水母灯",
+        flag: true
+      },
+      {
+        id: 12,
+        hex: 'aadd070000',
+        msg: "无连接设备",
+        flag: true
+      },
+    ]
+
+    $toys.forEach(($val, $index) => {
+      if (hexStr.substring(0, 10) == $val['hex']) {
+        if ($val['flag']) {
+          wx.hideLoading()
+          wx.showToast({
+            title: $val['title'],
+            icon: 'success',
+            duration: 1500
+          })
+          console.log($val['title'])
+
+        } else {
+          wx.hideLoading()
+          wx.showToast({
+            title: $val['title'],
+            icon: 'nones',
+            duration: 1500
+          })
+        }
+        return $val['flag']
+      }
+
+    })
+  },
 }