<template>
  <form action="">
      <div class="f-row row-user">
        <input type="text" :placeholder="$t('login.loginTipAccount')" autocomplete>
      </div>
      <div class="f-row row-psw">
        <input type="password" :placeholder="$t('login.loginTipPsw')" autocomplete>
      </div>
      <el-button type="primary" class="login-btn" @click="handleLogin">{{$t('login.login')}}</el-button>
    </form>
</template>

<script>
import Vue from 'vue'
import { Button } from 'element-ui'
import { mapState } from 'vuex'

Vue.component(Button.name, Button)

export default {
  name: 'loginBox',
  created () {

  },
  computed: {
    ...mapState([
      'account',
      'scatter'
    ]),
    isLogin () {
      return this.$store.state.chat.isLogin
    }
  },
  methods: {
    async handleLogin () {
      try {
        await this.$store.dispatch('doScatterLogin', this.$router)
        await this.$store.dispatch('doContractLogin')
        this.$store.commit('chatAppLogin', true)
        this.$store.commit('toApp', true)
      } catch (error) {
        this.$store.commit('chatAppLogin', false)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.c-loginBox{
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -358px 0 0 -477px;
  border-radius: 4px;
  background-color: #e4e8eb;
  width: 954px;
  height: 717px;
  box-shadow: 0 2px 10px #999;
  text-align: center;
  overflow: hidden;
}
.logo{
    margin: 100px 0 40px;
    height: 38px;
    background: url(./img/logo.png) center no-repeat;
  }
.f-row{
  width: 212px;
  padding-left: 85px;
  border-bottom: 1px solid rgba(#000,0.1);
  margin: 20px auto 0;
  input{
    width: 212px;
    height: 54px;
    line-height: 54px;
    border: 0;
    font-size: 14px;
    outline: none;
    background: transparent;
  }
}
.row-user{
  background: url(./img/icon-user.png) 20px center no-repeat;
}
.row-psw{
  background: url(./img/icon-psw.png) 20px center no-repeat;
}
.login-btn{
  margin: 60px 0 80px;
  width: 174px;
  font-size: 20px;
  padding: 14px;
}
.tip{
  display: block;
  color: #f93c3c;
  font-size: 12px;
}

.mini-wrap,.h5-wrap{
  .f-row{
    padding-left: 45px;
    width: auto;
    input{
      height: 36px;
      line-height: 36px;
      width: 100%;
    }
  }
  .row-user{
    background: url(./img/icon-meechat.png) 12px center /18px no-repeat;
  }
  .row-psw{
    background-position: 12px center;
  }
  .login-btn{
    display: block;
    margin: 40px auto 40px;
  }
}

.h5-wrap{
    .f-row{
        margin-top: 30px;
    }
    .login-btn{
        font-size: px2rem(32);
        width: px2rem(380);
    }
}
</style>
