<template>
  <div class="navbar">
    <div class="left-title">重卡运维监控系统</div>
    <div class="right-menu">
      <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
        <div class="avatar-wrapper">
          <span class="el-dropdown">{{ name }}<i class="el-icon-arrow-down el-icon--right"></i></span>
        </div>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item divided @click.native="logout">
            <span style="display: block">安全退出</span>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

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

  methods: {
    //退出登录
    async logout() {
      await this.$store.dispatch("user/logout");
      this.$router.push(`/login?redirect=${this.$route.fullPath}`);
    },
  },
};
</script>

<style lang="scss" scoped>
.el-submenu__icon-arrow{
  right: -18px;
  top:40%;
  font-size: 16px;
  font-weight: bold;
  transform: rotate(180deg);
}
.navbar {
  height: 60px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: row;
  color: white;
  padding-top: 15px;
  box-sizing: border-box;
  justify-content: space-between;
  .left-title {
    font-size: 26px;
    text-align: center;
    font-weight: bold;
    line-height: 30px;
    padding-left: 20px;
    margin-right: 35px;
  }
  .left-menu {
    flex: 1;
    height: 100%;
    line-height: 36px;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    .iconacive{
      display: none;
    }
    div{
      margin-right: 35px;
    }
    .routerlink{
      position: relative;
    }
    .router-link-active{
      color: #91fdb9;
      position: relative;
      text-shadow: 0px 0px 8px rgba(34,123,255,0.8);
      .iconacive{
        display: inline;
      }
      svg:first-child{
        display: none;
      }
      .el-submenu__icon-arrow{
        right: -20px !important;
        position: absolute;
        transform: rotate(360deg);
        color: #91fdb9;
        top:40%
      }
    }
    
    span{
      font-size: 20px;
      font-weight: 600;
      padding-left: 6px;
    }
    .router-link-active::after{
      content: '';
      display: inline-block;
      width: 0;
      height: 0;
      border: 6px solid transparent;
      border-top: 6px solid #91fdb9;
      position: absolute;
      top: 21px;
      left: 54%;
      z-index: 0;
      }
  }
  .safedays{
    font-size: 18px;
    font-weight: 600;
    line-height: 40px;
    text-align: right;
    padding-right: 1rem;
  }
  .date-time {
    width: 32%;
    color: white;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.8rem;
    
    .warn{
      width: 92px;
      display: flex;
      font-size: 16px;
      justify-content: space-between;
      align-items: center;
      justify-items: center;
      padding-right: 24px;
      box-sizing: content-box;
      line-height: 24px;
      cursor: pointer;
      height: 39px;
    }
    .link{
      width: auto;
      justify-content:flex-start;
      img{
       margin-right: 3px;
       vertical-align: middle;
      }
    }
  .day-value {
    font-size: 14px;
    line-height: 1.2rem;
    font-family: "微软雅黑";
  }
  .time-value {
    font-size: 1.7rem;
    padding-right: 1rem;
    width: 125px;
  }
  .week-value {
    font-size: 0.5rem;
  }
  }
  .right-menu {
    height: 100%;
    line-height: 34px;
    .el-dropdown{
      font-size: 16px;
      font-weight: 400;
      color: #FFFFFF;
      text-shadow: 0px 0px 11px rgba(34,123,255,0.8);
      .el-icon-arrow-down:before{
        bottom: -4px;
      }
    }
    &:focus {
      outline: none;
    }

    .right-menu-item {
      display: inline-block;
      padding: 0 8px;
      height: 100%;
      font-size: 18px;
      color: #5a5e66;
      vertical-align: text-bottom;

      &.hover-effect {
        cursor: pointer;
        transition: background 0.3s;
        &:hover {
          background: rgba(0, 0, 0, 0.025);
        }
      }
    }
  }
  .dobusiness{
    margin: 0 5px;
    .el-dropdown{
      font-size: 18px;
      text-shadow: 0px 0px 11px rgba(34,123,255,0.8);
      font-weight: 400;
      color: #9D9FA4;
      line-height: 38px;
      cursor: pointer;
    }
  }
  .setFile{
    padding-right: 20px;
    padding-top: 4px;
  }
  .el-icon-arrow-down:before{
    content: "";
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-top: 6px solid white;
    position: relative;
    bottom: -2px;
    display: inline-block;
  }
  .cutApart{
    width: 1px;
    height: 32px;
    background: #54616D;
    opacity: 1;
    margin: 0 5px;
  }
}
</style>
