Header.vue
2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<template>
<header>
<div class="slogin">
举旗帜聚民心、防风险保安全、强治理惠民生、 增动能促发展、谋合作图共赢
</div>
<div class="title">内部系统</div>
<div class="user">
<div class="head">
<el-image :src="avatar" fit="cover"></el-image>
</div>
<el-dropdown @command="handleCommand">
<div class="info">
{{ userInfo.userName }}({{ userInfo.organizeName }})
</div>
<el-dropdown-menu slot="dropdown" router>
<el-dropdown-item>修改信息</el-dropdown-item>
<passwordForm>
<el-dropdown-item>修改密码</el-dropdown-item>
</passwordForm>
<el-dropdown-item command="logout">退出系统</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</header>
</template>
<script>
export default {
name: "Header",
data() {
return {
userInfo: this.$store.state.user.userInfo,
avatar: this.$store.state.user.avatar,
};
},
mounted() {},
methods: {
async logout() {
await this.$store.dispatch("LogOut");
this.$router.push({ path: "/login" });
},
handleCommand(command) {
switch (command) {
case "logout":
this.$confirm("确定退出登录?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.logout();
})
.catch(() => {});
break;
default:
break;
}
},
},
};
</script>
<style scoped lang="scss">
header {
width: 100%;
color: rgba(255, 255, 255, 1);
position: relative;
.slogin {
position: absolute;
left: 28px;
top: 21px;
width: 600px;
text-align: right;
font-size: 28px;
font-family: Roboto;
font-weight: 400;
line-height: 39px;
}
.title {
text-align: center;
width: 100%;
padding-top: 5px;
font-size: 40px;
font-weight: 700;
line-height: 56px;
}
.user {
position: absolute;
right: 33px;
top: 25px;
display: flex;
align-items: center;
flex-direction: row;
.head {
width: 50px;
height: 50px;
margin-right: 13px;
.el-image {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.info {
color: #fff;
cursor: pointer;
}
}
}
</style>