<template>
  <div id="login-out">
    <span class="user_part">
      <i class="fa fa-user"></i>
      <span>{{userName}}</span>
    </span>
    <span @click="loginOut" class="out_part">
      <i class="fa fa-sign-out"></i>
       <span>退出</span>
    </span>
  </div>
</template>

<script>
export default {
  name: "LoginOut",
  data(){
    return{
      userName:'',
    }
  },
  mounted() {
    this.userName = localStorage.getItem("zhfx_username")
  },
  methods:{

    loginOut(){
      localStorage.setItem("zhfx_usercode", "");
      localStorage.setItem("zhfx_username", "");
      localStorage.setItem("zhfx_unitcode", "");
      localStorage.setItem("zhfx_unitname", "");
      localStorage.setItem("zhfx_lasttime", "");
      localStorage.setItem("zhfx_role", "");
      localStorage.setItem("zhfx_userkeycode", "");
      localStorage.setItem("zhfx_changetime", "");
      localStorage.setItem("zhfx_role_uuid", "");
      this.$router.push('/login')
    }
  }
}
</script>

<style scoped lang="scss">
#login-out{
  position: absolute;
  z-index:1;
  top: 0px;
  right:0px;
  width: 210px;
  height: 68px;
  background-image: url("../../../assets/imgs/mainPage/登出.png");
  background-repeat: no-repeat;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  .user_part{
    width: 40%;
    height: 40px;
    display: flex;
    align-items: center;
    >i{
      color: white;
      padding-right: 10px;
    }
    >span{
      color: white;
      font-size: 14px;
    }
  }
  .out_part{
    width: 40%;
    height: 40px;
    display: flex;
    align-items: center;
    cursor: pointer;
    >i{
      padding-right: 10px;
      color: white;
    }
    >span{
      color: white;
      font-size: 14px;
    }
  }
}
</style>
