<style lang="less">
  @import './login.less';
</style>

<template>
   <div class="login">
      <h1>欢迎，登陆青鸽管家！</h1>
    <div class="login-con">
      <Card shadow  :bordered="false">
        <div class="form-con">
          <login-form @on-success-valid="handleSubmit"></login-form>
          <p class="login-tip"></p>
        </div>
      </Card>
    </div>
  </div>
</template>

<script>
import LoginForm from '_c/login-form'
import { mapActions } from 'vuex'
// import { initRouter } from '@/libs/router-util'

export default {
  components: {
    LoginForm
  },
  methods: {
    ...mapActions([
      'handleLogin',
      'getUserInfo'
    ]),
    handleSubmit (e) {
      // var time = new Date().getTime()
      // console.log(time)
      // var _self = this
      // let login = e.loginname
      const { loginname, loginpwd } = e
      this.handleLogin({ loginname, loginpwd }).then(res => {
        // console.log(res)
        // initRouter()
        // console.log(this.$config.homeName)
        this.$router.push({
          name: this.$config.homeName
        })

        // var time2 = new Date().getTime()
        // console.log(time2)
        // this.getUserInfo().then(res => {
        // console.log(res)
        // var time3 = new Date().getTime()
        // console.log(time3)
      })
      // })
      // var time2 = new Date().getTime()
      // console.log(time2)
    }
  }
}
</script>

<style>

</style>
