Blame view

src/layout1/components/Navbar.vue 4.97 KB
任超 committed
1 2 3
<template>
  <div class="navbar-con">
    <div class="navbar">
任超 committed
4 5
      <div class="logo">
        <img :src="require('@/image/logo.png')" alt="" />
任超 committed
6
      </div>
任超 committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
      <div class="backdrop">
        <Breadcrumb />
      </div>
      <div class="right-menu">
        <div class="dataView d-center pointer" @click="handleDataView">大屏展示</div>
        <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover" @command="handleCommand">
          <div class="avatar-wrapper">
            <span style="padding-right:10px">{{ name }}</span>
            <img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" />
          </div>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="a">个人中心</el-dropdown-item>
            <el-dropdown-item command="b">退出</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
任超 committed
22 23 24 25 26 27
      </div>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
任超 committed
28 29
import Breadcrumb from './Breadcrumb'
import defaultSettings from '@/settings'
任超 committed
30 31
export default {
  components: {
任超 committed
32
    Breadcrumb
任超 committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
  },
  computed: {
    ...mapGetters(['sidebar', 'avatar', 'name'])
  },
  data () {
    return {
      title: defaultSettings.title
    }
  },
  methods: {
    handleDataView () {
      const { href } = this.$router.resolve('/dataView');
      window.open(href, '_blank');
    },
    themeChange (val) {
      this.$store.dispatch('app/updateTheme', val)
    },
    handleCommand (command) {
      if (command == 'a') {
任超 committed
52 53
      } else {

任超 committed
54 55 56 57 58 59
      }
    }
  }
}
</script>
<style lang="scss" scoped>
任超 committed
60 61
.navbar-con {
  position: relative;
任超 committed
62

任超 committed
63 64 65 66 67
  .logo {
    color: #fff;
    font-size: 26px;
    font-weight: 700;
  }
任超 committed
68
}
任超 committed
69

任超 committed
70 71 72 73 74 75 76
.dataView {
  color: #fff;
  width: 120px;
  height: 32px;
  background: url('../../image/dp.png');
  background-size: cover;
  margin-right: 20px;
任超 committed
77
}
任超 committed
78

任超 committed
79 80 81
.NoticeBar {
  position: absolute;
  bottom: 0;
任超 committed
82 83
}

任超 committed
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
.el-dropdown-menu {
  padding: 0 !important;
  border: 1px solid #EBEEF5;
  box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  border-radius: 4px 0 0 4px 4px;

  .el-dropdown-menu__item {
    text-align: center;
    margin-top: 0 !important;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #4A4A4A;
    width: 140px;
    height: 36px;
    line-height: 36px;
  }
任超 committed
101

任超 committed
102 103 104
  .el-dropdown-menu__item:nth-child(6) {
    border-top: 1px solid #EBEEF5;
  }
任超 committed
105

任超 committed
106 107 108 109 110
  .popper__arrow {
    top: -11px !important;
    left: 110px !important;
    transform: rotate(0deg) scale(2);
  }
任超 committed
111

任超 committed
112 113 114 115 116
  .el-dropdown-menu__item:not(.is-disabled):hover,
  .el-dropdown-menu__item:focus {
    background: #F6F7F9;
    color: #4A4A4A;
  }
任超 committed
117 118 119 120 121 122
}

.navbar {
  height: $headerHeight;
  overflow: hidden;
  position: relative;
任超 committed
123 124 125
  // background: linear-gradient(270deg, #148CEE 0%, #1870E3 100%); //默认颜色
  // box-shadow: 0 1px 0px rgba(0, 21, 41, 0.08);
  background: #0D1230;
任超 committed
126 127
  display: flex;
  align-items: center;
任超 committed
128
  padding-right: 20px;
任超 committed
129
  justify-content: space-between;
任超 committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
  margin-bottom: 10px;

  .header-logo {
    width: 300px;
  }

  .backdrop {
    flex: 1;
    width: 60%;
    background-size: 100% 100%;
    height: $headerHeight;
    display: flex;
    align-items: center;
  }

  .hamburger-container {
    line-height: 43px;
    height: 100%;
    float: left;
    cursor: pointer;
    transition: background 0.3s;
    -webkit-tap-highlight-color: transparent;

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

  .breadcrumb-container {
    float: left;
  }
任超 committed
161 162 163 164 165 166 167 168

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

任超 committed
169 170 171 172 173
    .function {
      margin: 0 15px;
      cursor: pointer;
    }

任超 committed
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
    .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>