<template>
  <view class="content">
    <view class="mb40" style="border-bottom: 1px solid #eee;margin-top: 100px;">
      <u-input border="none" v-model="loginForm.phone" type="number" maxlength="11"
        placeholder="输入手机号" />
    </view>
    <u-button shape="circle" type="primary" @click="bindLogin()">授权登录</u-button>
  </view>
</template>

<script>
import useUserStore from '@/jtools/store/user'
import storage from '@/jtools/storage';
export default {
  data() {
    return {
      loginForm: {
        phone: '',
        code: '000000'
      },
      countDown: 0,
      js: undefined
    };
  },
  methods: {
    bindLogin() {
      let params = { ...this.loginForm }
      if (storage.get('companyId')) {
        params.id = storage.get('companyId')
      }
      useUserStore().login(params).then(resp => {
        if (resp.userId) {
          useUserStore().getUserInfo()
          uni.navigateBack()
        }
      })
    },
  }
}
</script>

<style>
.content {
  width: 100vw;
  height: 100vh;
  padding: 20px;
  background-color: #fff;
}
</style>