<template>
  <div class="fixed-header">
    <el-header>
      <el-row>
        <el-col :span="1">
          <span>logo</span>
        </el-col>
        <el-col :span="1" :push="22"
          ><div class="sign-out" @click="signOut">{{ userType }}退出</div></el-col
        >
      </el-row>
    </el-header>
  </div>
</template>

<script>
export default {
  props: {
    userType: {
      type: String,
      default: ''
    }
  },
  methods: {
    async signOut() {
      await this.$store.dispatch('user/signOut');
      this.$router.push(`/login?redirect=${this.$route.fullPath}`);
    }
  }
};
</script>

<style lang="scss" scoped>
.fixed-header {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  z-index: 9;

  .el-header {
    height: $header-h !important;
    line-height: $header-h;
    background-color: $bacColor;
    text-align: center;

    .sign-out {
      cursor: pointer;
      font-size: 12px;
    }
  }
}
</style>
