Forráskód Böngészése

完成了蓝牙连接设备得模块

yerong 4 éve
szülő
commit
d1c19aa718

+ 1 - 1
dist/wx

@@ -1 +1 @@
-Subproject commit d5ffa1a7d02218a046df333f81e51a55a1bbd318
+Subproject commit 74dc95433b55b87be1fda21be1d7c6e1cbe21a8e

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

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

+ 29 - 23
src/components/index/regist.vue

@@ -113,7 +113,6 @@ export default {
     },
     //微信授权登录
     wechat_login($userinfo) {
-      console.log('登录')
       Toast.loading({
         duration: 0, // 持续展示 toast
         forbidClick: true,
@@ -127,33 +126,40 @@ export default {
         invite: $this.invite,
       }
       // if ($this._userinfo) {
-        $params['user_name'] = $this._userinfo.nickName
-        $params['portrait'] = $this._userinfo.avatarUrl
-        $params['sex'] = $this._userinfo.gender
+      $params['user_name'] = $this._userinfo.nickName
+      $params['portrait'] = $this._userinfo.avatarUrl
+      $params['sex'] = $this._userinfo.gender
       // }
 
       if ($this.title == "注册") {
         userRegister($params).then((res) => {
-          console.log(res)
-          let $data = res.data
-          if (!$data['code']) {
-            Toast.clear()
-            $this.login_success($data)
-          } else {
-            Toast.fail($data['errmsg'])
+            console.log(res)
+            let $data = res.data
+            if (!$data['code']) {
+              Toast.clear()
+              $this.login_success($data)
+            } else {
+              Toast.fail($data['errmsg'])
+            }
+          },
+          (err) => {
+            console.log(err)
           }
-        })
+        )
       } else if ($this.title == "登录") {
         userLogin($params).then((res) => {
-          console.log(res)
-          let $data = res.data
-          Toast.clear()
-          if (!$data['code']) {
-            $this.login_success($data)
-          } else {
-            Toast.fail($data['errmsg'])
-          }
-        })
+            console.log(res)
+            let $data = res.data
+            Toast.clear()
+            if (!$data['code']) {
+              $this.login_success($data)
+            } else {
+              Toast.fail($data['errmsg'])
+            }
+          },
+          (err) => {
+            console.log(err)
+          })
       }
 
     },
@@ -191,8 +197,8 @@ export default {
     }
   },
   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) {

+ 27 - 11
src/components/index/scan.vue

@@ -10,7 +10,12 @@
     </div>
 
     <div class="text-center padding">
-      <button class="cu-btn lg cu-btn-primary text-white text-center">关于水母星球</button>
+      <van-field
+        :value="username"
+        placeholder="请输入用户名"
+      >
+      </van-field>
+      <button class="cu-btn lg cu-btn-primary text-white text-center" @click="toLogin">关于水母星球</button>
     </div>
     <view class="text-center text-xs">
       <text class="text-gray">如果您在我们的实体店,请在店员的指导下链接脑环</text>
@@ -18,19 +23,30 @@
   </div>
 </template>
 <script>
-  export default {
-    name:'scan_container',
-    methods:{
-      open_scan(){
-        wx.scanCode({
-          onlyFromCamera:true
-        })
-      },
-      toLogin(){
-        this.$emit('changeStatus','login')
+export default {
+  name: 'scan_container',
+  data() {
+    return {
+      username: ""
+    }
+  },
+  methods: {
+    open_scan() {
+      wx.scanCode({
+        onlyFromCamera: true
+      })
+    },
+    toLogin() {
+      let $params = {
+        access_token: 11,
+        user_name: username
       }
+      $this.$fly.post('', $params).then((res)=>{
+
+      })
     }
   }
+}
 </script>
 <style>
 .sub_slogen_ext {

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

@@ -5,6 +5,7 @@
     "van-popup": "../../../static/vant/popup/index",
     "van-overlay": "../../../static/vant/overlay/index",
     "van-toast": "../../../static/vant/toast/index",
+    "van-field": "../../../static/vant/field/index",
         "van-count-down":"../../../static/vant/count-down/index"
 
   }