<template>
  <div class="rpm-header">
    <div class="rpm-header__logo">
      <div class="rpm-header__logo-icon">
        <el-avatar size="large" :src="require('@/assets/images/sm_zjt_topbanner.png')" />
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  computed: {
    ...mapGetters([
      'userInfo',
      'sidebar',
      'avatar',
      'username',
      'device'
    ])
  },
  methods: {
    async logout() {
      await this.$store.dispatch('user/logout')
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
    }
  }
}
</script>

<style lang="scss" scoped>
  @import "@/styles/variables.scss";

  .rpm-header {
    height: 60px;
    line-height: 60px;
    position: relative;
    border-bottom: 1px solid rgba(144, 147, 153, 0.2);
    background-color: white;
    z-index: 1;
  }
  .rpm-header__logo {
    width: 170px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    color: white;
    font-size: 20px;
    transform-style: preserve-3d;
  }
  .rpm-header__logo-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    line-height: 0;
  }
  .rpm-header__logo-icon .el-avatar {
    background-color: $rpm-theme-color;
  }
  .rpm-header__title {
    position: absolute;
    top: 50%;
    left: 120px;
    transform: translateY(-50%);
    line-height: 100%;
    font-size: 25px;
    font-weight: bold;
    color: $rpm-theme-color;
  }
  .rpm-header__user, .rpm-header__logout {
    position: absolute;
    top: 0;
    height: 60px;
    line-height: 60px;
    text-align: center;
    cursor: pointer;
  }
  .rpm-header__user:hover, .rpm-header__logout:hover {
    background-color: #e6f7ff;
  }
  .rpm-header__user {
    padding-right: 16px;
    padding-left: 16px;
    right: 60px;
  }
  .rpm-header__logout {
    right: 0;
    width: 60px;
  }
  .rpm-header__logout .el-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
  }
</style>
