Navbar.vue 3.89 KB
<template>
  <div class="navbar-con">
    <div class="navbar">
      <div class="title">{{ dicData['sysCode'] && dicData['sysCode'][0].DNAME }}</div>
      <div class="user">欢迎进入系统 {{ name }} <svg-icon icon-class='close' class="closeStyle" @click="onCancel" />退出系统</div>
      <div class="sidebarLeft">
        <sidebarLeft />
      </div>
      <div class="sidebarRight d-center">
        <sidebarRight />
      </div>
    </div>
  </div>
</template>
<script>
import sidebarLeft from './Sidebar/sidebarLeft'
import sidebarRight from './Sidebar/sidebarRight'
import { mapGetters } from 'vuex'
export default {
  components: {
    sidebarLeft,
    sidebarRight
  },
  computed: {
    ...mapGetters(['sidebar', 'dicData', 'name'])
  },
  methods: {
    onCancel () {
    }
  }
}
</script>
<style lang="scss" scoped>
/deep/.el-menu--horizontal {
  display: flex;
  align-items: center;
}

.menubg {
  height: 34px;
  width: 130px;
  text-align: center;
  color: #FFFFFF;
  margin-right: 20px;
  background: url('~@/image/navbar.png') no-repeat;
  background-size: 100% 100%;
}

/deep/.el-menu-item {
  @extend .menubg;
}

/deep/.el-submenu {
  @extend .menubg;
}

/deep/.el-submenu__title {
  height: 34px;
  color: #FFFFFF;
}

/deep/.el-submenu__title span {
  font-size: 14px;
}

.sidebarLeft {
  position: relative;
  top: 13px;
  left: 10px;
}

.sidebarRight {
  position: relative;
  left: 10px;
  top: 13px;
}

// 导航选中背景色
.xuanzhong {
  background: url('~@/image/selNavbar.png') no-repeat;
  background-size: 100% 100%;
  color: #09C39A !important;
}

/deep/.el-menu-item:hover {
  @extend .xuanzhong;
}

/deep/.el-submenu__title:hover {
  @extend .xuanzhong;
}

/deep/.el-menu--horizontal .el-menu-item:not(.is-disabled):focus {
  @extend .xuanzhong;
}

/deep/.el-menu-item.is-active {
  @extend .xuanzhong;
}


.navbar {
  height: $headerHeight;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 20px;
  justify-content: space-between;
  background: url('~@/image/header.png') no-repeat;
  background-size: 100% 100%;

  .user {
    font-size: 12px;
    color: #FFFFFF;
    position: absolute;
    right: 20px;
    top: 0;
    cursor: pointer;

    .closeStyle {
      margin-right: 5px;
    }
  }

  .title {
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 0;
    right: 0;
    margin: 0 auto;
    font-size: 32px;
    color: #FFFFFF;
    font-weight: 700;
    text-align: center;

  }

  .right-menu {
    float: right;
    height: 100%;
    line-height: 50px;
    display: flex;
    align-items: center;

    .shutdown {
      font-size: 20px;
      margin-left: 15px;
      cursor: pointer;
    }

    .organization-item {
      margin-right: 40px;
      margin-top: -40px !important;
    }

    .item {
      margin-right: 40px;
      margin-top: -20px;
      line-height: 18.4px;
      cursor: pointer;
      position: relative;

      .item-box {
        position: absolute;
        top: -5px;
        left: 3px;
        width: 100%;
        min-width: 25px;
        height: 25px;
        cursor: pointer;
        z-index: 100;
      }
    }

    &:focus {
      outline: none;
    }

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

      &.hover-effect {
        cursor: pointer;
        transition: background 0.3s;
        display: flex;
        align-items: center;

        &:hover {
          background: rgba(0, 0, 0, 0.025);
        }
      }
    }

    .avatar-wrapper {
      position: relative;
      display: flex;
      height: 40px;
      align-items: center;

      .user-avatar {
        cursor: pointer;
        width: 35px;
        height: 35px;
        border-radius: 50%;
      }

      .el-icon-caret-bottom {
        cursor: pointer;
        position: absolute;
        right: -15px;
        top: 17px;
        font-size: 12px;
      }
    }
  }
}
</style>