@lambo-design/pro-layout 1.0.0-beta.13 → 1.0.0-beta.131

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,17 +1,17 @@
1
- {
2
- "name": "@lambo-design/pro-layout",
3
- "version": "1.0.0-beta.13",
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/shared": "1.0.0-beta.10",
14
- "@lambo-design/core": "4.7.1-beta.34"
15
- },
16
- "scripts": {}
17
- }
1
+ {
2
+ "name": "@lambo-design/pro-layout",
3
+ "version": "1.0.0-beta.131",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {},
7
+ "author": "lambo",
8
+ "license": "ISC",
9
+ "publishConfig": {
10
+ "access": "public",
11
+ "registry": "https://registry.npmjs.org/"
12
+ },
13
+ "devDependencies": {
14
+ "@lambo-design/core": "workspace:^",
15
+ "@lambo-design/shared": "workspace:^"
16
+ }
17
+ }
@@ -4,10 +4,10 @@
4
4
  <LamboProTrigger></LamboProTrigger>
5
5
  </div>
6
6
  <div class="logo-box">
7
- <LamboProLogo></LamboProLogo>
7
+ <LamboProLogo @clickLogo="handleClick"></LamboProLogo>
8
8
  </div>
9
9
  <div class="nav-box">
10
- <LamboProNav></LamboProNav>
10
+ <LamboProNav :accept-app-id="acceptAppId"></LamboProNav>
11
11
  </div>
12
12
  <div class="tools-box">
13
13
  <LamboProTools></LamboProTools>
@@ -22,11 +22,22 @@ import LamboProNav from './pro-layout-nav'
22
22
  import LamboProTools from './pro-layout-tools'
23
23
  export default {
24
24
  name: "pro-layout-header",
25
+ props:{
26
+ acceptAppId: {
27
+ type: String,
28
+ default:''
29
+ }
30
+ },
25
31
  components: {
26
32
  LamboProTrigger,
27
33
  LamboProLogo,
28
34
  LamboProNav,
29
35
  LamboProTools
36
+ },
37
+ methods:{
38
+ handleClick(){
39
+ this.$emit('clickLogo')
40
+ }
30
41
  }
31
42
  }
32
43
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="pro-layout-logo-wrapper">
3
- <div class="logo"></div>
2
+ <div class="pro-layout-logo-wrapper" @click="handleClick">
3
+ <div class="logo" :style="logoStyle"></div>
4
4
  <div class="divider"></div>
5
5
  <div class="system-name">{{systemName}}</div>
6
6
  </div>
@@ -10,22 +10,44 @@
10
10
  import Bus from '@lambo-design/shared/utils/bus'
11
11
  export default {
12
12
  name: "pro-layout-logo",
13
+ props:{
14
+ routeName:String,
15
+ default:''
16
+ },
13
17
  data(){
14
18
  return {
15
- systemName: '后台管理系统'
19
+ systemInfo: {},
20
+ systemName: '后台管理系统',
21
+ isHovered: false,
22
+ }
23
+ },
24
+ computed:{
25
+ logoStyle(){
26
+ if (this.systemInfo && this.systemInfo.systemLogo) {
27
+ return 'background: url("' + this.systemInfo.systemLogo + '") no-repeat;background-size: 100%;'
28
+ }
29
+ return '';
16
30
  }
17
31
  },
18
32
  methods: {
33
+ handleClick(){
34
+ this.$emit('clickLogo')
35
+ },
19
36
  initListener(){
20
- Bus.$on('system-name-change',(data)=>{
21
- this.systemNameChange(data)
37
+ Bus.$on('system-info',(data)=>{
38
+ this.initSystem(data)
22
39
  });
23
40
  },
24
41
  destroyListener(){
25
- Bus.$off('system-name-change')
42
+ Bus.$off('system-info')
26
43
  },
27
- systemNameChange(data){
28
- this.systemName = data;
44
+ initSystem(data){
45
+ if (data) {
46
+ this.systemInfo = data;
47
+ if (data.systemName) {
48
+ this.systemName = data.systemName;
49
+ }
50
+ }
29
51
  }
30
52
  },
31
53
  created(){
@@ -40,14 +62,14 @@ export default {
40
62
  <style scoped lang="less">
41
63
  .pro-layout-logo-wrapper{
42
64
  overflow: hidden;
65
+ cursor:pointer;
43
66
  .logo{
44
67
  width: 150px;
45
68
  height: 55px;
46
- background: url("../styles/images/logo.png") no-repeat;
69
+ background: url("../styles/images/inspur.png") no-repeat;
47
70
  background-size: 100%;
48
71
  float: left;
49
- margin-top: 8px;
50
- border-bottom: 1px solid #000000;
72
+ margin-top: 20px;
51
73
  }
52
74
  .divider{
53
75
  height: 33px;
@@ -63,4 +85,4 @@ export default {
63
85
  margin-right: 15px;
64
86
  }
65
87
  }
66
- </style>
88
+ </style>
@@ -24,6 +24,12 @@ import config from "@lambo-design/shared/config/config";
24
24
 
25
25
  export default {
26
26
  name: "pro-layout-logo",
27
+ props:{
28
+ acceptAppId: {
29
+ type: String,
30
+ default: ''
31
+ }
32
+ },
27
33
  data(){
28
34
  return {
29
35
  navList : [],
@@ -65,6 +71,11 @@ export default {
65
71
  }
66
72
  if (this.topMenList.length > 0){
67
73
  let appId = this.topMenList[0].appId;
74
+ for (let i = 0; i < this.topMenList.length; i++) {
75
+ if (this.topMenList[i].selected == true){
76
+ appId = this.topMenList[i].appId;
77
+ }
78
+ }
68
79
  if (this.activeName) {
69
80
  appId = this.activeName;
70
81
  }
@@ -91,6 +102,9 @@ export default {
91
102
  this.$nextTick(()=>{
92
103
  this.$refs.topNav.updateActiveName();
93
104
  })
105
+ },
106
+ acceptAppId(val) {
107
+ this.selectApp(val)
94
108
  }
95
109
  },
96
110
  created(){
@@ -147,4 +161,4 @@ export default {
147
161
  }
148
162
  }
149
163
 
150
- </style>
164
+ </style>
@@ -0,0 +1,142 @@
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,index) in list" :key="index" class="other-menu-history-item">
30
+ <div class="content" @click="handleClick(item)">
31
+ <Icon :type="item.icon"></Icon>
32
+ <span> {{ item.label }}</span>
33
+ </div>
34
+ <div class="delete">
35
+ <Icon type="ios-close" @click.native="handleHistoryDelete(item)"></Icon>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ <div v-if="drawer.type=='collect'" class="other-menu-collect">
40
+ <div v-for="(item,index) in list" :key="index" class="other-menu-collect-item" @click="handleClick(item)">
41
+ <div class="content" @click="handleClick(item)">
42
+ <Icon :type="item.icon"></Icon>
43
+ <span> {{ item.label }}</span>
44
+ </div>
45
+ <div class="delete">
46
+ <Icon type="ios-close" @click.native.stop="handleCollectDelete(item)"></Icon>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </Drawer>
51
+ </div>
52
+ </template>
53
+
54
+ <script>
55
+ import ajax from '@lambo-design/shared/utils/ajax';
56
+ import config from "@lambo-design/shared/config/config";
57
+
58
+
59
+ export default {
60
+ name: "other-menu",
61
+ components: {},
62
+ props: {
63
+ collapsed: {
64
+ type: Boolean,
65
+ default:false
66
+ },
67
+ serverContext: {
68
+ type: String,
69
+ default: () => config.upmsServerContext // 设置默认值
70
+ }
71
+ },
72
+ data() {
73
+ return {
74
+ drawer: {
75
+ model: false,
76
+ url: '',
77
+ title: '',
78
+ type: '',
79
+ },
80
+ list: []
81
+ }
82
+ },
83
+ computed: {
84
+ classes() {
85
+ let classes = ["other-menu"]
86
+ return this.collapsed ? ["other-menu-collapsed", ...classes] : [...classes]
87
+ },
88
+ drawerClasses() {
89
+ return this.collapsed ? "other-menu-drawer-wrap-collapsed" : "other-menu-drawer-wrap"
90
+ }
91
+ },
92
+ methods: {
93
+ onChange(value) {
94
+ if (value == 'history') {
95
+ this.drawer.title = '历史菜单'
96
+ this.drawer.url = '/manage/upmsMenuHistory/list'
97
+ } else {
98
+ this.drawer.title = '收藏菜单'
99
+ this.drawer.url = '/manage/upmsMenuCollect/list'
100
+ }
101
+ this.getList()
102
+ this.drawer.type = value
103
+ this.drawer.model = !this.drawer.model
104
+ },
105
+ getList() {
106
+ this.list = []
107
+ ajax.get(this.serverContext + this.drawer.url).then(resp => {
108
+ if (resp.data.code == 1) {
109
+ this.list = resp.data.data
110
+ if (this.drawer.type == 'collect') {
111
+ this.$store.commit('setCollectMenuList', this.list)
112
+ }
113
+ }
114
+ })
115
+ },
116
+ handleClick(item) {
117
+ this.$emit('on-select', item.name)
118
+ this.drawer.model = false
119
+ },
120
+ handleHistoryDelete(item) {
121
+ ajax.get(this.serverContext + "/manage/upmsMenuHistory/delete/" + item.historyId).then(resp => {
122
+ if (resp.data.code == 1) {
123
+ this.getList()
124
+ }
125
+ })
126
+ },
127
+ handleCollectDelete(item) {
128
+ ajax.get(this.serverContext + "/manage/upmsMenuCollect/delete/" + item.collectId).then(resp => {
129
+ if (resp.data.code == 1) {
130
+ this.getList()
131
+ }
132
+ })
133
+ }
134
+ }
135
+ }
136
+ </script>
137
+
138
+
139
+ <style lang="less">
140
+ @import '../styles/other-menu.less';
141
+ @import "@lambo-design/core/src/styles/default.less";
142
+ </style>
@@ -2,23 +2,25 @@
2
2
  <Submenu v-show="isShow" :name="`${parentName}`">
3
3
  <template slot="title">
4
4
  <ProLayoutSiderIcon :icon-type="parentItem.meta.icon"></ProLayoutSiderIcon>
5
- <span>{{ showTitle(parentItem) }}</span>
5
+ <span style="color: red">{{ showTitle(parentItem) }}</span>
6
6
  </template>
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" :server-context="serverContext">
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>
16
17
  </template>
17
18
  <template v-else>
18
19
  <ProLayoutSiderMenuItem v-if="showChildren(item)" :key="`menu-${item.name}`"
19
- :parent-item="item">
20
+ :parent-item="item" :server-context="serverContext">
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,73 @@
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
+ props: {
41
+ serverContext: {
42
+ type: String,
43
+ default: () => config.upmsServerContext
44
+ }
45
+ },
46
+ data() {
47
+ return {
48
+ isCollected: {}, // 使用对象来记录每个子菜单的收藏状态
49
+ };
50
+ },
51
+ mounted() {
52
+ this.fetchCollectedMenus();
53
+ },
54
+ methods: {
55
+ fetchCollectedMenus() {
56
+ ajax.get(this.serverContext + "/manage/upmsMenuCollect/list").then(resp => {
57
+ const collectedMenus = resp.data.data;
58
+ if (Array.isArray(collectedMenus)) {
59
+ collectedMenus.forEach(menu => {
60
+ // 使用 menu 的 name 属性作为键
61
+ this.$set(this.isCollected, menu.name, true);
62
+ });
63
+ } else {
64
+ console.error("Expected an array but got:", typeof collectedMenus);
65
+ }
66
+ ;
67
+ }).catch(err => {
68
+ console.error("Error fetching collected menus:", err);
69
+ });
70
+ },
71
+ toggleCollect(item) {
72
+ const self = this;
73
+ let list = this.$store.state.app.originalPermissionList;
74
+
75
+ let item1 = list.find(item1 => item1.name == item.component);
76
+
77
+ const apiUrl = self.isCollected[item.name] ?
78
+ self.serverContext + "/manage/upmsMenuCollect/remove" :
79
+ self.serverContext + "/manage/upmsMenuCollect/add";
80
+
81
+ const data = {
82
+ appId: item1.appId,
83
+ permissionId: item1.permissionId
84
+ };
85
+ ajax.post(apiUrl, data).then(function(resp) {
86
+ if (resp.data.code == 1) {
87
+ // Use 'self' instead of 'this'
88
+ self.$set(self.isCollected, item.name, !self.isCollected[item.name]);
89
+ const message = self.isCollected[item.name] ? '收藏成功' : '取消收藏成功';
90
+ self.$Message.success(message);
91
+ } else {
92
+ const message = self.isCollected[item.name] ? '取消收藏失败' : '收藏失败';
93
+ self.$Message.error(message + ', 请联系系统管理员');
94
+ }
95
+ }).catch(function(err) {
96
+ console.error("收藏操作失败:", err);
97
+ self.$Message.error('操作失败, 请联系系统管理员');
98
+ });
99
+ }
100
+
101
+ }
36
102
  }
37
103
  </script>
@@ -8,7 +8,7 @@
8
8
  <template v-if="item.children && item.children.length === 1">
9
9
  <ProLayoutSiderMenuItem v-if="showChildren(item)"
10
10
  :key="`menu-${item.name}`"
11
- :parent-item="item">
11
+ :parent-item="item" :server-context="serverContext">
12
12
  </ProLayoutSiderMenuItem>
13
13
  <MenuItem v-else :key="`menu-${item.children[0].name}`"
14
14
  :name="getNameOrHref(item, true)">
@@ -18,7 +18,7 @@
18
18
  </template>
19
19
  <template v-else>
20
20
  <ProLayoutSiderMenuItem v-if="showChildren(item)" :key="`menu-${item.name}`"
21
- :parent-item="item">
21
+ :parent-item="item" :server-context="serverContext">
22
22
  </ProLayoutSiderMenuItem>
23
23
  <MenuItem v-else :key="`menu-${item.name}`"
24
24
  :name="getNameOrHref(item)">
@@ -28,6 +28,8 @@
28
28
  </template>
29
29
  </template>
30
30
  </Menu>
31
+ <ProLayoutOtherMenu @on-select="selectHandle" :server-context="serverContext"></ProLayoutOtherMenu>
32
+
31
33
  <div v-show="collapsed" :list="menuList" class="menu-collapsed">
32
34
  <template v-for="item in menuList">
33
35
  <ProLayoutSiderCollapsedMenu v-if="item.children && item.children.length > 1" :key="`drop-menu-${item.name}`"
@@ -51,19 +53,28 @@ import Bus from "@lambo-design/shared/utils/bus";
51
53
  import {deepCopy} from "@lambo-design/shared/utils/assist";
52
54
  import generatorMenuList from "@lambo-design/shared/utils/menu/index";
53
55
  import sider from '../utils/sider'
56
+ import ProLayoutOtherMenu from "./pro-layout-other-menu";
54
57
  import ProLayoutSiderMenuItem from './pro-layout-sider-menu-item'
55
58
  import ProLayoutSiderCollapsedMenu from './pro-layout-sider-collapsed-menu'
56
59
  import {
57
60
  filterMenuName,
58
- filterMenuUri,
61
+ filterMenuUri, routeEqual,
59
62
  tagExists
60
63
  } from "@lambo-design/shared/utils/platform";
64
+ import config from "@lambo-design/shared/config/config";
61
65
 
62
66
  export default {
63
67
  name: "pro-layout-sider",
64
68
  components: {
65
69
  ProLayoutSiderMenuItem,
66
- ProLayoutSiderCollapsedMenu
70
+ ProLayoutSiderCollapsedMenu,
71
+ ProLayoutOtherMenu
72
+ },
73
+ props:{
74
+ serverContext: {
75
+ type: String,
76
+ default: () => config.upmsServerContext // 设置默认值
77
+ }
67
78
  },
68
79
  data(){
69
80
  return {
@@ -125,6 +136,9 @@ export default {
125
136
  this.originMenuList = deepCopy(data);
126
137
  this.changeMenu()
127
138
  },
139
+ selectHandle(name){
140
+ this.$emit('on-select', name)
141
+ },
128
142
  changeApp(appId,appInfo){
129
143
  this.appId = appId;
130
144
  this.changeMenu()
@@ -153,7 +167,6 @@ export default {
153
167
  }
154
168
  Bus.$emit('tag-list', tagList, menu.name)
155
169
  }
156
- //Bus.$emit('menu-click', name)
157
170
  },
158
171
  triggerChange(data){
159
172
  this.collapsed = data;
@@ -163,7 +176,20 @@ export default {
163
176
  this.value = name;
164
177
  },
165
178
  menuClick(current) {
166
- this.activeName = current;
179
+ let item = this.originMenuList.filter(menu => menu.name === current);
180
+ if (item && item.length > 0){
181
+ let type = item[0].type;
182
+ if (type == 2) {
183
+ this.activeName = current;
184
+ } else {
185
+ let pItem = this.originMenuList.filter(menu => menu.permissionId === item[0].pid);
186
+ if (pItem && pItem.length > 0){
187
+ this.activeName = pItem[0].name;
188
+ }
189
+ }
190
+ } else {
191
+ this.activeName = current;
192
+ }
167
193
  },
168
194
  getOpenedNamesByActiveName(){
169
195
  let res = filterMenuName(this.menuList,this.activeName);
@@ -205,6 +231,7 @@ export default {
205
231
  <style scoped lang="less">
206
232
  @import "@lambo-design/core/src/styles/default";
207
233
  .pro-layout-sider-wrapper{
234
+ margin-bottom: 50px;
208
235
  /deep/.ivu-menu-submenu{
209
236
  .ivu-menu{
210
237
  background: #1A1A1A;
@@ -225,4 +252,4 @@ export default {
225
252
  }
226
253
  }
227
254
  }
228
- </style>
255
+ </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,6 +120,10 @@ export default {
105
120
  this.originMenuList = deepCopy(data);
106
121
  },
107
122
  initTags(data,current){
123
+ if (data.length > this.tabNum) {
124
+ let index = getDelTagIndex(data,current);
125
+ data.splice(index,1);
126
+ }
108
127
  setTagNavListInLocalstorage(data, config.routerBase + '-tagNavList');
109
128
  this.tagList = data;
110
129
  if (current !== this.value) {
@@ -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) {
@@ -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>
@@ -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,17 +1,17 @@
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
- <LamboProLayoutHeader></LamboProLayoutHeader>
4
+ <LamboProLayoutHeader :accept-app-id="acceptAppId" @clickLogo="handleClick"></LamboProLayoutHeader>
5
5
  </i-header>
6
6
  <i-layout>
7
7
  <i-sider
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
- <LamboProLayoutSider ref="sider"></LamboProLayoutSider>
14
+ <LamboProLayoutSider ref="sider" @on-select="handleSelect" :server-context="serverContext"></LamboProLayoutSider>
15
15
  </i-sider>
16
16
  <i-content class="pro-layout-content">
17
17
  <i-layout class="pro-layout-content-layout">
@@ -35,14 +35,29 @@ 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
+ acceptAppId: {
44
+ type: String,
45
+ default:''
46
+ },
43
47
  systemInfo: {
44
48
  type: Object,
45
- default: () => {}
49
+ default: () => {
50
+ return {
51
+ systemName: '后台管理系统',
52
+ systemLogo: '',
53
+ layoutSize: '',
54
+ tabNum: 8,
55
+ }
56
+ }
57
+ },
58
+ serverContext: {
59
+ type: String,
60
+ default: () => config.upmsServerContext // 设置默认值
46
61
  },
47
62
  userInfo: {
48
63
  type: Object,
@@ -86,6 +101,17 @@ export default {
86
101
  menuList,
87
102
  homeRouter
88
103
  }
104
+ },
105
+ layoutClass(){
106
+ if (this.systemInfo && this.systemInfo.layoutSize) {
107
+ let layoutSize = this.systemInfo.layoutSize;
108
+ if (layoutSize == 'default') {
109
+ return '';
110
+ } else {
111
+ return 'small';
112
+ }
113
+ }
114
+ return '';
89
115
  }
90
116
  },
91
117
  watch: {
@@ -98,6 +124,12 @@ export default {
98
124
  }
99
125
  },
100
126
  methods: {
127
+ handleClick(){
128
+ this.$emit('clickLogo')
129
+ },
130
+ handleSelect(name){
131
+ this.$emit('on-select',name)
132
+ },
101
133
  initListener(){
102
134
  Bus.$on('trigger-change',(data)=>{
103
135
  this.triggerChange(data)
@@ -108,8 +140,8 @@ export default {
108
140
  Bus.$on('user-action', (name)=> {
109
141
  this.userAction(name)
110
142
  })
111
- Bus.$on('menu-click',(name)=>{
112
- this.menuClick(name)
143
+ Bus.$on('menu-click',(name, item)=>{
144
+ this.menuClick(name, item)
113
145
  })
114
146
  Bus.$on('tag-list',(data,current)=>{
115
147
  this.changeTabs(data,current)
@@ -123,9 +155,7 @@ export default {
123
155
  Bus.$off('tag-list')
124
156
  },
125
157
  initEmit(){
126
- if (this.systemInfo && this.systemInfo.systemName) {
127
- Bus.$emit('system-name-change',this.systemInfo.systemName)
128
- }
158
+ Bus.$emit('system-info',this.systemInfo)
129
159
  Bus.$emit('user-info',this.userInfo)
130
160
  Bus.$emit('nav-list',this.navList)
131
161
  Bus.$emit('menu-list',this.menuList)
@@ -147,7 +177,7 @@ export default {
147
177
  },
148
178
  changeApp(appId,appInfo) {
149
179
  if (!appInfo) {
150
- appInfo = this.navList.filter(item => item.appId == appId)[0];
180
+ appInfo = this.navList.filter(item => item.appId == appId)[0];
151
181
  }
152
182
  this.appId = appId;
153
183
  this.$emit('change-app',{appId,appInfo})
@@ -155,10 +185,15 @@ export default {
155
185
  userAction(name){
156
186
  this.$emit('user-action',name)
157
187
  },
158
- menuClick(name){
159
- let res = this.menuList.filter(item => item.name == name);
188
+ menuClick(name, item){
189
+ if (!item) {
190
+ let res = this.menuList.filter(item => item.name == name);
191
+ if (res && res.length > 0) {
192
+ item = res[0];
193
+ }
194
+ }
160
195
  sessionStorage.setItem('activeName',name);
161
- this.$emit('menu-click', name, res[0])
196
+ this.$emit('menu-click', name, item)
162
197
  },
163
198
  changeTabs(data,current){
164
199
  this.$emit('change-tabs',data,current)
@@ -179,6 +214,14 @@ export default {
179
214
  let tagList = getTagNavListFromLocalstorage(config.routerBase + '-tagNavList');
180
215
  if (!tagExists(tagList,name)) {
181
216
  tagList.push(menuItem);
217
+ } else {
218
+ let tag = tagList.filter(item => item.name == name)[0];
219
+ if (!routeEqual(tag,menuItem)) {
220
+ let res = tagList.filter(item => item.name !== name);
221
+ tag = Object.assign(tag, menu);
222
+ res.push(tag);
223
+ tagList = deepCopy(res);
224
+ }
182
225
  }
183
226
  Bus.$emit('tag-list', tagList, name)
184
227
  }
@@ -196,7 +239,7 @@ export default {
196
239
  }
197
240
  </script>
198
241
 
199
- <style scoped lang="less">
242
+ <style lang="less">
200
243
  @import "@lambo-design/core/src/styles/default";
201
244
  .pro-layout{
202
245
  color: #ffffff;
@@ -208,20 +251,61 @@ export default {
208
251
  }
209
252
  .pro-layout-sider{
210
253
  overflow: hidden;
211
- /deep/.ivu-layout-sider-children{
212
- height: ~"calc(100vh - 65px)";
254
+ .ivu-layout-sider-children{
255
+ height: calc(100vh - 65px);
213
256
  overflow-y: scroll;
214
257
  margin-right: -18px;
215
258
  }
216
259
  }
217
260
  .pro-layout-content{
218
261
  .pro-layout-content-layout{
219
- height: ~"calc(100vh - 65px)";
262
+ height: ~"calc(100vh - 53px)";
220
263
  .pro-layout-page{
221
264
  overflow: hidden;
222
265
  color: var(--text-color,@_text-color);
223
266
  }
224
267
  }
225
268
  }
269
+ &.small {
270
+ .ivu-layout-header{
271
+ height: 50px;
272
+ line-height: 50px;
273
+ .pro-layout-header-wrapper{
274
+ height: 50px;
275
+ .trigger-box{
276
+ .sider-trigger-a{
277
+ margin-top: 5px;
278
+ width: 64px;
279
+ height: 50px;
280
+ }
281
+ }
282
+ .logo-box{
283
+ .pro-layout-logo-wrapper{
284
+ .logo{
285
+ height: 45px;
286
+ margin-top: 14px;
287
+ }
288
+ .divider{
289
+ height: 26px;
290
+ margin: 12px;
291
+ }
292
+ }
293
+ }
294
+ .nav-box{
295
+ .pro-layout-nav-wrapper{
296
+ .ivu-menu-horizontal{
297
+ height: 46px;
298
+ line-height: 46px;
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ .pro-layout-sider{
305
+ .ivu-layout-sider-children{
306
+ height: calc(100vh - 50px);
307
+ }
308
+ }
309
+ }
226
310
  }
227
- </style>
311
+ </style>
Binary file
@@ -0,0 +1,165 @@
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: var(--menu-dark-subsidiary-color, rgba(255, 255, 255, 0.7));
54
+ //color: #F0F0F0;
55
+ text-align: center;
56
+ line-height: 50px;
57
+ height: 50px;
58
+ width: 50%;
59
+ display: inline-block;
60
+ border-right: 2px solid #000000;
61
+ cursor: pointer;
62
+ border-radius: 3px;
63
+
64
+ &:hover {
65
+ color: #ffffff;
66
+ background: var(--primary-color,@_primary-color);
67
+ }
68
+
69
+ }
70
+ }
71
+
72
+
73
+ .other-menu-drawer-wrap {
74
+
75
+
76
+ .ivu-drawer {
77
+ left: 220px;
78
+ height: calc(100% - 110px);
79
+ bottom: 0;
80
+ top: auto;
81
+
82
+ .other-menu-history {
83
+
84
+ .other-menu-history-item {
85
+ width: 100%;
86
+ height: 35px;
87
+ line-height: 35px;
88
+ position: relative;
89
+
90
+ .delete {
91
+ display: none;
92
+ position: absolute;
93
+ right: 15px;
94
+ top: 0px;
95
+ cursor: pointer;
96
+ }
97
+
98
+ &:hover {
99
+ .content {
100
+ cursor: pointer;
101
+ height: 38px;
102
+ font-weight: bold;
103
+ color: var(--primary-color,@_primary-color);
104
+ }
105
+
106
+ .delete {
107
+ display: inline;
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ .other-menu-collect {
114
+ .other-menu-collect-item {
115
+ //display: inline-block;
116
+ //margin: 8px;
117
+ //position: relative;
118
+ width: 100%;
119
+ height: 35px;
120
+ line-height: 35px;
121
+ position: relative;
122
+ .delete {
123
+ display: none;
124
+ position: absolute;
125
+ right: -5px;
126
+ top: -5px;
127
+ z-index: 100;
128
+ cursor: pointer;
129
+ }
130
+
131
+ &:hover {
132
+ .content {
133
+ cursor: pointer;
134
+ color: var(--primary-color,@_primary-color);
135
+
136
+ .ivu-tooltip {
137
+ .ivu-tooltip-rel {
138
+ .ivu-icon {
139
+ font-size: 43px;
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ .delete {
146
+ display: inline;
147
+ }
148
+ }
149
+
150
+ }
151
+
152
+ }
153
+ }
154
+
155
+
156
+ }
157
+
158
+ .other-menu-drawer-wrap-collapsed {
159
+ .ivu-drawer {
160
+ left: 65px;
161
+ height: calc(100% - 110px);
162
+ bottom: 0;
163
+ top: auto;
164
+ }
165
+ }
File without changes