@lambo-design/pro-layout 1.0.0-beta.21 → 1.0.0-beta.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/components/pro-layout-header.vue +222 -1
- package/src/components/pro-layout-logo.vue +84 -12
- package/src/components/pro-layout-nav.vue +117 -74
- package/src/components/pro-layout-other-menu.vue +137 -0
- package/src/components/pro-layout-sider-collapsed-menu.vue +4 -3
- package/src/components/pro-layout-sider-menu-item.vue +54 -6
- package/src/components/pro-layout-sider-search.vue +271 -0
- package/src/components/pro-layout-sider.vue +122 -25
- package/src/components/pro-layout-tools-user.vue +203 -41
- package/src/components/pro-layout-trigger.vue +1 -1
- package/src/index.vue +72 -12
- package/src/styles/images/inspur.png +0 -0
- package/src/styles/other-menu.less +168 -0
- package/src/utils/menuItem.js +6 -0
- /package/src/styles/images/{logo.png → tobacco.png} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/pro-layout",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.211",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"access": "public",
|
|
10
10
|
"registry": "https://registry.npmjs.org/"
|
|
11
11
|
},
|
|
12
|
-
"
|
|
13
|
-
"@lambo-design/
|
|
14
|
-
"@lambo-design/
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@lambo-design/shared": "^1.0.0-beta.115",
|
|
14
|
+
"@lambo-design/core": "^4.7.1-beta.118"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {}
|
|
17
17
|
}
|
|
@@ -20,13 +20,234 @@ import LamboProTrigger from './pro-layout-trigger'
|
|
|
20
20
|
import LamboProLogo from './pro-layout-logo'
|
|
21
21
|
import LamboProNav from './pro-layout-nav'
|
|
22
22
|
import LamboProTools from './pro-layout-tools'
|
|
23
|
+
import Bus from "@lambo-design/shared/utils/bus";
|
|
24
|
+
import {deepCopy} from "@lambo-design/shared/utils/assist";
|
|
25
|
+
import generatorMenuList from "@lambo-design/shared/utils/menu";
|
|
26
|
+
import {filterMenuName, filterMenuUri, tagExists} from "@lambo-design/shared/utils/platform";
|
|
27
|
+
import {findComponentsDownward} from "@lambo-design/core/src/utils/assist";
|
|
23
28
|
export default {
|
|
24
29
|
name: "pro-layout-header",
|
|
30
|
+
props:{
|
|
31
|
+
acceptAppId: {
|
|
32
|
+
type: String,
|
|
33
|
+
default:''
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
data(){
|
|
37
|
+
return {
|
|
38
|
+
systemInfo: {},
|
|
39
|
+
isShowSearch:'1',
|
|
40
|
+
navList: [],
|
|
41
|
+
originMenuList:[],
|
|
42
|
+
menuList: [],
|
|
43
|
+
appId: '',
|
|
44
|
+
primaryColor: '#ff0000',
|
|
45
|
+
collapsed: false,
|
|
46
|
+
accordion: true,
|
|
47
|
+
activeName: '',
|
|
48
|
+
openedNames: [],
|
|
49
|
+
activeMenu: null,
|
|
50
|
+
selectedMenuParent: null,
|
|
51
|
+
activeMenuItem: null,
|
|
52
|
+
openedSubMenu: null,
|
|
53
|
+
currentMenuItem: null,
|
|
54
|
+
selectedTopParent: '',
|
|
55
|
+
activeIcon: null,
|
|
56
|
+
tagValue: '',
|
|
57
|
+
tagList: []
|
|
58
|
+
}
|
|
59
|
+
},
|
|
25
60
|
components: {
|
|
26
61
|
LamboProTrigger,
|
|
27
62
|
LamboProLogo,
|
|
28
63
|
LamboProNav,
|
|
29
64
|
LamboProTools
|
|
65
|
+
},
|
|
66
|
+
methods:{
|
|
67
|
+
initListener(){
|
|
68
|
+
Bus.$on('system-info',(data)=>{
|
|
69
|
+
this.initSystem(data)
|
|
70
|
+
});
|
|
71
|
+
Bus.$on('nav-list',(data)=>{
|
|
72
|
+
this.initNav(data)
|
|
73
|
+
});
|
|
74
|
+
Bus.$on('menu-list',(data)=>{
|
|
75
|
+
this.initMenu(data)
|
|
76
|
+
});
|
|
77
|
+
Bus.$on('trigger-change',(data)=>{
|
|
78
|
+
this.triggerChange(data)
|
|
79
|
+
});
|
|
80
|
+
Bus.$on('change-app', ({appId,appInfo})=> {
|
|
81
|
+
this.changeApp(appId,appInfo)
|
|
82
|
+
})
|
|
83
|
+
Bus.$on('tag-list',(data,current)=>{
|
|
84
|
+
this.initTags(data,current)
|
|
85
|
+
});
|
|
86
|
+
Bus.$on('menu-click',(current)=>{
|
|
87
|
+
this.menuClick(current)
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
destroyListener(){
|
|
91
|
+
Bus.$off('system-info')
|
|
92
|
+
Bus.$off('nav-list')
|
|
93
|
+
Bus.$off('menu-list')
|
|
94
|
+
Bus.$off('trigger-change')
|
|
95
|
+
Bus.$off('change-app')
|
|
96
|
+
Bus.$off('tag-list')
|
|
97
|
+
Bus.$off('menu-click')
|
|
98
|
+
},
|
|
99
|
+
initSystem(data){
|
|
100
|
+
if (data) {
|
|
101
|
+
this.systemInfo = data;
|
|
102
|
+
if (data.isShowSearch) {
|
|
103
|
+
this.isShowSearch = data.isShowSearch;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
initNav(data){
|
|
108
|
+
if (data.toString() === this.navList.toString()) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.navList = data;
|
|
112
|
+
},
|
|
113
|
+
handleSelect(name,uri,pid){
|
|
114
|
+
let menu = null;
|
|
115
|
+
if (name.indexOf("isTurnByHref_") > -1) {
|
|
116
|
+
name = name.replace("isTurnByHref_","");
|
|
117
|
+
menu = filterMenuUri(this.menuList,name);
|
|
118
|
+
} else {
|
|
119
|
+
menu = filterMenuName(this.menuList,name);
|
|
120
|
+
}
|
|
121
|
+
let tagList = this.tagList;
|
|
122
|
+
if (menu && menu.name) {
|
|
123
|
+
if (!tagExists(tagList,menu.name)) {
|
|
124
|
+
tagList.push(menu);
|
|
125
|
+
}
|
|
126
|
+
Bus.$emit('tag-list', tagList, menu.name)
|
|
127
|
+
}
|
|
128
|
+
if (menu.meta && Array.isArray(menu.meta.crumbs)) {
|
|
129
|
+
let parentMenu = menu.meta.crumbs[0]
|
|
130
|
+
this.$set(this, 'selectedTopParent', parentMenu.name);
|
|
131
|
+
} else {
|
|
132
|
+
// 处理没有父菜单的情况
|
|
133
|
+
this.$set(this, 'selectedTopParent', menu.name);
|
|
134
|
+
}
|
|
135
|
+
// 如果 uri 为空,则需要根据 pid 判断是展开父菜单还是同时展开父菜单和当前菜单
|
|
136
|
+
if (!uri) {
|
|
137
|
+
let parentName;
|
|
138
|
+
if (pid === 0) {
|
|
139
|
+
// 如果 pid 为 0,表示是最外层菜单
|
|
140
|
+
parentName = this.getNameOrHref(menu);
|
|
141
|
+
//console.log('parentName',parentName)
|
|
142
|
+
this.openedNames = [parentName]; // 设置最外层父菜单为展开状态
|
|
143
|
+
} else {
|
|
144
|
+
// 如果 pid 不等于 0,查找并打开对应的最外层父菜单
|
|
145
|
+
parentName = this.getTopParent(menu);
|
|
146
|
+
this.openedNames = [parentName]; // 设置最外层父菜单为展开状态
|
|
147
|
+
this.activeName = menu.name; // 设置当前菜单为激活状态
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
getTopParent(menu) {
|
|
153
|
+
return menu.parent ? this.getTopParent(menu.parent) : menu.name;
|
|
154
|
+
},
|
|
155
|
+
initMenu(data){
|
|
156
|
+
if (data && data.length > 0) {
|
|
157
|
+
let item = data[0];
|
|
158
|
+
if (item.appId && item.appId !== this.appId) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
this.originMenuList = deepCopy(data);
|
|
163
|
+
this.changeMenu()
|
|
164
|
+
},
|
|
165
|
+
changeApp(appId,appInfo){
|
|
166
|
+
this.appId = appId;
|
|
167
|
+
this.changeMenu()
|
|
168
|
+
},
|
|
169
|
+
changeMenu(){
|
|
170
|
+
let treeMenuList = generatorMenuList(this.originMenuList,this.appId);
|
|
171
|
+
if (treeMenuList && treeMenuList.length > 0) {
|
|
172
|
+
this.menuList = treeMenuList;
|
|
173
|
+
} else {
|
|
174
|
+
this.menuList = [];
|
|
175
|
+
}
|
|
176
|
+
this.openedNames = this.getOpenedNamesByActiveName();
|
|
177
|
+
},
|
|
178
|
+
activeIconBackground(item) {
|
|
179
|
+
// 如果当前菜单项是激活的,返回一个颜色值,否则返回空
|
|
180
|
+
return this.selectedMenuParent=== item.parent ? this.primaryColor : '';
|
|
181
|
+
},
|
|
182
|
+
triggerChange(data){
|
|
183
|
+
this.collapsed = data;
|
|
184
|
+
},
|
|
185
|
+
initTags(data,name){
|
|
186
|
+
this.tagList = data;
|
|
187
|
+
this.value = name;
|
|
188
|
+
},
|
|
189
|
+
menuClick(current) {
|
|
190
|
+
let item = this.originMenuList.filter(menu => menu.name === current);
|
|
191
|
+
if (item && item.length > 0){
|
|
192
|
+
let type = item[0].type;
|
|
193
|
+
if (type == 2) {
|
|
194
|
+
this.activeName = current;
|
|
195
|
+
} else {
|
|
196
|
+
let pItem = this.originMenuList.filter(menu => menu.permissionId === item[0].pid);
|
|
197
|
+
if (pItem && pItem.length > 0){
|
|
198
|
+
this.activeName = pItem[0].name;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
this.activeName = current;
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
getOpenedNamesByActiveName(){
|
|
206
|
+
let res = filterMenuName(this.menuList,this.activeName);
|
|
207
|
+
let openNames = []
|
|
208
|
+
if (res) {
|
|
209
|
+
const crumbs = res.meta.crumbs;
|
|
210
|
+
if (crumbs) {
|
|
211
|
+
crumbs.forEach(item => {
|
|
212
|
+
if (item.type === 1) {
|
|
213
|
+
openNames.push(item.name)
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return openNames
|
|
219
|
+
},
|
|
220
|
+
updateOpened () {
|
|
221
|
+
const items = findComponentsDownward(this, 'Submenu');
|
|
222
|
+
if (items.length) {
|
|
223
|
+
items.forEach(item => {
|
|
224
|
+
if (this.openedNames.indexOf(item.name) > -1) item.opened = true;
|
|
225
|
+
else item.opened = false;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
updateActiveName () {
|
|
230
|
+
if (this.currentActiveName === undefined) {
|
|
231
|
+
this.currentActiveName = -1;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
watch:{
|
|
236
|
+
activeName(){
|
|
237
|
+
this.openedNames = this.getOpenedNamesByActiveName();
|
|
238
|
+
},
|
|
239
|
+
openedNames() {
|
|
240
|
+
this.$nextTick(() => {
|
|
241
|
+
this.updateOpened()
|
|
242
|
+
this.updateActiveName()
|
|
243
|
+
})
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
created(){
|
|
247
|
+
this.initListener();
|
|
248
|
+
},
|
|
249
|
+
beforeDestroy(){
|
|
250
|
+
this.destroyListener();
|
|
30
251
|
}
|
|
31
252
|
}
|
|
32
253
|
</script>
|
|
@@ -49,4 +270,4 @@ export default {
|
|
|
49
270
|
float: right;
|
|
50
271
|
}
|
|
51
272
|
}
|
|
52
|
-
</style>
|
|
273
|
+
</style>
|
|
@@ -1,30 +1,99 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="pro-layout-logo-wrapper">
|
|
3
|
-
<div class="logo" :style="logoStyle"></div>
|
|
4
|
-
<div class="divider"></div>
|
|
5
|
-
<div class="system-name">{{systemName}}</div>
|
|
2
|
+
<div class="pro-layout-logo-wrapper" @click="handleClick">
|
|
3
|
+
<div class="logo" v-if="systemInfo.systemLogo !='hide'" :style="logoStyle"></div>
|
|
4
|
+
<div class="divider" v-if="systemInfo.systemLogo !='hide'"></div>
|
|
5
|
+
<div class="system-name" :style="nameStyle">{{systemName}}</div>
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
10
|
import Bus from '@lambo-design/shared/utils/bus'
|
|
11
11
|
export default {
|
|
12
|
+
|
|
12
13
|
name: "pro-layout-logo",
|
|
14
|
+
props:{
|
|
15
|
+
routeName:String,
|
|
16
|
+
default:''
|
|
17
|
+
},
|
|
13
18
|
data(){
|
|
14
19
|
return {
|
|
15
20
|
systemInfo: {},
|
|
16
|
-
systemName: '后台管理系统'
|
|
21
|
+
systemName: '后台管理系统',
|
|
22
|
+
isHovered: false,
|
|
23
|
+
src:''
|
|
17
24
|
}
|
|
18
25
|
},
|
|
19
26
|
computed:{
|
|
20
|
-
logoStyle(){
|
|
27
|
+
logoStyle() {
|
|
28
|
+
let style = '';
|
|
21
29
|
if (this.systemInfo && this.systemInfo.systemLogo) {
|
|
22
|
-
|
|
30
|
+
style += `background: url("${this.systemInfo.systemLogo}") no-repeat; background-size: 100%;`;
|
|
31
|
+
// 如果 systemInfo.logoWidth 存在且不为空,则添加到样式
|
|
32
|
+
if (this.systemInfo.logoWidth && this.systemInfo.logoWidth !== '') {
|
|
33
|
+
style += `width: ${this.systemInfo.logoWidth}px;`;
|
|
34
|
+
}
|
|
35
|
+
// 如果 systemInfo.logoTop 存在且不为空,则添加到样式
|
|
36
|
+
if (this.systemInfo.logoTop && this.systemInfo.logoTop !== '') {
|
|
37
|
+
style += `margin-top: ${this.systemInfo.logoTop}px;`;
|
|
38
|
+
}
|
|
39
|
+
style += `text-align-last: justify;`
|
|
40
|
+
}
|
|
41
|
+
return style;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// nameStyle() {
|
|
45
|
+
// const fontSize = 20; // 固定的字体大小是 20px
|
|
46
|
+
// const lineHeight = 50; // 固定的行高是 50px
|
|
47
|
+
// const nameSize = this.systemInfo.nameSize || 1; // 默认行数为1,如果未指定则使用1
|
|
48
|
+
// // 计算总高度
|
|
49
|
+
// const height = lineHeight * nameSize; // 确保至少有一行高度,即使nameSize小于1
|
|
50
|
+
// return {
|
|
51
|
+
// 'font-size': `${fontSize}px`, // 应用固定的字体大小
|
|
52
|
+
// 'line-height': `${lineHeight}px`, // 应用固定的行高
|
|
53
|
+
// 'height': `${height}px`, // 应用计算出的总高度
|
|
54
|
+
// 'overflow': 'hidden', // 确保多余的文本被裁剪
|
|
55
|
+
// 'white-space': 'pre-wrap', // 允许换行
|
|
56
|
+
// 'word-break': 'break-all'
|
|
57
|
+
// };
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
nameStyle() {
|
|
61
|
+
let style = '';
|
|
62
|
+
if (this.systemInfo && this.systemInfo.nameSize) {
|
|
63
|
+
const lines = this.systemInfo.nameSize; // 行数
|
|
64
|
+
const maxHeight = lineHeight * lines; // 计算最大高度
|
|
65
|
+
|
|
66
|
+
// 根据nameSize设置margin-top
|
|
67
|
+
if (lines === '1') {
|
|
68
|
+
style += `margin-top: 12.8px;`;
|
|
69
|
+
} else if (lines === '2') {
|
|
70
|
+
style += `margin-top: 6px; `;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 动态计算字体大小
|
|
74
|
+
const fontSize = Math.max(20 - (lines - 1) * 4, 15); // 字体大小递减
|
|
75
|
+
const lineHeight = fontSize + 5; // 固定行高
|
|
76
|
+
const width = (this.systemName.length / lines) * fontSize + 20;
|
|
77
|
+
|
|
78
|
+
// 组装样式字符串
|
|
79
|
+
style += `line-height: ${lineHeight}px;`;
|
|
80
|
+
style += `font-size: ${fontSize}px;`;
|
|
81
|
+
style += `max-height: ${maxHeight}px;`; // 设置最大高度限制行数
|
|
82
|
+
style += `width: ${width}px;`; // 设置宽度
|
|
83
|
+
style += `overflow: hidden;`; // 超出部分隐藏
|
|
84
|
+
style += `word-wrap: break-word;`; // 允许单词内换行
|
|
85
|
+
style += `white-space: normal;`; // 默认的换行方式
|
|
86
|
+
style += `text-align-last: justify;`;
|
|
87
|
+
style += `text-align: justify;`;
|
|
23
88
|
}
|
|
24
|
-
return
|
|
89
|
+
return style;
|
|
25
90
|
}
|
|
91
|
+
|
|
26
92
|
},
|
|
27
93
|
methods: {
|
|
94
|
+
handleClick(){
|
|
95
|
+
Bus.$emit('click-logo')
|
|
96
|
+
},
|
|
28
97
|
initListener(){
|
|
29
98
|
Bus.$on('system-info',(data)=>{
|
|
30
99
|
this.initSystem(data)
|
|
@@ -40,7 +109,8 @@ export default {
|
|
|
40
109
|
this.systemName = data.systemName;
|
|
41
110
|
}
|
|
42
111
|
}
|
|
43
|
-
}
|
|
112
|
+
},
|
|
113
|
+
|
|
44
114
|
},
|
|
45
115
|
created(){
|
|
46
116
|
this.initListener();
|
|
@@ -54,13 +124,14 @@ export default {
|
|
|
54
124
|
<style scoped lang="less">
|
|
55
125
|
.pro-layout-logo-wrapper{
|
|
56
126
|
overflow: hidden;
|
|
127
|
+
cursor:pointer;
|
|
57
128
|
.logo{
|
|
58
129
|
width: 150px;
|
|
59
130
|
height: 55px;
|
|
60
|
-
background: url("../styles/images/
|
|
131
|
+
background: url("../styles/images/inspur.png") no-repeat;
|
|
61
132
|
background-size: 100%;
|
|
62
133
|
float: left;
|
|
63
|
-
margin-top:
|
|
134
|
+
margin-top: 20px;
|
|
64
135
|
}
|
|
65
136
|
.divider{
|
|
66
137
|
height: 33px;
|
|
@@ -74,6 +145,7 @@ export default {
|
|
|
74
145
|
font-weight: bold;
|
|
75
146
|
font-size: 20px;
|
|
76
147
|
margin-right: 15px;
|
|
148
|
+
|
|
77
149
|
}
|
|
78
150
|
}
|
|
79
|
-
</style>
|
|
151
|
+
</style>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="pro-layout-nav-wrapper">
|
|
3
3
|
<Menu ref="topNav" mode="horizontal" theme="dark" :active-name="activeName" @on-select="selectApp">
|
|
4
4
|
<MenuItem :name="item.appId" v-for="item in topMenList" :key="item.appId">
|
|
5
|
-
{{item.name}}
|
|
5
|
+
{{ item.name }}
|
|
6
6
|
<div class="line"></div>
|
|
7
7
|
</MenuItem>
|
|
8
8
|
<Submenu name="other" v-if="otherList.length > 0">
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
...
|
|
11
11
|
</template>
|
|
12
12
|
<MenuItem :name="item.appId" v-for="item in otherList" :key="item.appId">
|
|
13
|
-
|
|
13
|
+
{{ item.name }}
|
|
14
14
|
</MenuItem>
|
|
15
15
|
</Submenu>
|
|
16
16
|
</Menu>
|
|
@@ -18,127 +18,170 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script>
|
|
21
|
-
import Bus from
|
|
22
|
-
import {deepCopy} from
|
|
23
|
-
import config from "@lambo-design/shared/config/config";
|
|
21
|
+
import Bus from '@lambo-design/shared/utils/bus'
|
|
22
|
+
import { deepCopy } from '@lambo-design/shared/utils/assist'
|
|
24
23
|
|
|
25
24
|
export default {
|
|
26
|
-
name:
|
|
27
|
-
|
|
25
|
+
name: 'pro-layout-',
|
|
26
|
+
props: {
|
|
27
|
+
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
28
30
|
return {
|
|
29
|
-
navList
|
|
30
|
-
topMenList
|
|
31
|
-
otherList
|
|
32
|
-
activeName
|
|
33
|
-
topMenuNum
|
|
31
|
+
navList: [],
|
|
32
|
+
topMenList: [],
|
|
33
|
+
otherList: [],
|
|
34
|
+
activeName: '',
|
|
35
|
+
topMenuNum: 4,
|
|
36
|
+
lastTopMenuNum:-1,
|
|
37
|
+
acceptAppId: '',
|
|
34
38
|
originMenuList: []
|
|
35
39
|
}
|
|
36
40
|
},
|
|
37
41
|
methods: {
|
|
38
|
-
initListener(){
|
|
39
|
-
Bus.$on('
|
|
42
|
+
initListener() {
|
|
43
|
+
Bus.$on('system-info',(data) => {
|
|
44
|
+
this.initSystemInfo();
|
|
45
|
+
})
|
|
46
|
+
Bus.$on('nav-list', (data) => {
|
|
40
47
|
this.initNav(data)
|
|
41
|
-
})
|
|
42
|
-
Bus.$on('change-app', ({appId,appInfo})=> {
|
|
43
|
-
this.changeApp(appId,appInfo)
|
|
44
|
-
})
|
|
45
|
-
Bus.$on('menu-list',(data)=>{
|
|
48
|
+
})
|
|
49
|
+
Bus.$on('change-app', ({ appId, appInfo }) => {
|
|
50
|
+
this.changeApp(appId, appInfo)
|
|
51
|
+
})
|
|
52
|
+
Bus.$on('menu-list', (data) => {
|
|
46
53
|
this.initMenu(data)
|
|
47
|
-
})
|
|
54
|
+
})
|
|
55
|
+
|
|
48
56
|
},
|
|
49
|
-
destroyListener(){
|
|
57
|
+
destroyListener() {
|
|
58
|
+
Bus.$off('system-info')
|
|
50
59
|
Bus.$off('nav-list')
|
|
51
60
|
Bus.$off('menu-list')
|
|
52
61
|
Bus.$off('change-app')
|
|
53
62
|
},
|
|
54
|
-
|
|
55
|
-
if (data
|
|
56
|
-
|
|
63
|
+
initSystemInfo(data) {
|
|
64
|
+
if (data) {
|
|
65
|
+
this.topMenuNum = data.topMenu ? data.topMenu : 4;
|
|
66
|
+
this.acceptAppId = data.acceptAppId ? data.acceptAppId : '';
|
|
67
|
+
this.initNav(this.navList)
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
initNav(data) {
|
|
71
|
+
if (data.toString() === this.navList.toString() && this.topMenuNum === this.lastTopMenuNum) {
|
|
72
|
+
return
|
|
57
73
|
}
|
|
58
|
-
this.navList = data
|
|
74
|
+
this.navList = data
|
|
75
|
+
this.lastTopMenuNum = this.topMenuNum
|
|
59
76
|
if (data.length > this.topMenuNum) {
|
|
60
|
-
let navList = deepCopy(data)
|
|
61
|
-
this.topMenList = navList.splice(0,this.topMenuNum)
|
|
62
|
-
this.otherList = navList
|
|
77
|
+
let navList = deepCopy(data)
|
|
78
|
+
this.topMenList = navList.splice(0, this.topMenuNum)
|
|
79
|
+
this.otherList = navList
|
|
63
80
|
} else {
|
|
64
81
|
this.topMenList = this.navList
|
|
65
82
|
}
|
|
66
|
-
if (this.topMenList.length > 0){
|
|
67
|
-
let appId = this.topMenList[0].appId
|
|
83
|
+
if (this.topMenList.length > 0) {
|
|
84
|
+
let appId = this.topMenList[0].appId
|
|
85
|
+
for (let i = 0; i < this.topMenList.length; i++) {
|
|
86
|
+
if (this.topMenList[i].selected == true) {
|
|
87
|
+
appId = this.topMenList[i].appId
|
|
88
|
+
}
|
|
89
|
+
}
|
|
68
90
|
if (this.activeName) {
|
|
69
|
-
appId = this.activeName
|
|
91
|
+
appId = this.activeName
|
|
70
92
|
}
|
|
71
|
-
this.selectApp(appId)
|
|
93
|
+
this.selectApp(appId)
|
|
72
94
|
}
|
|
73
95
|
},
|
|
74
|
-
initMenu(data){
|
|
75
|
-
this.originMenuList = deepCopy(data)
|
|
96
|
+
initMenu(data) {
|
|
97
|
+
this.originMenuList = deepCopy(data)
|
|
76
98
|
},
|
|
77
|
-
selectApp(appId){
|
|
78
|
-
this.activeName = appId
|
|
79
|
-
let res = this.navList.filter(app => app.appId == appId)
|
|
80
|
-
Bus.$emit('change-app', {appId,appInfo:res[0]})
|
|
99
|
+
selectApp(appId) {
|
|
100
|
+
this.activeName = appId
|
|
101
|
+
let res = this.navList.filter(app => app.appId == appId)
|
|
102
|
+
Bus.$emit('change-app', { appId, appInfo: res[0] })
|
|
81
103
|
},
|
|
82
|
-
changeApp(appId,appInfo) {
|
|
83
|
-
this.activeName = appId
|
|
104
|
+
changeApp(appId, appInfo) {
|
|
105
|
+
this.activeName = appId
|
|
84
106
|
this.$nextTick(() => {
|
|
85
107
|
this.$refs.topNav.updateActiveName()
|
|
86
108
|
})
|
|
87
109
|
}
|
|
88
110
|
},
|
|
89
111
|
watch: {
|
|
90
|
-
activeName(){
|
|
91
|
-
this.$nextTick(()=>{
|
|
92
|
-
this.$refs.topNav.updateActiveName()
|
|
112
|
+
activeName() {
|
|
113
|
+
this.$nextTick(() => {
|
|
114
|
+
this.$refs.topNav.updateActiveName()
|
|
93
115
|
})
|
|
116
|
+
},
|
|
117
|
+
acceptAppId(val) {
|
|
118
|
+
if (val) {
|
|
119
|
+
this.selectApp(val)
|
|
120
|
+
}
|
|
94
121
|
}
|
|
95
122
|
},
|
|
96
|
-
created(){
|
|
97
|
-
this.initListener()
|
|
123
|
+
created() {
|
|
124
|
+
this.initListener()
|
|
98
125
|
},
|
|
99
|
-
beforeDestroy(){
|
|
100
|
-
this.destroyListener()
|
|
126
|
+
beforeDestroy() {
|
|
127
|
+
this.destroyListener()
|
|
101
128
|
}
|
|
102
129
|
}
|
|
103
130
|
</script>
|
|
104
131
|
|
|
105
132
|
<style scoped lang="less">
|
|
106
133
|
@import '@lambo-design/core/src/styles/default.less';
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
.
|
|
113
|
-
|
|
134
|
+
|
|
135
|
+
.pro-layout-nav-wrapper {
|
|
136
|
+
.ivu-menu {
|
|
137
|
+
.ivu-menu-item {
|
|
138
|
+
&:hover {
|
|
139
|
+
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
|
|
140
|
+
|
|
141
|
+
.line {
|
|
142
|
+
border-bottom: 3.35px solid var(--primary-color-tint-5, @_primary-color-tint-5);
|
|
143
|
+
position: absolute;
|
|
144
|
+
left: 0;
|
|
145
|
+
right: 0;
|
|
114
146
|
}
|
|
115
147
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
.
|
|
119
|
-
|
|
148
|
+
|
|
149
|
+
&.ivu-menu-item-active, &.ivu-menu-item-selected {
|
|
150
|
+
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
|
|
151
|
+
|
|
152
|
+
.line {
|
|
153
|
+
border-bottom: 3.35px solid var(--primary-color-tint-5, @_primary-color-tint-5);
|
|
154
|
+
position: absolute;
|
|
155
|
+
left: 0;
|
|
156
|
+
right: 0;
|
|
157
|
+
//bottom: 0;
|
|
120
158
|
}
|
|
121
159
|
}
|
|
122
160
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
161
|
+
|
|
162
|
+
/deep/ .ivu-menu-submenu {
|
|
163
|
+
.ivu-menu-submenu-title > i {
|
|
164
|
+
&.ivu-menu-submenu-title-icon {
|
|
126
165
|
|
|
127
166
|
}
|
|
128
167
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
168
|
+
|
|
169
|
+
.ivu-select-dropdown {
|
|
170
|
+
background: var(--menu-dark-title, @_menu-dark-title);
|
|
171
|
+
color: var(--heading-color-dark, @_heading-color-dark);
|
|
172
|
+
|
|
173
|
+
.ivu-menu-drop-list {
|
|
174
|
+
.ivu-menu-item {
|
|
175
|
+
color: var(--menu-dark-subsidiary-color, @_menu-dark-subsidiary-color);
|
|
176
|
+
|
|
177
|
+
&:hover {
|
|
178
|
+
background: rgba(255, 255, 255, 0.2);
|
|
179
|
+
color: var(--heading-color-dark, @_heading-color-dark);
|
|
138
180
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
181
|
+
|
|
182
|
+
&.ivu-menu-item-active, &.ivu-menu-item-selected {
|
|
183
|
+
background: rgba(255, 255, 255, 0.2);
|
|
184
|
+
color: var(--heading-color-dark, @_heading-color-dark);
|
|
142
185
|
}
|
|
143
186
|
}
|
|
144
187
|
}
|
|
@@ -147,4 +190,4 @@ export default {
|
|
|
147
190
|
}
|
|
148
191
|
}
|
|
149
192
|
|
|
150
|
-
</style>
|
|
193
|
+
</style>
|