index.vue
2.3 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
<!--
* @Description:
* @Author: huyue
* @Date: 2024-07-24 17:47:51
* @LastEditors: huyue
* @LastEditTime: 2024-07-30 18:24:24
-->
<script lang="ts" setup>
import { inject, reactive } from 'vue'
import { useRouter } from 'vue-router';
// 获取全局对象
const global: any = inject("global");
const router = useRouter();
const userInfo = reactive({
account: '管理员'
})
const logout = () => {
router.replace({ path: '/login' })
console.log('退出登录')
}
const getImageUrl = (name: any) => {
return new URL(`./images/${name}.png`, global.$imgUrl).href;
};
</script>
<template>
<div class="navbar">
<div class="navbar-left">
<a-image class="logo" width="32" :src="getImageUrl('layout-logo')" :preview="false" />
<div class="title">广联数科控股有限公司</div>
</div>
<div class="navbar-right">
<div class="avatar">{{ userInfo.account.slice(0, 1)}}</div>
<div class="username">{{userInfo.account}}</div>
<a-popover position="br" content-class="logout-popover">
<icon-down />
<template #content>
<a-button @click="logout">退出登录</a-button>
</template>
</a-popover>
</div>
</div>
</template>
<style lang="scss" scoped>
.navbar {
display: flex;
justify-content: space-between;
width: 100%;
height: 48px;
background-color: #fff;
box-shadow: 0 0 6px 0 #EBEDF0;
z-index: 100;
&-left {
display: flex;
align-items: center;
.logo {
margin-left: 16px;
}
.title {
font-weight: 500;
font-size: 16px;
color: #000814;
line-height: 24px;
margin-left: 40px;
}
}
&-right {
display: flex;
align-items: center;
margin-right: 18px;
.avatar {
width: 28px;
height: 28px;
background-color: rgba(25, 95, 254, .08);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 14px;
color: #195FFE;
margin-right: 8px;
}
.username {
color: #6E6E7A;
font-size: 14px;
margin-right: 8px;
}
}
}
.logout-popover {
.arco-popover-content {
.arco-btn-secondary {
background-color: #EDF3FF;
color: #195FFE;
}
}
}
</style>