<template>
  <div class="header-container">
    <div class="system-log">苏州园区志愿服务活动区块链平台</div>
    <div class="right-menu">
      <el-dropdown
        class="avatar-container right-menu-item hover-effect"
        trigger="click"
      >
        <div class="avatar-wrapper">
          <img :src="avatar" class="user-avatar" />
          <!-- <i class="el-icon-caret-bottom" /> -->
          <div class="user-name">{{ name }}</div>
        </div>
        <el-dropdown-menu slot="dropdown">
          <router-link to="/user/profile">
            <el-dropdown-item>个人中心</el-dropdown-item>
          </router-link>

          <el-dropdown-item divided @click.native="logout">
            <span>退出登录</span>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapGetters(["avatar", "name"]),
  },
};
</script>

<style lang="scss" scoped>
// @import "@/assets/styles/element-variables.scss";
.header-container {
  height: 60px;
  background: url("~@/assets/images/title-bg@2x.png");
  background-size: cover;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  .system-log {
    font-size: 23px;
    font-family: "Alibaba-PuHuiTi-Bold";
    font-weight: bold;
    color: #ffffff;
    line-height: 60px;
    letter-spacing: 2px;
  }
  .avatar-container {
    .avatar-wrapper {
      display: flex;
      align-items: center;
      cursor: pointer;
      .user-avatar {
        width: 35px;
        height: 35px;
        border-radius: 50%;
      }
      .user-name {
        margin-left: 10px;
        font-size: 16px;
        font-weight: 400;
        color: #ffffff;
        font-family: "Alibaba-PuHuiTi-Regular";
      }
      .el-icon-caret-bottom {
        position: absolute;
        right: -15px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 12px;
        color: #ffffff;
      }
    }
  }
}
</style>
