<template>
  <div class="nav-bar-container">
    <div class="left-panel">
      <vab-remix-icon class="logo" icon-class="logo" />
      <span class="hidden-xs-only">无症状人群胃癌筛查随访数据中心</span>
    </div>
    <div class="right-panel">
      <error-log></error-log>
      <avatar></avatar>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex"

import {
  Avatar,
  Breadcrumb,
  ErrorLog,
  FullScreenBar,
  ThemeBar,
} from "@/layouts/components"

export default {
  name: "NavBar",
  components: {
    Avatar,
    Breadcrumb,
    ErrorLog,
    FullScreenBar,
    ThemeBar,
  },
  data() {
    return {
      pulse: false,
      isDot: true,
    }
  },
  computed: {
    ...mapGetters({
      collapse: "settings/collapse",
      visitedRoutes: "tagsBar/visitedRoutes",
      device: "settings/device",
      routes: "routes/routes",
      feedBackNumber: "user/feedBackNumber",
    }),
  },
  methods: {
    handleCollapse() {
      this.$store.dispatch("settings/changeCollapse")
    },
    viewMsg() {
      this.$router.push({ name: "Message" })
    },
    async refreshRoute() {
      this.$baseEventBus.$emit("reloadRouterView")
      this.pulse = true
      setTimeout(() => {
        this.pulse = false
      }, 1000)
    },
  },
}
</script>

<style lang="scss" scoped>
.nav-bar-container {
  position: relative;
  height: 74px;
  overflow: hidden;
  user-select: none;
  background: #4e68ff;
  box-shadow: $base-box-shadow;
  display: flex;
  justify-content: space-between;
  color: #fff;
  .left-panel {
    display: flex;
    align-items: center;
    justify-items: center;
    font-size: 24px;
    font-weight: 600;
    height: 74px;
    max-height: 74px;
    letter-spacing: 2px;

    .logo {
      margin-right: 20px;
      margin-left: 40px;
      font-size: 40px;
      vertical-align: middle;
    }
    .fold-unfold {
      margin-left: 10px;
      font-size: 20px;
      color: $base-color-gray;
      cursor: pointer;
    }

    ::v-deep {
      .breadcrumb-container {
        margin-left: 10px;
      }
    }
  }

  .right-panel {
    display: flex;
    align-content: center;
    align-items: center;
    justify-content: flex-end;
    height: 74px;

    ::v-deep {
      .user-avatar {
        margin-top: 2px;
        margin-right: 5px;
        font-weight: 600;
        cursor: pointer;
      }

      .user-name {
        position: relative;
        margin-right: 35px;
        margin-left: 5px;
        font-weight: 600;
        cursor: pointer;
      }

      .user-name + i {
        position: absolute;
        top: 4px;
        right: 15px;
      }

      svg {
        width: 1em;
        height: 1em;
        margin-right: 20px;
        font-size: $base-font-size-big;
        color: $base-color-gray;
        cursor: pointer;
        fill: $base-color-gray;
      }

      button {
        svg {
          margin-right: 0;
          color: $base-color-white;
          cursor: pointer;
          fill: $base-color-white;
        }
      }

      .el-badge {
        margin-right: 20px;
        padding: 0 5px;
        svg {
          margin-right: 0px;
        }
      }
    }
  }
}
</style>
