提交 | 用户 | 时间
|
a57dc2
|
1 |
<template> |
W |
2 |
<div class="navbar"> |
|
3 |
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> |
|
4 |
|
|
5 |
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/> |
|
6 |
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/> |
|
7 |
|
|
8 |
<div class="right-menu"> |
44f5fa
|
9 |
|
a57dc2
|
10 |
|
W |
11 |
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> |
|
12 |
<div class="avatar-wrapper"> |
|
13 |
<img :src="avatar" class="user-avatar"> |
|
14 |
<i class="el-icon-caret-bottom" /> |
|
15 |
</div> |
|
16 |
<el-dropdown-menu slot="dropdown"> |
|
17 |
<router-link to="/user/profile"> |
|
18 |
<el-dropdown-item>个人中心</el-dropdown-item> |
|
19 |
</router-link> |
44f5fa
|
20 |
<!-- <el-dropdown-item @click.native="setting = true"> |
a57dc2
|
21 |
<span>布局设置</span> |
44f5fa
|
22 |
</el-dropdown-item> --> |
a57dc2
|
23 |
<el-dropdown-item divided @click.native="logout"> |
W |
24 |
<span>退出登录</span> |
|
25 |
</el-dropdown-item> |
|
26 |
</el-dropdown-menu> |
|
27 |
</el-dropdown> |
|
28 |
</div> |
|
29 |
</div> |
|
30 |
</template> |
|
31 |
|
|
32 |
<script> |
|
33 |
import { mapGetters } from 'vuex' |
|
34 |
import Breadcrumb from '@/components/Breadcrumb' |
|
35 |
import TopNav from '@/components/TopNav' |
|
36 |
import Hamburger from '@/components/Hamburger' |
|
37 |
import Screenfull from '@/components/Screenfull' |
44f5fa
|
38 |
// import SizeSelect from '@/components/SizeSelect' |
a57dc2
|
39 |
import Search from '@/components/HeaderSearch' |
44f5fa
|
40 |
|
a57dc2
|
41 |
|
W |
42 |
export default { |
|
43 |
components: { |
|
44 |
Breadcrumb, |
|
45 |
TopNav, |
|
46 |
Hamburger, |
|
47 |
Screenfull, |
44f5fa
|
48 |
// SizeSelect, |
a57dc2
|
49 |
Search, |
W |
50 |
}, |
|
51 |
computed: { |
|
52 |
...mapGetters([ |
|
53 |
'sidebar', |
|
54 |
'avatar', |
|
55 |
'device' |
|
56 |
]), |
|
57 |
setting: { |
|
58 |
get() { |
|
59 |
return this.$store.state.settings.showSettings |
|
60 |
}, |
|
61 |
set(val) { |
|
62 |
this.$store.dispatch('settings/changeSetting', { |
|
63 |
key: 'showSettings', |
|
64 |
value: val |
|
65 |
}) |
|
66 |
} |
|
67 |
}, |
|
68 |
topNav: { |
|
69 |
get() { |
|
70 |
return this.$store.state.settings.topNav |
|
71 |
} |
|
72 |
} |
|
73 |
}, |
|
74 |
methods: { |
|
75 |
toggleSideBar() { |
|
76 |
this.$store.dispatch('app/toggleSideBar') |
|
77 |
}, |
|
78 |
async logout() { |
|
79 |
this.$confirm('确定注销并退出系统吗?', '提示', { |
|
80 |
confirmButtonText: '确定', |
|
81 |
cancelButtonText: '取消', |
|
82 |
type: 'warning' |
|
83 |
}).then(() => { |
|
84 |
this.$store.dispatch('LogOut').then(() => { |
|
85 |
location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; |
|
86 |
}) |
|
87 |
}).catch(() => {}); |
|
88 |
} |
|
89 |
} |
|
90 |
} |
|
91 |
</script> |
|
92 |
|
|
93 |
<style lang="scss" scoped> |
|
94 |
.navbar { |
|
95 |
height: 50px; |
|
96 |
overflow: hidden; |
|
97 |
position: relative; |
|
98 |
background: #fff; |
|
99 |
box-shadow: 0 1px 4px rgba(0,21,41,.08); |
|
100 |
|
|
101 |
.hamburger-container { |
|
102 |
line-height: 46px; |
|
103 |
height: 100%; |
|
104 |
float: left; |
|
105 |
cursor: pointer; |
|
106 |
transition: background .3s; |
|
107 |
-webkit-tap-highlight-color:transparent; |
|
108 |
|
|
109 |
&:hover { |
|
110 |
background: rgba(0, 0, 0, .025) |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
.breadcrumb-container { |
|
115 |
float: left; |
|
116 |
} |
|
117 |
|
|
118 |
.topmenu-container { |
|
119 |
position: absolute; |
|
120 |
left: 50px; |
|
121 |
} |
|
122 |
|
|
123 |
.errLog-container { |
|
124 |
display: inline-block; |
|
125 |
vertical-align: top; |
|
126 |
} |
|
127 |
|
|
128 |
.right-menu { |
|
129 |
float: right; |
|
130 |
height: 100%; |
|
131 |
line-height: 50px; |
|
132 |
|
|
133 |
&:focus { |
|
134 |
outline: none; |
|
135 |
} |
|
136 |
|
|
137 |
.right-menu-item { |
|
138 |
display: inline-block; |
|
139 |
padding: 0 8px; |
|
140 |
height: 100%; |
|
141 |
font-size: 18px; |
|
142 |
color: #5a5e66; |
|
143 |
vertical-align: text-bottom; |
|
144 |
|
|
145 |
&.hover-effect { |
|
146 |
cursor: pointer; |
|
147 |
transition: background .3s; |
|
148 |
|
|
149 |
&:hover { |
|
150 |
background: rgba(0, 0, 0, .025) |
|
151 |
} |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
.avatar-container { |
|
156 |
margin-right: 30px; |
|
157 |
|
|
158 |
.avatar-wrapper { |
|
159 |
margin-top: 5px; |
|
160 |
position: relative; |
|
161 |
|
|
162 |
.user-avatar { |
|
163 |
cursor: pointer; |
|
164 |
width: 40px; |
|
165 |
height: 40px; |
|
166 |
border-radius: 10px; |
|
167 |
} |
|
168 |
|
|
169 |
.el-icon-caret-bottom { |
|
170 |
cursor: pointer; |
|
171 |
position: absolute; |
|
172 |
right: -20px; |
|
173 |
top: 25px; |
|
174 |
font-size: 12px; |
|
175 |
} |
|
176 |
} |
|
177 |
} |
|
178 |
} |
|
179 |
} |
|
180 |
</style> |