@lambo-design/pro-layout 1.0.0-beta.1

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/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import LamboProLayout from './src/index';
2
+ export default LamboProLayout;
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@lambo-design/pro-layout",
3
+ "version": "1.0.0-beta.1",
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
+ }
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <div class="pro-layout-header">
3
+ <div class="trigger-box">
4
+ <LamboProTrigger></LamboProTrigger>
5
+ </div>
6
+ <div class="logo-box">
7
+ <LamboProLogo></LamboProLogo>
8
+ </div>
9
+ <div class="nav-box">
10
+ <LamboProNav></LamboProNav>
11
+ </div>
12
+ <div class="tools-box">
13
+ <LamboProTools></LamboProTools>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ import LamboProTrigger from './pro-layout-trigger'
20
+ import LamboProLogo from './pro-layout-logo'
21
+ import LamboProNav from './pro-layout-nav'
22
+ import LamboProTools from './pro-layout-tools'
23
+ export default {
24
+ name: "pro-layout-header",
25
+ components: {
26
+ LamboProTrigger,
27
+ LamboProLogo,
28
+ LamboProNav,
29
+ LamboProTools
30
+ }
31
+ }
32
+ </script>
33
+
34
+ <style scoped lang="less">
35
+ .pro-layout-header{
36
+ overflow: hidden;
37
+ .trigger-box{
38
+ float: left;
39
+ }
40
+ .logo-box{
41
+ float: left;
42
+ }
43
+ .nav-box{
44
+ float: left;
45
+ }
46
+ .tools-box{
47
+ float: right;
48
+ }
49
+ }
50
+ </style>
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <div class="pro-layout-logo">
3
+ <div class="logo"></div>
4
+ <div class="divider"></div>
5
+ <div class="system-name">{{systemName}}</div>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import Bus from '@lambo-design/shared/utils/bus'
11
+ export default {
12
+ name: "pro-layout-logo",
13
+ data(){
14
+ return {
15
+ systemName: '后台管理系统'
16
+ }
17
+ },
18
+ methods: {
19
+ initListener(){
20
+ Bus.$on('system-name-change',(data)=>{
21
+ this.systemNameChange(data)
22
+ });
23
+ },
24
+ destroyListener(){
25
+ Bus.$off('system-name-change')
26
+ },
27
+ systemNameChange(data){
28
+ this.systemName = data;
29
+ }
30
+ },
31
+ created(){
32
+ this.initListener();
33
+ },
34
+ beforeDestroy(){
35
+ this.destroyListener();
36
+ }
37
+ }
38
+ </script>
39
+
40
+ <style scoped lang="less">
41
+ .pro-layout-logo{
42
+ .logo{
43
+ width: 150px;
44
+ height: 55px;
45
+ background: url("../styles/images/logo.png") no-repeat;
46
+ background-size: 100%;
47
+ float: left;
48
+ margin-top: 8px;
49
+ }
50
+ .divider{
51
+ height: 33px;
52
+ width: 2px;
53
+ border-right: 2px dashed fade(#ffffff,30%);
54
+ float: left;
55
+ margin: 15px;
56
+ }
57
+ .system-name{
58
+ float: left;
59
+ font-weight: bold;
60
+ font-size: 20px;
61
+ margin-right: 15px;
62
+ }
63
+ }
64
+ </style>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <div class="pro-layout-nav">
3
+ <Menu mode="horizontal" :active-name="activeName" @on-select="selectApp">
4
+ <MenuItem :name="item.appId" v-for="item in topMenList" :key="item.appId">
5
+ <Icon :type="item.icon ? item.icon : 'ios-paper'" />
6
+ {{item.name}}
7
+ </MenuItem>
8
+ <Submenu name="other" v-if="otherList.length > 0">
9
+ <template slot="title">
10
+ ...
11
+ </template>
12
+ <MenuItem :name="item.appId" v-for="item in otherList" :key="item.appId">
13
+ <Icon :type="item.icon ? item.icon : 'ios-paper'" />
14
+ {{item.name}}
15
+ </MenuItem>
16
+ </Submenu>
17
+ </Menu>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import Bus from "@lambo-design/shared/utils/bus";
23
+
24
+ export default {
25
+ name: "pro-layout-logo",
26
+ data(){
27
+ return {
28
+ navList : [],
29
+ topMenList : [],
30
+ otherList : [],
31
+ activeName : ''
32
+ }
33
+ },
34
+ methods: {
35
+ initListener(){
36
+ Bus.$on('nav-list',(data)=>{
37
+ this.initNav(data)
38
+ });
39
+ },
40
+ destroyListener(){
41
+ Bus.$off('nav-list')
42
+ },
43
+ initNav(data){
44
+ this.navList = data;
45
+ if (data.length > 5) {
46
+ this.topMenList = this.navList.sublist(0,5);
47
+ this.otherList = this.navList.sublist(5,this.navList.length);
48
+ } else {
49
+ this.topMenList = this.navList
50
+ }
51
+ },
52
+ selectApp(appId){
53
+ let appInfo = {};
54
+ for (let item of this.navList){
55
+ if (item.appId == appId) {
56
+ appInfo = item;
57
+ break;
58
+ }
59
+ }
60
+ Bus.$emit("change-app", {appId,appInfo})
61
+ }
62
+ },
63
+ created(){
64
+ this.initListener();
65
+ },
66
+ beforeDestroy(){
67
+ this.destroyListener();
68
+ }
69
+ }
70
+ </script>
71
+
72
+ <style scoped>
73
+
74
+ </style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div class="pro-layout-sider">
3
+ sider
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "pro-layout-logo"
10
+ }
11
+ </script>
12
+
13
+ <style scoped>
14
+
15
+ </style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div class="pro-layout-tabs">
3
+ tabs
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "pro-layout-header"
10
+ }
11
+ </script>
12
+
13
+ <style scoped>
14
+
15
+ </style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div class="pro-layout-tools">
3
+ tools
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "pro-layout-logo"
10
+ }
11
+ </script>
12
+
13
+ <style scoped>
14
+
15
+ </style>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <a @click="handleChange" type="text" :class="['sider-trigger-a', collapsed ? 'collapsed' : '']">
3
+ <Icon type="md-menu" size="26" />
4
+ </a>
5
+ </template>
6
+
7
+ <script>
8
+ import Bus from '@lambo-design/shared/utils/bus'
9
+ export default {
10
+ name: "pro-layout-trigger",
11
+ data(){
12
+ return {
13
+ collapsed: false
14
+ }
15
+ },
16
+ methods: {
17
+ handleChange(){
18
+ this.collapsed = !this.collapsed
19
+ Bus.$emit('trigger-change', this.collapsed)
20
+ }
21
+ }
22
+ }
23
+ </script>
24
+
25
+ <style scoped lang="less">
26
+ .trans{
27
+ transition: transform .2s ease;
28
+ }
29
+ @size: 40px;
30
+ .sider-trigger-a{
31
+ float: left;
32
+ padding: 6px;
33
+ width: @size;
34
+ height: @size;
35
+ display: inline-block;
36
+ text-align: center;
37
+ color: #ffffff;
38
+ margin-top: 6px;
39
+ i{
40
+ .trans;
41
+ vertical-align: top;
42
+ }
43
+ &.collapsed i{
44
+ transform: rotateZ(90deg);
45
+ .trans;
46
+ }
47
+ }
48
+ </style>
package/src/index.vue ADDED
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <i-layout class="pro-layout">
3
+ <i-header>
4
+ <LamboProLayoutHeader></LamboProLayoutHeader>
5
+ </i-header>
6
+ <i-layout>
7
+ <i-sider
8
+ hide-trigger
9
+ collapsible
10
+ :width="256"
11
+ :collapsed-width="64"
12
+ v-model="collapsed">
13
+ <LamboProLayoutSider></LamboProLayoutSider>
14
+ </i-sider>
15
+ <i-content class="pro-layout-content">
16
+ <i-layout>
17
+ <div class="pro-layout-tabs">
18
+ <LamboProLayoutTabs></LamboProLayoutTabs>
19
+ </div>
20
+ <i-content class="pro-layout-page">
21
+ <keep-alive>
22
+ <router-view/>
23
+ </keep-alive>
24
+ <iframe></iframe>
25
+ </i-content>
26
+ </i-layout>
27
+ </i-content>
28
+ </i-layout>
29
+ </i-layout>
30
+ </template>
31
+
32
+ <script>
33
+ import LamboProLayoutHeader from './components/pro-layout-header'
34
+ import LamboProLayoutSider from './components/pro-layout-sider'
35
+ import LamboProLayoutTabs from './components/pro-layout-tabs'
36
+ import Bus from '@lambo-design/shared/utils/bus'
37
+ export default {
38
+ props:{
39
+ systemInfo: {
40
+ type: Object,
41
+ default: () => {}
42
+ },
43
+ userInfo: {
44
+ type: Object,
45
+ default: () => {}
46
+ },
47
+ navList: {
48
+ type: Array,
49
+ default: () => []
50
+ },
51
+ menuList: {
52
+ type: Array,
53
+ default: () => []
54
+ }
55
+ },
56
+ data(){
57
+ return {
58
+ collapsed: false
59
+ }
60
+ },
61
+ components: {
62
+ LamboProLayoutHeader,
63
+ LamboProLayoutSider,
64
+ LamboProLayoutTabs
65
+ },
66
+ watch: {
67
+
68
+ },
69
+ methods: {
70
+ initListener(){
71
+ Bus.$on('trigger-change',(data)=>{
72
+ this.triggerChange(data)
73
+ });
74
+ Bus.$on('change-app', (appId,appInfo)=> {
75
+ this.changeApp(appId,appInfo)
76
+ })
77
+ },
78
+ destroyListener(){
79
+ Bus.$off('trigger-change')
80
+ Bus.$off('change-app')
81
+ },
82
+ initEmit(){
83
+ if (this.systemInfo && this.systemInfo.systemName) {
84
+ Bus.$emit('system-name-change',this.systemInfo.systemName)
85
+ }
86
+ Bus.$emit('nav-list',this.navList)
87
+ },
88
+ triggerChange(data){
89
+ this.collapsed = data;
90
+ },
91
+ changeApp(appId,appInfo) {
92
+
93
+ }
94
+ },
95
+ mounted(){
96
+ this.initEmit();
97
+ },
98
+ created(){
99
+ this.initListener();
100
+ },
101
+ beforeDestroy(){
102
+ this.destroyListener();
103
+ }
104
+ }
105
+ </script>
106
+
107
+ <style scoped lang="less">
108
+ .pro-layout{
109
+ color: #ffffff;
110
+ .ivu-layout-header{
111
+ padding: 0;
112
+ }
113
+ }
114
+ </style>
@@ -0,0 +1,92 @@
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
+ }
Binary file