@lambo-design/pro-layout 1.0.0-beta.8 → 1.0.0-beta.80
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 +17 -18
- package/src/components/pro-layout-header.vue +0 -1
- package/src/components/pro-layout-logo.vue +23 -11
- package/src/components/pro-layout-nav.vue +1 -1
- package/src/components/pro-layout-other-menu.vue +139 -0
- package/src/components/pro-layout-sider-collapsed-menu.vue +5 -3
- package/src/components/pro-layout-sider-menu-item.vue +63 -0
- package/src/components/pro-layout-sider.vue +17 -4
- package/src/components/pro-layout-tabs.vue +23 -3
- package/src/components/pro-layout-tools-user.vue +1 -1
- package/src/components/pro-layout-trigger.vue +1 -1
- package/src/index.vue +91 -19
- package/src/styles/images/inspur.png +0 -0
- package/src/styles/other-menu.less +161 -0
- /package/src/styles/images/{logo.png → tobacco.png} +0 -0
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lambo-design/pro-layout",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@lambo-design/pro-layout",
|
|
3
|
+
"version": "1.0.0-beta.80",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "lambo",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"registry": "https://registry.npmjs.org/"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@lambo-design/core": "^4.7.1-beta.60",
|
|
14
|
+
"@lambo-design/shared": "^1.0.0-beta.43"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {}
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="pro-layout-logo-wrapper">
|
|
3
|
-
<div class="logo"></div>
|
|
3
|
+
<div class="logo" :style="logoStyle"></div>
|
|
4
4
|
<div class="divider"></div>
|
|
5
5
|
<div class="system-name">{{systemName}}</div>
|
|
6
6
|
</div>
|
|
@@ -12,20 +12,34 @@ export default {
|
|
|
12
12
|
name: "pro-layout-logo",
|
|
13
13
|
data(){
|
|
14
14
|
return {
|
|
15
|
+
systemInfo: {},
|
|
15
16
|
systemName: '后台管理系统'
|
|
16
17
|
}
|
|
17
18
|
},
|
|
19
|
+
computed:{
|
|
20
|
+
logoStyle(){
|
|
21
|
+
if (this.systemInfo && this.systemInfo.systemLogo) {
|
|
22
|
+
return 'background: url("' + this.systemInfo.systemLogo + '") no-repeat;background-size: 100%;'
|
|
23
|
+
}
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
},
|
|
18
27
|
methods: {
|
|
19
28
|
initListener(){
|
|
20
|
-
Bus.$on('system-
|
|
21
|
-
this.
|
|
29
|
+
Bus.$on('system-info',(data)=>{
|
|
30
|
+
this.initSystem(data)
|
|
22
31
|
});
|
|
23
32
|
},
|
|
24
33
|
destroyListener(){
|
|
25
|
-
Bus.$off('system-
|
|
34
|
+
Bus.$off('system-info')
|
|
26
35
|
},
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
initSystem(data){
|
|
37
|
+
if (data) {
|
|
38
|
+
this.systemInfo = data;
|
|
39
|
+
if (data.systemName) {
|
|
40
|
+
this.systemName = data.systemName;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
29
43
|
}
|
|
30
44
|
},
|
|
31
45
|
created(){
|
|
@@ -40,15 +54,13 @@ export default {
|
|
|
40
54
|
<style scoped lang="less">
|
|
41
55
|
.pro-layout-logo-wrapper{
|
|
42
56
|
overflow: hidden;
|
|
43
|
-
border-bottom: 1px solid #000000;
|
|
44
57
|
.logo{
|
|
45
58
|
width: 150px;
|
|
46
59
|
height: 55px;
|
|
47
|
-
background: url("../styles/images/
|
|
60
|
+
background: url("../styles/images/inspur.png") no-repeat;
|
|
48
61
|
background-size: 100%;
|
|
49
62
|
float: left;
|
|
50
|
-
margin-top:
|
|
51
|
-
border-bottom: 1px solid #000000;
|
|
63
|
+
margin-top: 20px;
|
|
52
64
|
}
|
|
53
65
|
.divider{
|
|
54
66
|
height: 33px;
|
|
@@ -64,4 +76,4 @@ export default {
|
|
|
64
76
|
margin-right: 15px;
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
|
-
</style>
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes">
|
|
3
|
+
<div class="other-menu-item" @click="onChange('history')">
|
|
4
|
+
<Tooltip :disabled="!collapsed" content="历史" placement="right" transfer>
|
|
5
|
+
<div>
|
|
6
|
+
<Icon class="other-menu-icon" type="md-time"/>
|
|
7
|
+
<span class="other-menu-title"> 历史</span>
|
|
8
|
+
</div>
|
|
9
|
+
</Tooltip>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="other-menu-item" @click="onChange('collect')">
|
|
12
|
+
<Tooltip :disabled="!collapsed" content="收藏" placement="right" transfer>
|
|
13
|
+
<div>
|
|
14
|
+
<Icon class="other-menu-icon" type="md-star-outline"/>
|
|
15
|
+
<span class="other-menu-title"> 收藏</span>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
</Tooltip>
|
|
19
|
+
</div>
|
|
20
|
+
<Drawer v-model="drawer.model"
|
|
21
|
+
:class-name="drawerClasses"
|
|
22
|
+
:closable="false"
|
|
23
|
+
:mask-style="{backgroundColor: 'unset'}"
|
|
24
|
+
:scrollable="true"
|
|
25
|
+
:title="drawer.title"
|
|
26
|
+
placement="left"
|
|
27
|
+
>
|
|
28
|
+
<div v-if="drawer.type=='history'" class="other-menu-history">
|
|
29
|
+
<div v-for="item in list" class="other-menu-history-item">
|
|
30
|
+
<div class="content" @click="handleClick(item)">
|
|
31
|
+
<common-icon :type="item.icon"></common-icon>
|
|
32
|
+
<span> {{ item.label }}</span>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="delete">
|
|
35
|
+
<common-icon type="ios-close" @click.native="handleHistoryDelete(item)"></common-icon>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div v-if="drawer.type=='collect'" class="other-menu-collect">
|
|
40
|
+
<div v-for="item in list" class="other-menu-collect-item" @click="handleClick(item)">
|
|
41
|
+
<div class="content">
|
|
42
|
+
<Tooltip :content="item.label" :delay="1000">
|
|
43
|
+
<common-icon :size="40" :type="item.icon"></common-icon>
|
|
44
|
+
</Tooltip>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="delete">
|
|
47
|
+
<common-icon type="ios-close" @click.native.stop="handleCollectDelete(item)"></common-icon>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</Drawer>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
import ajax from '@lambo-design/shared/utils/ajax';
|
|
57
|
+
import config from "@lambo-design/shared/config/config";
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
name: "other-menu",
|
|
62
|
+
components: {},
|
|
63
|
+
props: {
|
|
64
|
+
collapsed: {
|
|
65
|
+
type: Boolean
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
data() {
|
|
69
|
+
return {
|
|
70
|
+
drawer: {
|
|
71
|
+
model: false,
|
|
72
|
+
url: '',
|
|
73
|
+
title: '',
|
|
74
|
+
type: '',
|
|
75
|
+
},
|
|
76
|
+
list: []
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
computed: {
|
|
80
|
+
classes() {
|
|
81
|
+
let classes = ["other-menu"]
|
|
82
|
+
return this.collapsed ? ["other-menu-collapsed", ...classes] : [...classes]
|
|
83
|
+
},
|
|
84
|
+
drawerClasses() {
|
|
85
|
+
return this.collapsed ? "other-menu-drawer-wrap-collapsed" : "other-menu-drawer-wrap"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
onChange(value) {
|
|
90
|
+
if (value == 'history') {
|
|
91
|
+
this.drawer.title = '历史菜单'
|
|
92
|
+
this.drawer.url = '/manage/upmsMenuHistory/list'
|
|
93
|
+
|
|
94
|
+
} else {
|
|
95
|
+
this.drawer.title = '收藏菜单'
|
|
96
|
+
this.drawer.url = '/manage/upmsMenuCollect/list'
|
|
97
|
+
}
|
|
98
|
+
this.getList()
|
|
99
|
+
this.drawer.type = value
|
|
100
|
+
this.drawer.model = !this.drawer.model
|
|
101
|
+
},
|
|
102
|
+
getList() {
|
|
103
|
+
this.list = []
|
|
104
|
+
ajax.get(config.upmsServerContext + this.drawer.url).then(resp => {
|
|
105
|
+
if (resp.data.code == 1) {
|
|
106
|
+
this.list = resp.data.data
|
|
107
|
+
if (this.drawer.type == 'collect') {
|
|
108
|
+
this.$store.commit('setCollectMenuList', this.list)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
handleClick(item) {
|
|
114
|
+
this.$emit('on-select', item.name)
|
|
115
|
+
this.drawer.model = false
|
|
116
|
+
},
|
|
117
|
+
handleHistoryDelete(item) {
|
|
118
|
+
ajax.get(config.upmsServerContext + "/manage/upmsMenuHistory/delete/" + item.historyId).then(resp => {
|
|
119
|
+
if (resp.data.code == 1) {
|
|
120
|
+
this.getList()
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
handleCollectDelete(item) {
|
|
125
|
+
ajax.get(config.upmsServerContext + "/manage/upmsMenuCollect/delete/" + item.collectId).then(resp => {
|
|
126
|
+
if (resp.data.code == 1) {
|
|
127
|
+
this.getList()
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
<style lang="less">
|
|
137
|
+
@import '../styles/other-menu.less';
|
|
138
|
+
@import "@lambo-design/core/src/styles/default.less";
|
|
139
|
+
</style>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Dropdown ref="dropdown" :class="hideTitle ? '' : 'collased-menu-dropdown'" :placement="placement"
|
|
3
|
-
:transfer="
|
|
3
|
+
:transfer="true" @on-click="handleClick">
|
|
4
4
|
<a :style="{textAlign: !hideTitle ? 'left' : '',padding: !hideTitle ? '0px' : ''}" class="drop-menu-a" type="text"
|
|
5
5
|
@mouseover="handleMousemove($event, children)">
|
|
6
|
-
<ProLayoutSiderIcon :icon-type="parentItem.meta.icon"></ProLayoutSiderIcon>
|
|
6
|
+
<ProLayoutSiderIcon :icon-type="parentItem.meta.icon" :icon-size="hideTitle ? 26 : 14"></ProLayoutSiderIcon>
|
|
7
7
|
<span v-if="!hideTitle" class="menu-title">{{ showTitle(parentItem) }}</span>
|
|
8
8
|
<Icon v-if="!hideTitle" :size="16"type="ios-arrow-forward"/>
|
|
9
9
|
</a>
|
|
10
|
-
<DropdownMenu ref="dropdown" slot="list">
|
|
10
|
+
<DropdownMenu ref="dropdown" slot="list" style="width: auto">
|
|
11
11
|
<template v-for="child in children">
|
|
12
12
|
<ProLayoutSiderCollapsedMenu v-if="showChildren(child)" :key="`drop-${child.name}`"
|
|
13
13
|
:parent-item="child">
|
|
@@ -69,6 +69,7 @@ export default {
|
|
|
69
69
|
list-style: none;
|
|
70
70
|
cursor: pointer;
|
|
71
71
|
transition: background 0.2s ease-in-out;
|
|
72
|
+
display: block;
|
|
72
73
|
&:hover{
|
|
73
74
|
color: var(--heading-color, @_heading-color);
|
|
74
75
|
background: rgba(26,26,26,0.05);
|
|
@@ -78,6 +79,7 @@ export default {
|
|
|
78
79
|
display: inline-block;
|
|
79
80
|
width: 100%;
|
|
80
81
|
font-weight: normal;
|
|
82
|
+
margin-left: -5px;
|
|
81
83
|
color: var(--text-color, @_text-color) !important;
|
|
82
84
|
text-decoration: none;
|
|
83
85
|
&:hover{
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
:parent-item="item">
|
|
11
11
|
</ProLayoutSiderMenuItem>
|
|
12
12
|
<menu-item v-else :key="`menu-${item.children[0].name}`" :name="getNameOrHref(item, true)">
|
|
13
|
+
<Icon :type="isCollected[item.name] ? 'ios-star' : 'ios-star-outline'" @click="toggleCollect(item)"></Icon>
|
|
13
14
|
<ProLayoutSiderIcon :icon-type="item.meta.icon"></ProLayoutSiderIcon>
|
|
14
15
|
<span>{{ showTitle(item.children[0]) }}</span>
|
|
15
16
|
</menu-item>
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
:parent-item="item">
|
|
20
21
|
</ProLayoutSiderMenuItem>
|
|
21
22
|
<menu-item v-else :key="`menu-${item.name}`" :name="getNameOrHref(item)">
|
|
23
|
+
<Icon :type="isCollected[item.name] ? 'ios-star' : 'ios-star-outline'" @click="toggleCollect(item)"></Icon>
|
|
22
24
|
<ProLayoutSiderIcon :icon-type="item.meta.icon"></ProLayoutSiderIcon>
|
|
23
25
|
<span>{{ showTitle(item) }}</span>
|
|
24
26
|
</menu-item>
|
|
@@ -29,9 +31,70 @@
|
|
|
29
31
|
<script>
|
|
30
32
|
import sider from '../utils/sider'
|
|
31
33
|
import menuItem from '../utils/menuItem'
|
|
34
|
+
import ajax from '@lambo-design/shared/utils/ajax';
|
|
35
|
+
import config from "@lambo-design/shared/config/config";
|
|
32
36
|
|
|
33
37
|
export default {
|
|
34
38
|
name: 'ProLayoutSiderMenuItem',
|
|
35
39
|
mixins: [sider, menuItem],
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
isCollected: {} // 使用对象来记录每个子菜单的收藏状态
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
mounted() {
|
|
46
|
+
this.fetchCollectedMenus();
|
|
47
|
+
},
|
|
48
|
+
methods: {
|
|
49
|
+
fetchCollectedMenus() {
|
|
50
|
+
ajax.get(config.upmsServerContext + "/manage/upmsMenuCollect/list").then(resp => {
|
|
51
|
+
const collectedMenus = resp.data.data;
|
|
52
|
+
console.log('collectedMenus', collectedMenus)
|
|
53
|
+
if (Array.isArray(collectedMenus)) {
|
|
54
|
+
collectedMenus.forEach(menu => {
|
|
55
|
+
// 使用 menu 的 name 属性作为键
|
|
56
|
+
this.$set(this.isCollected, menu.name, true);
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
console.error("Expected an array but got:", typeof collectedMenus);
|
|
60
|
+
}
|
|
61
|
+
;
|
|
62
|
+
}).catch(err => {
|
|
63
|
+
console.error("Error fetching collected menus:", err);
|
|
64
|
+
});
|
|
65
|
+
console.log('isCollected', this.isCollected)
|
|
66
|
+
},
|
|
67
|
+
toggleCollect(item) {
|
|
68
|
+
const self = this;
|
|
69
|
+
let list = this.$store.state.app.originalPermissionList;
|
|
70
|
+
|
|
71
|
+
let item1 = list.find(item1 => item1.name == item.component);
|
|
72
|
+
|
|
73
|
+
const apiUrl = self.isCollected[item.name] ?
|
|
74
|
+
config.upmsServerContext + "/manage/upmsMenuCollect/remove" :
|
|
75
|
+
config.upmsServerContext + "/manage/upmsMenuCollect/add";
|
|
76
|
+
|
|
77
|
+
const data = {
|
|
78
|
+
appId: item1.appId,
|
|
79
|
+
permissionId: item1.permissionId
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
ajax.post(apiUrl, data).then(function(resp) {
|
|
83
|
+
if (resp.data.code == 1) {
|
|
84
|
+
// Use 'self' instead of 'this'
|
|
85
|
+
self.$set(self.isCollected, item.name, !self.isCollected[item.name]);
|
|
86
|
+
const message = self.isCollected[item.name] ? '收藏成功' : '取消收藏成功';
|
|
87
|
+
self.$Message.success(message);
|
|
88
|
+
} else {
|
|
89
|
+
const message = self.isCollected[item.name] ? '取消收藏失败' : '收藏失败';
|
|
90
|
+
self.$Message.error(message + ', 请联系系统管理员');
|
|
91
|
+
}
|
|
92
|
+
}).catch(function(err) {
|
|
93
|
+
console.error("收藏操作失败:", err);
|
|
94
|
+
self.$Message.error('操作失败, 请联系系统管理员');
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
}
|
|
36
99
|
}
|
|
37
100
|
</script>
|
|
@@ -55,7 +55,7 @@ import ProLayoutSiderMenuItem from './pro-layout-sider-menu-item'
|
|
|
55
55
|
import ProLayoutSiderCollapsedMenu from './pro-layout-sider-collapsed-menu'
|
|
56
56
|
import {
|
|
57
57
|
filterMenuName,
|
|
58
|
-
filterMenuUri,
|
|
58
|
+
filterMenuUri, routeEqual,
|
|
59
59
|
tagExists
|
|
60
60
|
} from "@lambo-design/shared/utils/platform";
|
|
61
61
|
|
|
@@ -118,6 +118,7 @@ export default {
|
|
|
118
118
|
initMenu(data){
|
|
119
119
|
if (data && data.length > 0) {
|
|
120
120
|
let item = data[0];
|
|
121
|
+
console.log("item:",item)
|
|
121
122
|
if (item.appId && item.appId !== this.appId) {
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
@@ -153,7 +154,6 @@ export default {
|
|
|
153
154
|
}
|
|
154
155
|
Bus.$emit('tag-list', tagList, menu.name)
|
|
155
156
|
}
|
|
156
|
-
//Bus.$emit('menu-click', name)
|
|
157
157
|
},
|
|
158
158
|
triggerChange(data){
|
|
159
159
|
this.collapsed = data;
|
|
@@ -163,7 +163,20 @@ export default {
|
|
|
163
163
|
this.value = name;
|
|
164
164
|
},
|
|
165
165
|
menuClick(current) {
|
|
166
|
-
this.
|
|
166
|
+
let item = this.originMenuList.filter(menu => menu.name === current);
|
|
167
|
+
if (item && item.length > 0){
|
|
168
|
+
let type = item[0].type;
|
|
169
|
+
if (type == 2) {
|
|
170
|
+
this.activeName = current;
|
|
171
|
+
} else {
|
|
172
|
+
let pItem = this.originMenuList.filter(menu => menu.permissionId === item[0].pid);
|
|
173
|
+
if (pItem && pItem.length > 0){
|
|
174
|
+
this.activeName = pItem[0].name;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
this.activeName = current;
|
|
179
|
+
}
|
|
167
180
|
},
|
|
168
181
|
getOpenedNamesByActiveName(){
|
|
169
182
|
let res = filterMenuName(this.menuList,this.activeName);
|
|
@@ -225,4 +238,4 @@ export default {
|
|
|
225
238
|
}
|
|
226
239
|
}
|
|
227
240
|
}
|
|
228
|
-
</style>
|
|
241
|
+
</style>
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
<script>
|
|
45
45
|
import {
|
|
46
46
|
getPreviousTagIndex,
|
|
47
|
+
getDelTagIndex,
|
|
47
48
|
setTagNavListInLocalstorage,
|
|
48
49
|
showTitle
|
|
49
50
|
} from '@lambo-design/shared/utils/platform'
|
|
@@ -56,6 +57,8 @@ export default {
|
|
|
56
57
|
name: 'pro-layout-tabs',
|
|
57
58
|
data() {
|
|
58
59
|
return {
|
|
60
|
+
systemInfo: {},
|
|
61
|
+
tabNum : 8,
|
|
59
62
|
appId: '',
|
|
60
63
|
appInfo: {},
|
|
61
64
|
navList: [],
|
|
@@ -76,6 +79,9 @@ export default {
|
|
|
76
79
|
},
|
|
77
80
|
methods: {
|
|
78
81
|
initListener(){
|
|
82
|
+
Bus.$on('system-info',(data)=>{
|
|
83
|
+
this.initSystem(data)
|
|
84
|
+
});
|
|
79
85
|
Bus.$on('nav-list',(data)=>{
|
|
80
86
|
this.initNav(data)
|
|
81
87
|
});
|
|
@@ -90,11 +96,20 @@ export default {
|
|
|
90
96
|
})
|
|
91
97
|
},
|
|
92
98
|
destroyListener(){
|
|
99
|
+
Bus.$off('system-info')
|
|
93
100
|
Bus.$off('nav-list')
|
|
94
101
|
Bus.$off('menu-list')
|
|
95
102
|
Bus.$off('tag-list')
|
|
96
103
|
Bus.$off('change-app')
|
|
97
104
|
},
|
|
105
|
+
initSystem(data){
|
|
106
|
+
if (data) {
|
|
107
|
+
this.systemInfo = data;
|
|
108
|
+
if (data.tabNum) {
|
|
109
|
+
this.tabNum = data.tabNum;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
98
113
|
initNav(data){
|
|
99
114
|
if (data.toString() === this.navList.toString()) {
|
|
100
115
|
return;
|
|
@@ -105,7 +120,11 @@ export default {
|
|
|
105
120
|
this.originMenuList = deepCopy(data);
|
|
106
121
|
},
|
|
107
122
|
initTags(data,current){
|
|
108
|
-
|
|
123
|
+
if (data.length > this.tabNum) {
|
|
124
|
+
let index = getDelTagIndex(data,current);
|
|
125
|
+
data.splice(index,1);
|
|
126
|
+
}
|
|
127
|
+
setTagNavListInLocalstorage(data, config.routerBase + '-tagNavList');
|
|
109
128
|
this.tagList = data;
|
|
110
129
|
if (current !== this.value) {
|
|
111
130
|
this.value = current;
|
|
@@ -186,7 +205,7 @@ export default {
|
|
|
186
205
|
},
|
|
187
206
|
handleClick(item) {
|
|
188
207
|
this.value = item.name
|
|
189
|
-
Bus.$emit('menu-click', item.name)
|
|
208
|
+
Bus.$emit('menu-click', item.name , item)
|
|
190
209
|
if (item.meta && item.meta.appId
|
|
191
210
|
&& item.meta.appId != this.appId
|
|
192
211
|
&& item.meta.appId != config.homeRouter.meta.appId) {
|
|
@@ -238,7 +257,7 @@ export default {
|
|
|
238
257
|
this.visible = true
|
|
239
258
|
const offsetLeft = this.$el.getBoundingClientRect().left
|
|
240
259
|
this.contextMenuLeft = e.clientX - offsetLeft + 10
|
|
241
|
-
this.contextMenuTop = e.clientY -
|
|
260
|
+
this.contextMenuTop = e.clientY - 54
|
|
242
261
|
},
|
|
243
262
|
closeMenu() {
|
|
244
263
|
this.visible = false
|
|
@@ -368,6 +387,7 @@ export default {
|
|
|
368
387
|
margin: 0;
|
|
369
388
|
padding: 5px 15px;
|
|
370
389
|
cursor: pointer;
|
|
390
|
+
line-height: 18px;
|
|
371
391
|
|
|
372
392
|
&:hover {
|
|
373
393
|
background: #eee;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<span>欢迎,{{ userInfo.userName }}</span>
|
|
5
5
|
<Icon type="ios-arrow-down" />
|
|
6
6
|
<DropdownMenu v-if="userInfo.dropList.length > 0" slot="list">
|
|
7
|
-
<DropdownItem v-for="item in userInfo.dropList" :name="item.name"> {{item.value}}</DropdownItem>
|
|
7
|
+
<DropdownItem v-for="item in userInfo.dropList" :name="item.name" :key="item.name"> {{item.value}}</DropdownItem>
|
|
8
8
|
</DropdownMenu>
|
|
9
9
|
</Dropdown>
|
|
10
10
|
</div>
|
package/src/index.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<i-layout class="pro-layout">
|
|
2
|
+
<i-layout class="pro-layout" :class="layoutClass">
|
|
3
3
|
<i-header class="pro-layout-header">
|
|
4
4
|
<LamboProLayoutHeader></LamboProLayoutHeader>
|
|
5
5
|
</i-header>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
class="pro-layout-sider"
|
|
9
9
|
hide-trigger
|
|
10
10
|
collapsible
|
|
11
|
-
:width="
|
|
11
|
+
:width="220"
|
|
12
12
|
:collapsed-width="64"
|
|
13
13
|
v-model="collapsed">
|
|
14
14
|
<LamboProLayoutSider ref="sider"></LamboProLayoutSider>
|
|
@@ -35,14 +35,21 @@ import LamboProLayoutTabs from './components/pro-layout-tabs'
|
|
|
35
35
|
import Bus from '@lambo-design/shared/utils/bus'
|
|
36
36
|
import config from "@lambo-design/shared/config/config";
|
|
37
37
|
import {
|
|
38
|
-
getTagNavListFromLocalstorage, tagExists,
|
|
38
|
+
getTagNavListFromLocalstorage, routeEqual, tagExists,
|
|
39
39
|
} from "@lambo-design/shared/utils/platform";
|
|
40
40
|
import {deepCopy} from "@lambo-design/shared/utils/assist";
|
|
41
41
|
export default {
|
|
42
42
|
props:{
|
|
43
43
|
systemInfo: {
|
|
44
44
|
type: Object,
|
|
45
|
-
default: () => {
|
|
45
|
+
default: () => {
|
|
46
|
+
return {
|
|
47
|
+
systemName: '后台管理系统',
|
|
48
|
+
systemLogo: '',
|
|
49
|
+
layoutSize: '',
|
|
50
|
+
tabNum: 8,
|
|
51
|
+
}
|
|
52
|
+
}
|
|
46
53
|
},
|
|
47
54
|
userInfo: {
|
|
48
55
|
type: Object,
|
|
@@ -86,6 +93,17 @@ export default {
|
|
|
86
93
|
menuList,
|
|
87
94
|
homeRouter
|
|
88
95
|
}
|
|
96
|
+
},
|
|
97
|
+
layoutClass(){
|
|
98
|
+
if (this.systemInfo && this.systemInfo.layoutSize) {
|
|
99
|
+
let layoutSize = this.systemInfo.layoutSize;
|
|
100
|
+
if (layoutSize == 'default') {
|
|
101
|
+
return '';
|
|
102
|
+
} else {
|
|
103
|
+
return 'small';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return '';
|
|
89
107
|
}
|
|
90
108
|
},
|
|
91
109
|
watch: {
|
|
@@ -108,8 +126,8 @@ export default {
|
|
|
108
126
|
Bus.$on('user-action', (name)=> {
|
|
109
127
|
this.userAction(name)
|
|
110
128
|
})
|
|
111
|
-
Bus.$on('menu-click',(name)=>{
|
|
112
|
-
this.menuClick(name)
|
|
129
|
+
Bus.$on('menu-click',(name, item)=>{
|
|
130
|
+
this.menuClick(name, item)
|
|
113
131
|
})
|
|
114
132
|
Bus.$on('tag-list',(data,current)=>{
|
|
115
133
|
this.changeTabs(data,current)
|
|
@@ -123,15 +141,13 @@ export default {
|
|
|
123
141
|
Bus.$off('tag-list')
|
|
124
142
|
},
|
|
125
143
|
initEmit(){
|
|
126
|
-
|
|
127
|
-
Bus.$emit('system-name-change',this.systemInfo.systemName)
|
|
128
|
-
}
|
|
144
|
+
Bus.$emit('system-info',this.systemInfo)
|
|
129
145
|
Bus.$emit('user-info',this.userInfo)
|
|
130
146
|
Bus.$emit('nav-list',this.navList)
|
|
131
147
|
Bus.$emit('menu-list',this.menuList)
|
|
132
148
|
},
|
|
133
149
|
initTags(){
|
|
134
|
-
let tagList = getTagNavListFromLocalstorage();
|
|
150
|
+
let tagList = getTagNavListFromLocalstorage(config.routerBase + '-tagNavList');
|
|
135
151
|
if (tagList.length == 0) {
|
|
136
152
|
tagList.push(this.homeRouter);
|
|
137
153
|
}
|
|
@@ -155,10 +171,15 @@ export default {
|
|
|
155
171
|
userAction(name){
|
|
156
172
|
this.$emit('user-action',name)
|
|
157
173
|
},
|
|
158
|
-
menuClick(name){
|
|
159
|
-
|
|
174
|
+
menuClick(name, item){
|
|
175
|
+
if (!item) {
|
|
176
|
+
let res = this.menuList.filter(item => item.name == name);
|
|
177
|
+
if (res && res.length > 0) {
|
|
178
|
+
item = res[0];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
160
181
|
sessionStorage.setItem('activeName',name);
|
|
161
|
-
this.$emit('menu-click', name,
|
|
182
|
+
this.$emit('menu-click', name, item)
|
|
162
183
|
},
|
|
163
184
|
changeTabs(data,current){
|
|
164
185
|
this.$emit('change-tabs',data,current)
|
|
@@ -176,9 +197,17 @@ export default {
|
|
|
176
197
|
} else {
|
|
177
198
|
name = menu.name;
|
|
178
199
|
menuItem = deepCopy(menu);
|
|
179
|
-
let tagList = getTagNavListFromLocalstorage();
|
|
200
|
+
let tagList = getTagNavListFromLocalstorage(config.routerBase + '-tagNavList');
|
|
180
201
|
if (!tagExists(tagList,name)) {
|
|
181
202
|
tagList.push(menuItem);
|
|
203
|
+
} else {
|
|
204
|
+
let tag = tagList.filter(item => item.name == name)[0];
|
|
205
|
+
if (!routeEqual(tag,menuItem)) {
|
|
206
|
+
let res = tagList.filter(item => item.name !== name);
|
|
207
|
+
tag = Object.assign(tag, menu);
|
|
208
|
+
res.push(tag);
|
|
209
|
+
tagList = deepCopy(res);
|
|
210
|
+
}
|
|
182
211
|
}
|
|
183
212
|
Bus.$emit('tag-list', tagList, name)
|
|
184
213
|
}
|
|
@@ -196,7 +225,8 @@ export default {
|
|
|
196
225
|
}
|
|
197
226
|
</script>
|
|
198
227
|
|
|
199
|
-
<style
|
|
228
|
+
<style lang="less">
|
|
229
|
+
@import "@lambo-design/core/src/styles/default";
|
|
200
230
|
.pro-layout{
|
|
201
231
|
color: #ffffff;
|
|
202
232
|
height: 100vh;
|
|
@@ -207,19 +237,61 @@ export default {
|
|
|
207
237
|
}
|
|
208
238
|
.pro-layout-sider{
|
|
209
239
|
overflow: hidden;
|
|
210
|
-
|
|
211
|
-
height:
|
|
240
|
+
.ivu-layout-sider-children{
|
|
241
|
+
height: calc(100vh - 65px);
|
|
212
242
|
overflow-y: scroll;
|
|
213
243
|
margin-right: -18px;
|
|
214
244
|
}
|
|
215
245
|
}
|
|
216
246
|
.pro-layout-content{
|
|
217
247
|
.pro-layout-content-layout{
|
|
218
|
-
height: ~"calc(100vh -
|
|
248
|
+
height: ~"calc(100vh - 53px)";
|
|
219
249
|
.pro-layout-page{
|
|
220
250
|
overflow: hidden;
|
|
251
|
+
color: var(--text-color,@_text-color);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
&.small {
|
|
256
|
+
.ivu-layout-header{
|
|
257
|
+
height: 50px;
|
|
258
|
+
line-height: 50px;
|
|
259
|
+
.pro-layout-header-wrapper{
|
|
260
|
+
height: 50px;
|
|
261
|
+
.trigger-box{
|
|
262
|
+
.sider-trigger-a{
|
|
263
|
+
margin-top: 5px;
|
|
264
|
+
width: 64px;
|
|
265
|
+
height: 50px;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
.logo-box{
|
|
269
|
+
.pro-layout-logo-wrapper{
|
|
270
|
+
.logo{
|
|
271
|
+
height: 45px;
|
|
272
|
+
margin-top: 14px;
|
|
273
|
+
}
|
|
274
|
+
.divider{
|
|
275
|
+
height: 26px;
|
|
276
|
+
margin: 12px;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
.nav-box{
|
|
281
|
+
.pro-layout-nav-wrapper{
|
|
282
|
+
.ivu-menu-horizontal{
|
|
283
|
+
height: 46px;
|
|
284
|
+
line-height: 46px;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
.pro-layout-sider{
|
|
291
|
+
.ivu-layout-sider-children{
|
|
292
|
+
height: calc(100vh - 50px);
|
|
221
293
|
}
|
|
222
294
|
}
|
|
223
295
|
}
|
|
224
296
|
}
|
|
225
|
-
</style>
|
|
297
|
+
</style>
|
|
Binary file
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
@import "@lambo-design/core/src/styles/default.less";
|
|
2
|
+
|
|
3
|
+
.other-menu {
|
|
4
|
+
width: 100%;
|
|
5
|
+
border-top: 3px solid @_layout-sider-background;
|
|
6
|
+
position: absolute;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
z-index: 1000;
|
|
9
|
+
background: @_layout-sider-background;
|
|
10
|
+
|
|
11
|
+
&.other-menu-collapsed {
|
|
12
|
+
.other-menu-item {
|
|
13
|
+
border-top: 2px solid #000000;
|
|
14
|
+
width: 100%;
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
color: #ffffff;
|
|
18
|
+
background: #061629;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ivu-tooltip {
|
|
22
|
+
width: 100%;
|
|
23
|
+
|
|
24
|
+
.ivu-tooltip-rel {
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ivu-tooltip-popper .ivu-tooltip-content {
|
|
29
|
+
.ivu-tooltip-arrow {
|
|
30
|
+
border-right-color: #fff;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ivu-tooltip-inner {
|
|
34
|
+
background: #fff;
|
|
35
|
+
color: #495060;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.other-menu-icon {
|
|
41
|
+
font-size: 20px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.other-menu-title {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
.other-menu-item {
|
|
53
|
+
color: #F0F0F0;
|
|
54
|
+
text-align: center;
|
|
55
|
+
line-height: 50px;
|
|
56
|
+
height: 50px;
|
|
57
|
+
width: 100px;
|
|
58
|
+
display: inline-block;
|
|
59
|
+
border-right: 2px solid #000000;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
border-radius: 3px;
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
color: #ffffff;
|
|
65
|
+
background: var(--primary-color,@_primary-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
.other-menu-drawer-wrap {
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
.ivu-drawer {
|
|
76
|
+
left: 256px;
|
|
77
|
+
height: calc(100% - 110px);
|
|
78
|
+
bottom: 0;
|
|
79
|
+
top: auto;
|
|
80
|
+
|
|
81
|
+
.other-menu-history {
|
|
82
|
+
|
|
83
|
+
.other-menu-history-item {
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 35px;
|
|
86
|
+
line-height: 35px;
|
|
87
|
+
position: relative;
|
|
88
|
+
|
|
89
|
+
.delete {
|
|
90
|
+
display: none;
|
|
91
|
+
position: absolute;
|
|
92
|
+
right: 15px;
|
|
93
|
+
top: 0px;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
.content {
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
height: 38px;
|
|
101
|
+
font-weight: bold;
|
|
102
|
+
color: var(--primary-color,@_primary-color);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.delete {
|
|
106
|
+
display: inline;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.other-menu-collect {
|
|
113
|
+
.other-menu-collect-item {
|
|
114
|
+
display: inline-block;
|
|
115
|
+
margin: 8px;
|
|
116
|
+
position: relative;
|
|
117
|
+
|
|
118
|
+
.delete {
|
|
119
|
+
display: none;
|
|
120
|
+
position: absolute;
|
|
121
|
+
right: -5px;
|
|
122
|
+
top: -5px;
|
|
123
|
+
z-index: 100;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:hover {
|
|
128
|
+
.content {
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
color: var(--primary-color,@_primary-color);
|
|
131
|
+
|
|
132
|
+
.ivu-tooltip {
|
|
133
|
+
.ivu-tooltip-rel {
|
|
134
|
+
.ivu-icon {
|
|
135
|
+
font-size: 43px;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.delete {
|
|
142
|
+
display: inline;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.other-menu-drawer-wrap-collapsed {
|
|
155
|
+
.ivu-drawer {
|
|
156
|
+
left: 65px;
|
|
157
|
+
height: calc(100% - 110px);
|
|
158
|
+
bottom: 0;
|
|
159
|
+
top: auto;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
File without changes
|