index.vue
2.65 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
<template>
<div class="other-portals">
<ul
class="portals"
:class="[layout === 'vertical' ? 'is-horizontal' : 'is-vertical']"
:style="{ '--topPortalColor': variables[`${style}-portal-color`] }"
>
<li
v-for="(item, index) in otherPortalList"
:key="index"
class="portals-item"
:class="{ 'is-active': index === currentIndex }"
@click="handleOtherPortal(index)"
>
<ht-icon :name="item.iconName" class="ht-icon"></ht-icon>
<span class="other-portal-name">
{{ item.name }}
</span>
</li>
</ul>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import variables from '@/styles/variables.scss'
export default {
name: 'HtOtherPortals',
data() {
return {
otherPortalList: [
{
name: '门户',
iconName: 'home',
},
{
name: '财务系统',
iconName: 'matterCenter',
},
{
name: '人事系统',
iconName: 'user',
},
],
currentIndex: null,
}
},
computed: {
...mapGetters({
layout: 'settings/layout',
style: 'settings/style',
}),
variables() {
return variables
},
},
methods: {
handleOtherPortal(index) {
this.currentIndex = index
},
},
}
</script>
<style lang="scss" scoped>
@mixin portal-hover-or-active {
color: var(--themeColor);
}
.other-portals {
.portals {
list-style: none;
font-size: $base-font-size-big;
.portals-item {
cursor: pointer;
color: var(--topPortalColor);
&:hover {
@include portal-hover-or-active;
}
.other-portal-name {
white-space: nowrap;
}
}
.is-active {
@include portal-hover-or-active;
}
}
.is-vertical {
display: flex;
flex-direction: column;
.portals-item {
padding: 0 16px 48px 10px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
&:first-child {
padding-top: 27px;
}
.ht-icon {
padding-right: 14px;
vertical-align: -0.1em;
}
}
}
.is-horizontal {
display: flex;
flex-direction: row;
padding-left: 43px;
height: $base-top-bar-height;
line-height: $base-top-bar-height;
.portals-item {
padding-right: 46px;
.ht-icon {
width: 18px;
height: 18px;
padding-right: 10px;
vertical-align: -0.1em;
}
}
}
}
</style>