|
1
2
|
<template>
<div class="navbar">
|
|
3
4
5
6
7
|
<hamburger
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
|
|
8
9
10
11
|
<breadcrumb class="breadcrumb-container" />
<div class="right-menu">
|
|
12
13
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
|
14
|
<!-- <el-dropdown
|
|
15
16
17
18
|
class="avatar-container"
trigger="click"
style="margin: 0 5px"
>
|
|
19
20
21
22
23
24
25
|
<div class="avatar-wrapper">
<span class="lang">
<svg-icon icon-class="language" />
</span>
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
<router-link to="/">
|
|
26
27
28
29
30
31
|
<el-dropdown-item @click.native="onChange('zh')">
中文
</el-dropdown-item>
<el-dropdown-item @click.native="onChange('en')">
英文
</el-dropdown-item>
|
|
32
33
|
</router-link>
</el-dropdown-menu>
|
|
34
|
</el-dropdown> -->
|
|
35
|
<el-divider direction="vertical"></el-divider>
|
|
36
|
|
|
37
38
|
<el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper">
|
|
39
|
<span style="margin-right: 10px; cursor: pointer">{{ name }}</span>
|
|
40
41
|
<!-- <img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar"> -->
<!-- <div icon="el-icon-user-solid" class="user-avatar"></div> -->
|
|
42
|
<i class="el-icon-user-solid user-avatar" />
|
|
43
|
<i class="el-icon-caret-bottom" />
|
|
44
45
|
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
|
|
46
|
<router-link to="/system/index/system">
|
|
47
|
<el-dropdown-item>{{ $t("system.authorize") }}</el-dropdown-item>
|
|
48
|
</router-link>
|
|
49
|
<el-dropdown-item divided @click.native="logout">
|
|
50
|
<span style="display: block">{{ $t("system.logOut") }}</span>
|
|
51
52
53
54
55
56
57
58
|
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</template>
<script>
|
|
59
60
61
62
|
import Breadcrumb from "@/components/Breadcrumb";
import Hamburger from "@/components/Hamburger";
import Screenfull from "@/components/Screenfull";
import { mapGetters } from "vuex";
|
|
63
64
65
66
|
export default {
components: {
Breadcrumb,
|
|
67
|
Hamburger,
|
|
68
|
Screenfull,
|
|
69
70
|
},
data() {
|
|
71
|
return {};
|
|
72
73
|
},
computed: {
|
|
74
75
76
|
...mapGetters(["sidebar", "avatar", "name"]),
},
|
|
77
78
|
methods: {
toggleSideBar() {
|
|
79
|
this.$store.dispatch("app/toggleSideBar");
|
|
80
81
|
},
async logout() {
|
|
82
83
84
|
await this.$store.dispatch("user/logout");
this.$router.push(`/login?redirect=${this.$route.fullPath}`);
},
|
|
85
86
87
88
|
onChange(data) {
localStorage.setItem("lang", data);
this.$i18n.locale = data;
},
|
|
89
90
|
},
};
|
|
91
92
93
94
95
96
97
98
|
</script>
<style lang="scss" scoped>
.navbar {
height: 50px;
overflow: hidden;
position: relative;
background: #fff;
|
|
99
|
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
|
100
101
102
103
104
105
|
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
|
|
106
107
|
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
|
|
108
109
|
&:hover {
|
|
110
|
background: rgba(0, 0, 0, 0.025);
|
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
}
}
.breadcrumb-container {
float: left;
}
.right-menu {
float: right;
height: 100%;
line-height: 50px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
|
|
133
|
// vertical-align: text-bottom;
|
|
134
135
136
|
&.hover-effect {
cursor: pointer;
|
|
137
|
transition: background 0.3s;
|
|
138
139
|
&:hover {
|
|
140
|
background: rgba(0, 0, 0, 0.025);
|
|
141
142
143
144
145
146
147
148
|
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
|
|
149
|
// margin-top: 5px;
|
|
150
|
position: relative;
|
|
151
|
// display: flex;
|
|
152
153
154
|
align-items: center;
font-size: 14pt;
font-weight: bold;
|
|
155
156
|
span.lang {
display: block;
|
|
157
158
159
|
height: 100%;
padding: 0 10px;
}
|
|
160
161
162
|
span.lang:hover {
cursor: pointer;
background: #f9f9f9;
|
|
163
|
}
|
|
164
165
|
.user-avatar {
cursor: pointer;
|
|
166
167
|
// width: 40px;
// height: 40px;
|
|
168
169
170
171
172
173
174
|
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
|
|
175
|
top: 22px;
|
|
176
177
178
179
180
181
182
|
font-size: 12px;
}
}
}
}
}
</style>
|