|
|
|
<template>
|
|
|
|
<div class="header flex-between">
|
|
|
|
<div class="logo">
|
|
|
|
<img class="cursor" @click="goHome" src="../assets/img/logo.png">
|
|
|
|
</div>
|
|
|
|
<div class="header-right">
|
|
|
|
<div class="header-user-con">
|
|
|
|
<div class="user" @click="toPerson">
|
|
|
|
<el-avatar :size="40" :src="$store.state.avatar"></el-avatar>
|
|
|
|
<span class="user-avator">{{userName}}</span>
|
|
|
|
</div>
|
|
|
|
<el-divider class="ml20" direction="vertical"></el-divider>
|
|
|
|
<el-button type="text" class="ml20" @click="loginout">退出</el-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
userName: ''
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted(){
|
|
|
|
this.userName || this.getUserInfo()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getUserInfo(){
|
|
|
|
this.$get(this.api.queryUserInfoDetails).then(res => {
|
|
|
|
let userInfo = res.result.hrUserInfo
|
|
|
|
if(userInfo.userAvatars) this.$store.commit('userAvatar',{avatar: userInfo.userAvatars})
|
|
|
|
this.userName = userInfo.userName
|
|
|
|
}).catch(err => {})
|
|
|
|
},
|
|
|
|
toPerson(){
|
|
|
|
if(this.$route.path.split('/').pop()!=='person'){
|
|
|
|
this.$router.push('/person')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
loginout() {
|
|
|
|
localStorage.removeItem('ms_username');
|
|
|
|
sessionStorage.clear()
|
|
|
|
location.reload()
|
|
|
|
},
|
|
|
|
goHome(){
|
|
|
|
this.$router.push('/customer')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
.header {
|
|
|
|
position: relative;
|
|
|
|
box-sizing: border-box;
|
|
|
|
width: 100%;
|
|
|
|
height: 60px;
|
|
|
|
font-size: 16px;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
.header .logo {
|
|
|
|
float: left;
|
|
|
|
width: 170px;
|
|
|
|
height: 40px;
|
|
|
|
margin-left: 20px;
|
|
|
|
}
|
|
|
|
.header .logo img{
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.header-right {
|
|
|
|
float: right;
|
|
|
|
padding-right: 50px;
|
|
|
|
}
|
|
|
|
.header-user-con {
|
|
|
|
display: flex;
|
|
|
|
height: 70px;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.header-user-con .user{
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.user-avator {
|
|
|
|
cursor: pointer;
|
|
|
|
margin-left: 10px;
|
|
|
|
}
|
|
|
|
.ml20{
|
|
|
|
margin-left: 20px;
|
|
|
|
}
|
|
|
|
.user-avator img {
|
|
|
|
display: block;
|
|
|
|
width: 40px;
|
|
|
|
height: 40px;
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
.header-right .el-button--text{
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
.header-right .el-divider--vertical{
|
|
|
|
width: 2px;
|
|
|
|
height: 15px;
|
|
|
|
}
|
|
|
|
.header-right .el-divider{
|
|
|
|
background-color: #333;
|
|
|
|
}
|
|
|
|
</style>
|