<template>
|
<div class="navbar">
|
<!-- <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> -->
|
|
<!-- <breadcrumb class="breadcrumb-container" /> -->
|
|
<div class="right-menu">
|
<div class="right-serves">
|
<i class="el-icon-setting" />
|
<i class="el-icon-bell" />
|
<i class="el-icon-time" />
|
</div>
|
<el-dropdown class="avatar-container" trigger="click">
|
<div class="avatar-wrapper">
|
<a class="user-avatar">{{ user.name.slice(0,1) }}</a>
|
</div>
|
<el-dropdown-menu slot="dropdown" class="user-dropdown">
|
<router-link to="/">
|
<el-dropdown-item>
|
修改密码
|
</el-dropdown-item>
|
</router-link>
|
<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 Breadcrumb from '@/components/Breadcrumb'
|
// import Hamburger from '@/components/Hamburger'
|
import {
|
get,
|
post,
|
wpost,
|
postFile
|
} from "@/api/util/requestUtil.js"
|
|
export default {
|
components: {
|
// Breadcrumb,
|
// Hamburger
|
},
|
computed: {
|
...mapGetters([
|
'sidebar',
|
'avatar'
|
])
|
},
|
data() {
|
return {
|
user: {
|
id: null,
|
name: 'value'
|
}
|
}
|
},
|
mounted() {
|
this.getUser()
|
},
|
methods: {
|
toggleSideBar() {
|
this.$store.dispatch('app/toggleSideBar')
|
},
|
async logout() {
|
// await this.$store.dispatch('user/logout')
|
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
},
|
getUser(){
|
get(this.$url.info).then(res=>{
|
this.user = res.data
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.navbar {
|
height: 50px;
|
overflow: hidden;
|
position: relative;
|
background: #fff;
|
display: flex;
|
border-bottom: 1px solid #f0f2f5;
|
// box-shadow: 0 0 0.857143rem rgba(0, 0, 0, 0.12);
|
// box-shadow: 0 1px 4px rgba(0,21,41,.08);
|
|
.hamburger-container {
|
line-height: 46px;
|
height: 100%;
|
cursor: pointer;
|
transition: background .3s;
|
-webkit-tap-highlight-color:transparent;
|
|
&:hover {
|
background: rgba(0, 0, 0, .025)
|
}
|
}
|
|
.breadcrumb-container {
|
float: left;
|
}
|
|
.right-menu {
|
flex: 1;
|
height: 100%;
|
line-height: 50px;
|
display: flex;
|
justify-content: right;
|
.right-serves{
|
height: 100%;
|
display: flex;
|
align-items: center;
|
>i{
|
display: inline-block;
|
margin: auto 10px;
|
font-size: 20px;
|
line-height: 100%;
|
}
|
}
|
|
&: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 .3s;
|
|
&:hover {
|
background: rgba(0, 0, 0, .025)
|
}
|
}
|
}
|
|
.avatar-container {
|
margin-right: 24px;
|
height: 100%;
|
.avatar-wrapper {
|
// margin-top: 5px;
|
width: 40px;
|
height: 100%;
|
position: relative;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
.user-avatar {
|
cursor: pointer;
|
width: 30px;
|
height: 30px;
|
font-size: 10px;
|
border-radius: 50%;
|
// margin-right: 12px;
|
background: #0077DB;
|
line-height: 31px;
|
text-align: center;
|
color: #fff;
|
}
|
|
.el-icon-caret-bottom {
|
cursor: pointer;
|
position: absolute;
|
right: -20px;
|
top: 25px;
|
font-size: 12px;
|
}
|
}
|
}
|
}
|
}
|
</style>
|