Navbar.vue
4.17 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<template>
<div class="navbar-con">
<div class="navbar">
<div class="sidebarLeft">
<sidebarLeft />
</div>
<div class="sidebarRight d-center">
<sidebarRight />
<div class="right-menu">
<div class="dataView pointer" @click="handleDataView">大屏展示</div>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover" @command="handleCommand">
<div class="avatar-wrapper">
<span style="padding-right:10px">{{ name }}</span>
<img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" />
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="a">个人中心</el-dropdown-item>
<el-dropdown-item command="b">退出</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</div>
</div>
</template>
<script>
import defaultSettings from '@/settings'
import sidebarLeft from './Sidebar/sidebarLeft'
import sidebarRight from './Sidebar/sidebarRight'
import { mapGetters } from 'vuex'
export default {
components: {
sidebarLeft,
sidebarRight
},
computed: {
...mapGetters(['sidebar', 'avatar', 'name'])
},
data () {
return {
title: defaultSettings.title
}
},
methods: {
handleDataView () {
const { href } = this.$router.resolve('/dataView');
window.open(href, '_blank');
},
themeChange (val) {
this.$store.dispatch('app/updateTheme', val)
},
handleCommand (command) {
if (command == 'a') {
}
}
}
}
</script>
<style lang="scss" scoped>
/deep/.el-menu--horizontal {
display: flex;
align-items: center;
}
.menubg {
line-height: 30px;
color: #FFFFFF;
margin-right: 5px;
background: linear-gradient(180deg, #0A2580 0%, #2542C9 100%);
}
/deep/.el-menu-item {
@extend .menubg;
}
/deep/.el-submenu {
@extend .menubg;
}
/deep/.el-submenu__title {
line-height: 30px !important;
height: 42px !important;
}
/deep/.el-submenu__title span {
font-size: 14px;
}
// 导航选中背景色
.xuanzhong {
background: linear-gradient(180deg, #73551D 0%, #C09C43 100%);
font-weight: 700;
color: #FFFFFF !important;
}
/deep/.el-menu-item:hover {
@extend .xuanzhong;
}
/deep/.el-submenu__title:hover {
@extend .xuanzhong;
}
/deep/.el-menu--horizontal .el-menu-item:not(.is-disabled):focus {
@extend .xuanzhong;
}
/deep/.el-menu-item.is-active {
@extend .xuanzhong;
}
.navbar {
height: $headerHeight;
overflow: hidden;
position: relative;
background: linear-gradient(180deg, #0D3DC9 0%, #3476E1 100%);
display: flex;
align-items: center;
padding: 0 20px;
justify-content: space-between;
.right-menu {
float: right;
height: 100%;
line-height: 50px;
display: flex;
align-items: center;
.shutdown {
font-size: 20px;
margin-left: 15px;
cursor: pointer;
}
.organization-item {
margin-right: 40px;
margin-top: -40px !important;
}
.item {
margin-right: 40px;
margin-top: -20px;
line-height: 18.4px;
cursor: pointer;
position: relative;
.item-box {
position: absolute;
top: -5px;
left: 3px;
width: 100%;
min-width: 25px;
height: 25px;
cursor: pointer;
z-index: 100;
}
}
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
height: 100%;
font-size: 18px;
color: #fff;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
display: flex;
align-items: center;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-wrapper {
position: relative;
display: flex;
height: 40px;
align-items: center;
.user-avatar {
cursor: pointer;
width: 35px;
height: 35px;
border-radius: 50%;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -15px;
top: 17px;
font-size: 12px;
}
}
}
}
</style>