@lambo-design/pro-layout 1.0.0-beta.2 → 1.0.0-beta.20

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.2",
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.20",
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
+ "dependencies": {
13
+ "@lambo-design/core": "4.7.1-beta.35",
14
+ "@lambo-design/shared": "1.0.0-beta.15"
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,9 +52,8 @@ 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;
@@ -48,7 +61,6 @@ export default {
48
61
  background-size: 100%;
49
62
  float: left;
50
63
  margin-top: 8px;
51
- border-bottom: 1px solid #000000;
52
64
  }
53
65
  .divider{
54
66
  height: 33px;
@@ -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{
@@ -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">
4
- <a :style="{textAlign: !hideTitle ? 'left' : ''}" class="drop-menu-a" type="text"
3
+ :transfer="true" @on-click="handleClick">
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
- <Icon v-if="!hideTitle" :size="20" style="float: right;" type="ios-arrow-forward"/>
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,26 +69,23 @@ 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);
75
76
  }
76
- a.drop-menu-a{
77
- display: inline-block;
78
- width: 100%;
79
- font-weight: normal;
80
- color: var(--text-color, @_text-color);
81
- &:hover{
82
- color: var(--heading-color, @_heading-color);
77
+ /deep/.ivu-dropdown-rel{
78
+ a.drop-menu-a{
79
+ display: inline-block;
80
+ width: 100%;
81
+ font-weight: normal;
82
+ margin-left: -5px;
83
+ color: var(--text-color, @_text-color) !important;
84
+ text-decoration: none;
85
+ &:hover{
86
+ color: var(--heading-color, @_heading-color) !important;
87
+ }
83
88
  }
84
89
  }
85
90
  }
86
- </style>
87
- <style lang="less">
88
- .ivu-select-dropdown {
89
- &.ivu-dropdown-transfer {
90
- max-height: 400px;
91
- max-width: 150px;
92
- }
93
- }
94
91
  </style>
@@ -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;
@@ -204,7 +203,7 @@ export default {
204
203
 
205
204
  <style scoped lang="less">
206
205
  @import "@lambo-design/core/src/styles/default";
207
- .pro-layout-sider{
206
+ .pro-layout-sider-wrapper{
208
207
  /deep/.ivu-menu-submenu{
209
208
  .ivu-menu{
210
209
  background: #1A1A1A;
@@ -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"/>
@@ -105,7 +105,7 @@ export default {
105
105
  this.originMenuList = deepCopy(data);
106
106
  },
107
107
  initTags(data,current){
108
- setTagNavListInLocalstorage(data);
108
+ setTagNavListInLocalstorage(data, config.routerBase + '-tagNavList');
109
109
  this.tagList = data;
110
110
  if (current !== this.value) {
111
111
  this.value = current;
@@ -186,7 +186,7 @@ export default {
186
186
  },
187
187
  handleClick(item) {
188
188
  this.value = item.name
189
- Bus.$emit('menu-click', item.name)
189
+ Bus.$emit('menu-click', item.name , item)
190
190
  if (item.meta && item.meta.appId
191
191
  && item.meta.appId != this.appId
192
192
  && item.meta.appId != config.homeRouter.meta.appId) {
@@ -238,7 +238,7 @@ export default {
238
238
  this.visible = true
239
239
  const offsetLeft = this.$el.getBoundingClientRect().left
240
240
  this.contextMenuLeft = e.clientX - offsetLeft + 10
241
- this.contextMenuTop = e.clientY - 114
241
+ this.contextMenuTop = e.clientY - 54
242
242
  },
243
243
  closeMenu() {
244
244
  this.visible = false
@@ -278,13 +278,13 @@ export default {
278
278
  user-select: none;
279
279
  }
280
280
 
281
- .pro-layout-tabs {
281
+ .pro-layout-tabs-wrapper {
282
282
  position: relative;
283
283
  border-top: 1px solid #F0F0F0;
284
284
  border-bottom: 1px solid #F0F0F0;
285
285
  width: 100%;
286
- height: 50px;
287
- line-height: 38px;
286
+ height: 46px;
287
+ line-height: 42px;
288
288
  color: var(--text-color, @_text-color);
289
289
  .no-select;
290
290
 
@@ -368,6 +368,7 @@ export default {
368
368
  margin: 0;
369
369
  padding: 5px 15px;
370
370
  cursor: pointer;
371
+ line-height: 18px;
371
372
 
372
373
  &:hover {
373
374
  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>
package/src/index.vue CHANGED
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <i-layout class="pro-layout">
3
- <i-header>
3
+ <i-header class="pro-layout-header">
4
4
  <LamboProLayoutHeader></LamboProLayoutHeader>
5
5
  </i-header>
6
6
  <i-layout>
7
7
  <i-sider
8
+ class="pro-layout-sider"
8
9
  hide-trigger
9
10
  collapsible
10
11
  :width="256"
@@ -13,7 +14,7 @@
13
14
  <LamboProLayoutSider ref="sider"></LamboProLayoutSider>
14
15
  </i-sider>
15
16
  <i-content class="pro-layout-content">
16
- <i-layout>
17
+ <i-layout class="pro-layout-content-layout">
17
18
  <div class="pro-layout-tabs">
18
19
  <LamboProLayoutTabs></LamboProLayoutTabs>
19
20
  </div>
@@ -34,7 +35,7 @@ import LamboProLayoutTabs from './components/pro-layout-tabs'
34
35
  import Bus from '@lambo-design/shared/utils/bus'
35
36
  import config from "@lambo-design/shared/config/config";
36
37
  import {
37
- getTagNavListFromLocalstorage, tagExists,
38
+ getTagNavListFromLocalstorage, routeEqual, tagExists,
38
39
  } from "@lambo-design/shared/utils/platform";
39
40
  import {deepCopy} from "@lambo-design/shared/utils/assist";
40
41
  export default {
@@ -107,8 +108,8 @@ export default {
107
108
  Bus.$on('user-action', (name)=> {
108
109
  this.userAction(name)
109
110
  })
110
- Bus.$on('menu-click',(name)=>{
111
- this.menuClick(name)
111
+ Bus.$on('menu-click',(name, item)=>{
112
+ this.menuClick(name, item)
112
113
  })
113
114
  Bus.$on('tag-list',(data,current)=>{
114
115
  this.changeTabs(data,current)
@@ -122,15 +123,13 @@ export default {
122
123
  Bus.$off('tag-list')
123
124
  },
124
125
  initEmit(){
125
- if (this.systemInfo && this.systemInfo.systemName) {
126
- Bus.$emit('system-name-change',this.systemInfo.systemName)
127
- }
126
+ Bus.$emit('system-info',this.systemInfo)
128
127
  Bus.$emit('user-info',this.userInfo)
129
128
  Bus.$emit('nav-list',this.navList)
130
129
  Bus.$emit('menu-list',this.menuList)
131
130
  },
132
131
  initTags(){
133
- let tagList = getTagNavListFromLocalstorage();
132
+ let tagList = getTagNavListFromLocalstorage(config.routerBase + '-tagNavList');
134
133
  if (tagList.length == 0) {
135
134
  tagList.push(this.homeRouter);
136
135
  }
@@ -154,10 +153,15 @@ export default {
154
153
  userAction(name){
155
154
  this.$emit('user-action',name)
156
155
  },
157
- menuClick(name){
158
- let res = this.menuList.filter(item => item.name == name);
156
+ menuClick(name, item){
157
+ if (!item) {
158
+ let res = this.menuList.filter(item => item.name == name);
159
+ if (res && res.length > 0) {
160
+ item = res[0];
161
+ }
162
+ }
159
163
  sessionStorage.setItem('activeName',name);
160
- this.$emit('menu-click', name, res[0])
164
+ this.$emit('menu-click', name, item)
161
165
  },
162
166
  changeTabs(data,current){
163
167
  this.$emit('change-tabs',data,current)
@@ -175,9 +179,17 @@ export default {
175
179
  } else {
176
180
  name = menu.name;
177
181
  menuItem = deepCopy(menu);
178
- let tagList = getTagNavListFromLocalstorage();
182
+ let tagList = getTagNavListFromLocalstorage(config.routerBase + '-tagNavList');
179
183
  if (!tagExists(tagList,name)) {
180
184
  tagList.push(menuItem);
185
+ } else {
186
+ let tag = tagList.filter(item => item.name == name)[0];
187
+ if (!routeEqual(tag,menuItem)) {
188
+ let res = tagList.filter(item => item.name !== name);
189
+ tag = Object.assign(tag, menu);
190
+ res.push(tag);
191
+ tagList = deepCopy(res);
192
+ }
181
193
  }
182
194
  Bus.$emit('tag-list', tagList, name)
183
195
  }
@@ -196,12 +208,31 @@ export default {
196
208
  </script>
197
209
 
198
210
  <style scoped lang="less">
211
+ @import "@lambo-design/core/src/styles/default";
199
212
  .pro-layout{
200
213
  color: #ffffff;
201
- min-width: 1100px;
202
- min-height: 600px;
214
+ height: 100vh;
215
+ width: 100%;
216
+ overflow: hidden;
203
217
  .ivu-layout-header{
204
218
  padding: 0;
205
219
  }
220
+ .pro-layout-sider{
221
+ overflow: hidden;
222
+ /deep/.ivu-layout-sider-children{
223
+ height: ~"calc(100vh - 65px)";
224
+ overflow-y: scroll;
225
+ margin-right: -18px;
226
+ }
227
+ }
228
+ .pro-layout-content{
229
+ .pro-layout-content-layout{
230
+ height: ~"calc(100vh - 65px)";
231
+ .pro-layout-page{
232
+ overflow: hidden;
233
+ color: var(--text-color,@_text-color);
234
+ }
235
+ }
236
+ }
206
237
  }
207
238
  </style>
@@ -1,92 +0,0 @@
1
- .pro-layout{
2
- .logo-con{
3
- height: 64px;
4
- padding: 10px;
5
- background-color: #1890ff;
6
- position: sticky;
7
- top: 0px;
8
- z-index: 1000;
9
- img{
10
- height: 44px;
11
- width: 44px;
12
- margin-left: 15px;
13
- float: left;
14
- }
15
- .system-title{
16
- float: left;
17
- font-weight: bolder;
18
- font-size: 30px;
19
- margin-right: 20px;
20
- color: #ffffff;
21
- }
22
- }
23
- .header-con{
24
- background: #1890ff;
25
- color: #ffffff;
26
- padding: 0 0px;
27
- width: 100%;
28
- }
29
- .main-layout-con{
30
- height: 100%;
31
- overflow: hidden;
32
- }
33
- .main-content-con{
34
- height: ~"calc(100% - 60px)";
35
- overflow: hidden;
36
- }
37
- //tab框样式
38
- .tags-nav .scroll-outer {
39
- background: #f5f7f9;
40
- box-shadow: 0px 0 3px 2px #f5f7f9 inset
41
- }
42
- .tag-nav-wrapper{
43
- padding: 0;
44
- height:40px;
45
- background:#F0F0F0;
46
- }
47
- .content-wrapper{
48
- height: ~"calc(100% - 80px)";
49
- background: #ffffff;
50
- }
51
- .left-sider{
52
- background: #f5f7f9;
53
- .ivu-layout-sider-children{
54
- overflow-y: scroll;
55
- margin-right: -18px;
56
- }
57
- }
58
- }
59
- .ivu-menu-item > i{
60
- margin-right: 12px !important;
61
- }
62
- .ivu-menu-submenu > .ivu-menu > .ivu-menu-item > i {
63
- margin-right: 8px !important;
64
- }
65
- .collased-menu-dropdown{
66
- width: 100%;
67
- margin: 0;
68
- line-height: normal;
69
- padding: 7px 0 6px 16px;
70
- clear: both;
71
- font-size: 12px !important;
72
- white-space: nowrap;
73
- list-style: none;
74
- cursor: pointer;
75
- transition: background 0.2s ease-in-out;
76
- &:hover{
77
- background: rgba(100, 100, 100, 0.1);
78
- }
79
- & * {
80
- color: #515a6e;
81
- }
82
- .ivu-menu-item > i{
83
- margin-right: 12px !important;
84
- }
85
- .ivu-menu-submenu > .ivu-menu > .ivu-menu-item > i {
86
- margin-right: 8px !important;
87
- }
88
- }
89
-
90
- .ivu-select-dropdown.ivu-dropdown-transfer{
91
- max-height: 400px;
92
- }