@lambo-design/pro-layout 1.0.0-beta.6 → 1.0.0-beta.60

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 CHANGED
@@ -1,18 +1,17 @@
1
- {
2
- "name": "@lambo-design/pro-layout",
3
- "version": "1.0.0-beta.6",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
-
8
- },
9
- "author": "lambo",
10
- "license": "ISC",
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "devDependencies": {
15
- "@lambo-design/core": "workspace:*",
16
- "@lambo-design/shared": "workspace:*"
17
- }
18
- }
1
+ {
2
+ "name": "@lambo-design/pro-layout",
3
+ "version": "1.0.0-beta.60",
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,5 +1,5 @@
1
1
  <template>
2
- <div class="pro-layout-header">
2
+ <div class="pro-layout-header-wrapper">
3
3
  <div class="trigger-box">
4
4
  <LamboProTrigger></LamboProTrigger>
5
5
  </div>
@@ -32,13 +32,12 @@ export default {
32
32
  </script>
33
33
 
34
34
  <style scoped lang="less">
35
- .pro-layout-header{
35
+ .pro-layout-header-wrapper{
36
36
  width: auto;
37
37
  height: 64px;
38
38
  .trigger-box{
39
39
  float: left;
40
40
  height: inherit;
41
- border: 1px solid #000000;
42
41
  }
43
42
  .logo-box{
44
43
  float: left;
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="pro-layout-logo">
3
- <div class="logo"></div>
2
+ <div class="pro-layout-logo-wrapper">
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-name-change',(data)=>{
21
- this.systemNameChange(data)
29
+ Bus.$on('system-info',(data)=>{
30
+ this.initSystem(data)
22
31
  });
23
32
  },
24
33
  destroyListener(){
25
- Bus.$off('system-name-change')
34
+ Bus.$off('system-info')
26
35
  },
27
- systemNameChange(data){
28
- this.systemName = data;
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(){
@@ -38,17 +52,15 @@ export default {
38
52
  </script>
39
53
 
40
54
  <style scoped lang="less">
41
- .pro-layout-logo{
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/logo.png") no-repeat;
60
+ background: url("../styles/images/inspur.png") no-repeat;
48
61
  background-size: 100%;
49
62
  float: left;
50
- margin-top: 8px;
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>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pro-layout-nav">
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
5
  {{item.name}}
@@ -104,7 +104,7 @@ export default {
104
104
 
105
105
  <style scoped lang="less">
106
106
  @import '@lambo-design/core/src/styles/default.less';
107
- .pro-layout-nav{
107
+ .pro-layout-nav-wrapper{
108
108
  .ivu-menu{
109
109
  .ivu-menu-item{
110
110
  &:hover{
@@ -147,4 +147,4 @@ export default {
147
147
  }
148
148
  }
149
149
 
150
- </style>
150
+ </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="!hideTitle" @on-click="handleClick">
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{
@@ -7,18 +7,22 @@
7
7
  <template v-for="item in children">
8
8
  <template v-if="item.children && item.children.length === 1">
9
9
  <ProLayoutSiderMenuItem v-if="showChildren(item)" :key="`menu-${item.name}`"
10
- :parent-item="item">
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="favorites[item.children[0].name] ? 'ios-star' : 'ios-star-outline'"
14
+ @click="toggleFavorite(item.children[0].name, item.children[0].appId, item.children[0].permissionId)"></Icon>
13
15
  <ProLayoutSiderIcon :icon-type="item.meta.icon"></ProLayoutSiderIcon>
14
16
  <span>{{ showTitle(item.children[0]) }}</span>
15
17
  </menu-item>
16
18
  </template>
17
19
  <template v-else>
18
20
  <ProLayoutSiderMenuItem v-if="showChildren(item)" :key="`menu-${item.name}`"
19
- :parent-item="item">
21
+ :parent-item="item">
20
22
  </ProLayoutSiderMenuItem>
21
23
  <menu-item v-else :key="`menu-${item.name}`" :name="getNameOrHref(item)">
24
+ <Icon :type="favorites[item.name] ? 'ios-star' : 'ios-star-outline'"
25
+ @click="toggleFavorite(item.name, item.appId, item.permissionId)"></Icon>
22
26
  <ProLayoutSiderIcon :icon-type="item.meta.icon"></ProLayoutSiderIcon>
23
27
  <span>{{ showTitle(item) }}</span>
24
28
  </menu-item>
@@ -26,12 +30,53 @@
26
30
  </template>
27
31
  </Submenu>
28
32
  </template>
33
+
29
34
  <script>
30
- import sider from '../utils/sider'
31
- import menuItem from '../utils/menuItem'
35
+ import ajax from '@lambo-design/shared/utils/ajax';
36
+ import sider from '../utils/sider';
37
+ import menuItem from '../utils/menuItem';
38
+ import config from "@lambo-design/shared/config/config";
32
39
 
33
40
  export default {
34
41
  name: 'ProLayoutSiderMenuItem',
35
42
  mixins: [sider, menuItem],
43
+ data() {
44
+ return {
45
+ favorites: {}
46
+ };
47
+ },
48
+ created() {
49
+ const self = this;
50
+ ajax.get(config.upmsServerContext + "/manage/upmsMenuCollect/list").then(function (resp) {
51
+ if (resp.data.code == 1) {
52
+ self.favorites = resp.data.favorites;
53
+ console.log("resp: ", resp)
54
+ } else {
55
+ self.$Message.error('获取收藏菜单失败,请联系系统管理员');
56
+ }
57
+ }).catch(function (err) {
58
+ self.$Message.error('获取收藏菜单失败,请联系系统管理员');
59
+ });
60
+ },
61
+ methods: {
62
+ toggleFavorite(menuName, appId, permissionId) {
63
+ this.$set(this.favorites, menuName, !this.favorites[menuName]);
64
+ const params = {
65
+ appId: appId,
66
+ permissionId: permissionId,
67
+ isFavored: this.favorites[menuName]
68
+ };
69
+ ajax.post(config.upmsServerContext + "/manage/upmsMenuCollect/add", params).then(resp => {
70
+ if (resp.data.code == 1) {
71
+ this.$Message.success('收藏操作成功');
72
+ } else {
73
+ this.$Message.error('收藏操作失败,请联系系统管理员');
74
+ }
75
+ }).catch(err => {
76
+ this.$Message.error('收藏操作失败,请联系系统管理员');
77
+ });
78
+ },
79
+ // ...其他方法...
80
+ }
36
81
  }
37
82
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pro-layout-sider">
2
+ <div class="pro-layout-sider-wrapper">
3
3
  <Menu v-show="!collapsed" ref="menu"
4
4
  :accordion="accordion" :active-name="activeName"
5
5
  :open-names="openedNames" theme="dark"
@@ -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
 
@@ -153,7 +153,6 @@ export default {
153
153
  }
154
154
  Bus.$emit('tag-list', tagList, menu.name)
155
155
  }
156
- //Bus.$emit('menu-click', name)
157
156
  },
158
157
  triggerChange(data){
159
158
  this.collapsed = data;
@@ -163,7 +162,20 @@ export default {
163
162
  this.value = name;
164
163
  },
165
164
  menuClick(current) {
166
- this.activeName = current;
165
+ let item = this.originMenuList.filter(menu => menu.name === current);
166
+ if (item && item.length > 0){
167
+ let type = item[0].type;
168
+ if (type == 2) {
169
+ this.activeName = current;
170
+ } else {
171
+ let pItem = this.originMenuList.filter(menu => menu.permissionId === item[0].pid);
172
+ if (pItem && pItem.length > 0){
173
+ this.activeName = pItem[0].name;
174
+ }
175
+ }
176
+ } else {
177
+ this.activeName = current;
178
+ }
167
179
  },
168
180
  getOpenedNamesByActiveName(){
169
181
  let res = filterMenuName(this.menuList,this.activeName);
@@ -204,10 +216,7 @@ export default {
204
216
 
205
217
  <style scoped lang="less">
206
218
  @import "@lambo-design/core/src/styles/default";
207
- .pro-layout-sider{
208
- overflow-y: scroll;
209
- overflow-x: hidden;
210
- margin-right: -18px;
219
+ .pro-layout-sider-wrapper{
211
220
  /deep/.ivu-menu-submenu{
212
221
  .ivu-menu{
213
222
  background: #1A1A1A;
@@ -228,4 +237,4 @@ export default {
228
237
  }
229
238
  }
230
239
  }
231
- </style>
240
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pro-layout-tabs">
2
+ <div class="pro-layout-tabs-wrapper">
3
3
  <div class="close-con">
4
4
  <Dropdown transfer @on-click="handleTagsOption">
5
5
  <Icon :size="24" type="ios-close-circle-outline" class="btn-close"/>
@@ -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
- setTagNavListInLocalstorage(data);
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 - 114
260
+ this.contextMenuTop = e.clientY - 54
242
261
  },
243
262
  closeMenu() {
244
263
  this.visible = false
@@ -278,13 +297,13 @@ export default {
278
297
  user-select: none;
279
298
  }
280
299
 
281
- .pro-layout-tabs {
300
+ .pro-layout-tabs-wrapper {
282
301
  position: relative;
283
302
  border-top: 1px solid #F0F0F0;
284
303
  border-bottom: 1px solid #F0F0F0;
285
304
  width: 100%;
286
- height: 50px;
287
- line-height: 38px;
305
+ height: 46px;
306
+ line-height: 42px;
288
307
  color: var(--text-color, @_text-color);
289
308
  .no-select;
290
309
 
@@ -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">&nbsp;{{item.value}}</DropdownItem>
7
+ <DropdownItem v-for="item in userInfo.dropList" :name="item.name" :key="item.name">&nbsp;{{item.value}}</DropdownItem>
8
8
  </DropdownMenu>
9
9
  </Dropdown>
10
10
  </div>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pro-layout-tools">
2
+ <div class="pro-layout-tools-wrapper">
3
3
  <LamboProLayoutToolsUser></LamboProLayoutToolsUser>
4
4
  </div>
5
5
  </template>
@@ -15,7 +15,7 @@ export default {
15
15
  </script>
16
16
 
17
17
  <style scoped lang="less">
18
- .pro-layout-tools{
18
+ .pro-layout-tools-wrapper{
19
19
  margin-right: 15px;
20
20
  }
21
21
  </style>
@@ -26,7 +26,7 @@ export default {
26
26
  .trans{
27
27
  transition: transform .2s ease;
28
28
  }
29
- @size: 40px;
29
+ @size: 64px;
30
30
  .sider-trigger-a{
31
31
  float: left;
32
32
  padding: 6px;
package/src/index.vue CHANGED
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <i-layout class="pro-layout">
3
- <i-header>
2
+ <i-layout class="pro-layout" :class="layoutClass">
3
+ <i-header class="pro-layout-header">
4
4
  <LamboProLayoutHeader></LamboProLayoutHeader>
5
5
  </i-header>
6
6
  <i-layout>
@@ -8,7 +8,7 @@
8
8
  class="pro-layout-sider"
9
9
  hide-trigger
10
10
  collapsible
11
- :width="256"
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
- if (this.systemInfo && this.systemInfo.systemName) {
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
- let res = this.menuList.filter(item => item.name == name);
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, res[0])
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 scoped lang="less">
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,15 +237,61 @@ export default {
207
237
  }
208
238
  .pro-layout-sider{
209
239
  overflow: hidden;
240
+ .ivu-layout-sider-children{
241
+ height: calc(100vh - 65px);
242
+ overflow-y: scroll;
243
+ margin-right: -18px;
244
+ }
210
245
  }
211
246
  .pro-layout-content{
212
247
  .pro-layout-content-layout{
213
- height: ~"calc(100vh - 65px)";
248
+ height: ~"calc(100vh - 53px)";
214
249
  .pro-layout-page{
215
- height: ~"calc(100vh - 115px)";
216
- overflow: auto;
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);
217
293
  }
218
294
  }
219
295
  }
220
296
  }
221
- </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