Navbar.vue
2.19 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>
<div class="navbar-con">
<div class="navbar">
<div class="logo">
<img :src="require('@/image/bdclogo.png')" alt="" />
<h4>不动产登记上报系统</h4>
</div>
<div class="right-menu">
<div class="user">
{{ userName }}
<span @click="onCancel">
<i class="el-icon-switch-button"></i>
</span>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from './Breadcrumb'
import { logout } from "@/api/login.js";
export default {
components: {
Breadcrumb
},
computed: {
...mapGetters(["sidebar", "dicData", "userInfo"]),
userName () {
return this.userInfo ? this.userInfo.name : ""
}
},
methods: {
handleDataView () {
const { href } = this.$router.resolve('/dataView');
window.open(href, '_blank');
},
themeChange (val) {
this.$store.dispatch('app/updateTheme', val)
},
onCancel () {
logout()
.then((res) => {
sessionStorage.removeItem("token");
this.$store.dispatch("user/resetState");
this.$store.dispatch("permission/resetRoutes");
this.$router.replace({
path: "/sb",
query: {
redirect: this.$route.fullPath,
},
});
})
.catch((error) => {
// console.dir(error);
})
}
}
}
</script>
<style lang="scss" scoped>
@import "~@/styles/_handle.scss";
.navbar-con {
position: relative;
.logo {
color: #fff;
font-size: 26px;
font-weight: 700;
display: flex;
margin-left: 15px;
img {
width: 47px;
height: 47px;
}
h4 {
margin-left: 20px;
height: 50px;
line-height: 50px;
}
}
}
.navbar {
height: $headerHeight;
overflow: hidden;
position: relative;
@include background("navbg");
display: flex;
align-items: center;
padding-right: 20px;
justify-content: space-between;
.header-logo {
width: 300px;
}
.right-menu-item {
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
display: flex;
align-items: center;
}
}
}
</style>