You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.2 KiB

4 years ago
<template>
<div class="header">
4 years ago
<div v-if="this.$route.path=='/setting/person'" class="goBack" @click="back"><i class="el-icon-arrow-left"></i>返回</div>
4 years ago
<template v-else>
<div>
<img class="logo" :src="logoUrl" />
<span class="title">{{title}}</span>
</div>
4 years ago
</template>
<div class="header-right">
<div class="header-user-con">
<div class="user" @click="toPersonal">
<el-avatar :size="40" :src="avatar"></el-avatar>
4 years ago
<span class="user-avator">{{ userName }}</span>
4 years ago
</div>
<el-divider class="ml20" direction="vertical"></el-divider>
<el-button type="text" class="ml20" @click="logout">退出</el-button>
</div>
</div>
</div>
</template>
<script>
4 years ago
import { mapState, mapActions } from "vuex";
4 years ago
export default {
data() {
return {
4 years ago
};
},
computed: {
4 years ago
...mapState("user", [
"title", "logoUrl", "avatar", "userName"
4 years ago
])
4 years ago
},
4 years ago
mounted() {
this.getSystemDetail();
this.getUserInfo();
4 years ago
},
methods: {
4 years ago
...mapActions("user", [
"logout", "setTitle", "setLogoUrl", "setAvatar", "setUserName"
4 years ago
]),
getSystemDetail () {
this.$get(this.api.logoDetail).then(res => {
if (res.data) {
this.setTitle(res.data.title);
this.setLogoUrl(res.data.logoUrl);
}
}).catch(res => {});
},
getUserInfo() {
this.$get(this.api.queryUserInfoDetails).then(res => {
let {userAvatars, userName} = res.result.hrUserInfo;
userAvatars && this.setAvatar(userAvatars);
this.setUserName(userName);
}).catch(err => {})
},
4 years ago
toPersonal() {
this.$router.push("/setting/person");
4 years ago
},
4 years ago
back() {
this.$router.go(-1);
4 years ago
}
4 years ago
}
4 years ago
};
</script>
<style scoped lang="scss">
4 years ago
.goBack {
4 years ago
cursor: pointer;
line-height: 60px;
height: 60px;
font-size: 16px;
font-weight: bold;
margin-left: 20px;
}
4 years ago
.goBack i {
4 years ago
color: #9278ff;
font-size: 20px;
}
4 years ago
4 years ago
.header {
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
width: 100%;
height: 60px;
font-size: 16px;
color: #333;
.logo {
height: 50px;
margin: 0 20px;
}
.title {
font-size: 18px;
font-weight: bold;
4 years ago
}
}
4 years ago
4 years ago
.header-right {
padding-right: 50px;
}
4 years ago
4 years ago
.header-user-con {
display: flex;
align-items: center;
4 years ago
.user {
4 years ago
display: inline-flex;
align-items: center;
cursor: pointer;
}
}
4 years ago
4 years ago
.user-avator {
margin-left: 10px;
font-size: 12px;
4 years ago
}
4 years ago
.ml20 {
4 years ago
margin-left: 20px;
}
4 years ago
4 years ago
.user-avator img {
display: block;
width: 40px;
height: 40px;
border-radius: 50%;
}
4 years ago
.header-right .el-button--text {
4 years ago
color: #333;
}
4 years ago
.header-right .el-divider--vertical {
4 years ago
width: 2px;
height: 15px;
}
4 years ago
.header-right .el-divider {
4 years ago
background-color: #333;
}
</style>