<template>
  <div class="tabs-body">
		<div style="margin:50px;overflow: auto;" v-if="!baozheng.isLogin">
      <el-form :model="ruleForm2" status-icon  ref="baozhengform"  class="demo-ruleForm">
        <el-form-item prop="pass">
          <el-input type="text" placeholder="登录名" v-model="ruleForm2.account" auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item  prop="checkPass">
          <el-input type="password" placeholder="密码" v-model="ruleForm2.passwd" auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm()">登录</el-button>
        </el-form-item>
      </el-form>
    </div>
    <baozheng v-if="baozheng.isLogin&&user.userInfo.type==1"/>   
    <chenzheng v-if="baozheng.isLogin&&user.userInfo.type==3"/>
  </div>  
</template>

<script>
import { mapGetters, mapState, mapActions } from 'vuex'
import baozheng from './baozheng'
import chenzheng from './chenzheng'
import { mainPanel } from '@/utils/common'
export default{
    data(){
      return {
        activeName:'second',
        ruleForm2:{
          account:'',
          passwd:''
        }
      }    
    },
    components: {
        baozheng,
        chenzheng,
    },
    computed: {
      ...mapState([
        'baozheng',
        'user',
      ])
    },
    mounted() {
      this.init()
    },
    methods: {
      ...mapActions('baozheng',[
          'login',
          'init'
      ]),
      submitForm(){
        let parm = this.ruleForm2
        this.login(parm).then(()=>{
          this.$message({
            message: '登录成功！',
            type: 'success'
          });
          this.isLogin = true
        }).catch((error)=>{
           this.$message.error(error);
        })
      },
      handleClick(){
        console.log()
        console.log(43434)
      }
    }
}
</script>

<style lang="stylus" scoped>
.tabs-body
  height:100%;
  width:100%;
  overflow: auto;
  .tool-body
    width:100%;
    height:729px;
    overflow-y: auto;
</style>