Browse Source

样式调整

daxiong.yang 7 years ago
parent
commit
0d11347fa6

+ 0 - 48
src/App.vue

@ -8,51 +8,3 @@
8 8
  export default {
9 9
  }
10 10
</script>
11
12
<style lang="scss">
13
  *,
14
  *:before,
15
  *:after {
16
    box-sizing: border-box;
17
  }
18
  body {
19
    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
20
    font-size: 14px;
21
    line-height: 1.15;
22
    color: #333;
23
    background-color: #f0f0f0;
24
  }
25
  a {
26
    color: #337ab7;
27
    text-decoration: none;
28
    &:focus,
29
    &:hover {
30
      color: #23527c;
31
      text-decoration: underline;
32
    }
33
  }
34
  img {
35
    vertical-align: middle;
36
  }
37
  * {
38
    outline: 0;
39
  }
40
  .clearfix:before,
41
  .clearfix:after {
42
    content: " ";
43
    display: table;
44
  }
45
  .clearfix:after {
46
    clear: both;
47
  }
48
49
  /* animation */
50
  .fade-enter-active,
51
  .fade-leave-active {
52
    transition: opacity .5s;
53
  }
54
  .fade-enter,
55
  .fade-leave-to {
56
    opacity: 0;
57
  }
58
</style>

+ 239 - 0
src/assets/scss/_base.scss

@ -0,0 +1,239 @@
1
*,
2
*:before,
3
*:after {
4
  box-sizing: border-box;
5
}
6
body {
7
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
8
  font-size: 14px;
9
  line-height: 1.15;
10
  color: #333;
11
  background-color: #f0f0f0;
12
}
13
:focus {
14
  outline: 0;
15
}
16
a {
17
  color: #337ab7;
18
  text-decoration: none;
19
  &:focus,
20
  &:hover {
21
    color: #23527c;
22
    text-decoration: underline;
23
  }
24
}
25
img {
26
  vertical-align: middle;
27
}
28
29
/* ----- utils ----- */
30
.clearfix:before,
31
.clearfix:after {
32
  content: " ";
33
  display: table;
34
}
35
.clearfix:after {
36
  clear: both;
37
}
38
39
/* ----- animation ------ */
40
.fade-enter-active,
41
.fade-leave-active {
42
  transition: opacity .5s;
43
}
44
.fade-enter,
45
.fade-leave-to {
46
  opacity: 0;
47
}
48
49
/* ----- layout ------ */
50
.site-wrapper {
51
  position: relative;
52
  min-width: 1180px;
53
}
54
/* site-sidebar-collapse */
55
.site-sidebar--collapse {
56
  .site-topbar__header,
57
  .site-sidebar,
58
  .site-sidebar__inner,
59
  .el-menu.site-sidebar__menu {
60
    width: 64px;
61
  }
62
  .site-topbar__body,
63
  .site-content__wrapper {
64
    margin-left: 64px;
65
  }
66
  .site-logo {
67
    &__lg {
68
      display: none;
69
    }
70
    &__mini {
71
      display: inline-block;
72
    }
73
  }
74
  .site-sidebar,
75
  .site-sidebar__inner {
76
    overflow: initial;
77
  }
78
  .el-menu-item,
79
  .el-submenu__title {
80
    text-align: center;
81
  }
82
  .site-sidebar__menu-icon {
83
    margin-right: 0;
84
    font-size: 20px;
85
  }
86
  .el-menu-item span,
87
  .el-submenu > .el-submenu__title span {
88
    display: none;
89
  }
90
  .site-content--tabs > .el-tabs .el-tabs__header {
91
    left: 64px;
92
  }
93
}
94
/* site-topbar */
95
.site-topbar {
96
  position: fixed;
97
  top: 0;
98
  right: 0;
99
  left: 0;
100
  z-index: 1030;
101
  height: 50px;
102
  box-shadow: 0 2px 4px rgba(0, 0, 0, .08);
103
  background-color: #3e8ef7;
104
}
105
.site-topbar__header {
106
  float: left;
107
  width: 230px;
108
  height: 50px;
109
}
110
.site-logo {
111
  display: table-cell;
112
  vertical-align: middle;
113
  width: 230px;
114
  height: 50px;
115
  margin: 0;
116
  font-size: 20px;
117
  text-align: center;
118
  text-transform: uppercase;
119
  &__lg,
120
  &__mini {
121
    color: #fff;
122
    &:focus,
123
    &:hover {
124
      color: #fff;
125
      text-decoration: none;
126
    }
127
  }
128
  &__mini {
129
    display: none;
130
  }
131
}
132
.site-topbar__switch {
133
  font-size: 18px;
134
  border-bottom: none !important;
135
}
136
.site-topbar__avatar {
137
  border-bottom: none !important;
138
  .el-dropdown-link {
139
    > img {
140
      width: 36px;
141
      height: auto;
142
      margin-right: 5px;
143
      border-radius: 100%;
144
    }
145
  }
146
}
147
.site-topbar__body {
148
  position: relative;
149
  margin-left: 230px;
150
  padding-right: 15px;
151
  background-color: #fff;
152
}
153
.site-topbar__menu {
154
  float: left;
155
  background-color: transparent;
156
  border-bottom: 0;
157
  &--right {
158
    float: right;
159
  }
160
  .el-menu-item,
161
  .el-submenu .el-submenu__title {
162
    height: 50px;
163
    line-height: 50px;
164
  }
165
  .el-submenu > .el-menu {
166
    top: 55px;
167
  }
168
}
169
/* site-sidebar */
170
.site-sidebar {
171
  position: fixed;
172
  top: 50px;
173
  left: 0;
174
  bottom: 0;
175
  z-index: 1020;
176
  width: 230px;
177
  background-color: #545c64;
178
  overflow: hidden;
179
}
180
.site-sidebar__inner {
181
  position: relative;
182
  z-index: 1;
183
  width: 250px;
184
  height: 100%;
185
  padding-bottom: 15px;
186
  overflow-y: scroll;
187
}
188
.site-sidebar__menu.el-menu {
189
  width: 230px;
190
  border-right: 0;
191
}
192
.site-sidebar__menu-icon {
193
  margin-right: 5px;
194
  font-size: 18px;
195
}
196
/* site-content */
197
.site-content__wrapper {
198
  position: relative;
199
  padding-top: 50px;
200
  margin-left: 230px;
201
  min-height: 100%;
202
}
203
.site-content {
204
  position: relative;
205
  padding: 15px;
206
}
207
.site-content--tabs {
208
  padding: 55px 0 0;
209
  > .el-tabs {
210
    .el-tabs__header {
211
      position: fixed;
212
      top: 50px;
213
      left: 230px;
214
      right: 0;
215
      z-index: 930;
216
      padding: 0 15px;
217
      box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .12), 0 0 6px 0 rgba(0, 0, 0, .04);
218
      background-color: #fff;
219
    }
220
    .el-tabs__nav-wrap {
221
      margin-bottom: 0;
222
      &:after {
223
        display: none;
224
      }
225
    }
226
    .el-tabs__content {
227
      padding: 0 15px 15px;
228
    }
229
    .el-pagination {
230
      margin-top: 15px;
231
      text-align: right;
232
    }
233
    .el-breadcrumb {
234
      padding: 0 0 15px;
235
      margin-bottom: 22px;
236
      border-bottom: 1px solid #ebeef5;
237
    }
238
  }
239
}

src/assets/css/normalize.css → src/assets/scss/_normalize.scss


+ 2 - 0
src/assets/scss/index.scss

@ -0,0 +1,2 @@
1
@import "normalize";  // api: https://github.com/necolas/normalize.css/
2
@import "base";

+ 1 - 1
src/main.js

@ -5,9 +5,9 @@ import App from './App'
5 5
import router from './router'       // api: https://router.vuejs.org/
6 6
import store from './store'         // api: https://vuex.vuejs.org/
7 7
import VueCookie from 'vue-cookie'  // api: https://github.com/alfhen/vue-cookie
8
import '@/assets/css/normalize.css' // api: https://github.com/necolas/normalize.css
9 8
import '@/element-ui'               // api: https://github.com/ElemeFE/element
10 9
import '@/iconfont'                 // api: http://www.iconfont.cn/
10
import '@/assets/scss/index.scss'
11 11
12 12
Vue.config.productionTip = false
13 13

+ 2 - 0
src/store/index.js

@ -20,6 +20,8 @@ const state = {
20 20
    activeName: '',
21 21
    tabList: []
22 22
  },
23
  // 菜单导航iframe嵌套地址
24
  menuNavIframeUrl: '//demo.open.renren.io/renren-fast/',
23 25
  // 菜单导航类型映射表, module: vue重构(默认), iframe: iframe方式嵌套
24 26
  menuNavTypeMap: {
25 27
    'sql': 'iframe'

+ 1 - 40
src/views/layout/content-tabs.vue

@ -13,7 +13,7 @@
13 13
          <el-card :body-style="contentViewHeight(item)">
14 14
            <iframe
15 15
              v-if="item.type === 'iframe'"
16
              :src="iframePath + item.url"
16
              :src="$store.state.menuNavIframeUrl + item.url"
17 17
              width="100%" height="100%" frameborder="0" scrolling="yes">
18 18
            </iframe>
19 19
            <keep-alive v-else>
@ -31,7 +31,6 @@
31 31
  export default {
32 32
    data () {
33 33
      return {
34
        iframePath: '//demo.open.renren.io/renren-fast/'
35 34
      }
36 35
    },
37 36
    computed: {
@ -83,41 +82,3 @@
83 82
    }
84 83
  }
85 84
</script>
86
87
<style lang="scss">
88
  .site-content--tabs {
89
    padding: 55px 0 0;
90
91
    > .el-tabs {
92
      .el-tabs__header {
93
        position: fixed;
94
        top: 50px;
95
        left: 230px;
96
        right: 0;
97
        z-index: 930;
98
        padding: 0 15px;
99
        box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .12), 0 0 6px 0 rgba(0, 0, 0, .04);
100
        background-color: #fff;
101
      }
102
      .el-tabs__nav-wrap {
103
        margin-bottom: 0;
104
        &:after {
105
          display: none;
106
        }
107
      }
108
      .el-tabs__content {
109
        padding: 0 15px 15px;
110
      }
111
      .el-pagination {
112
        margin-top: 15px;
113
        text-align: right;
114
      }
115
      .el-breadcrumb {
116
        padding: 0 0 15px;
117
        margin-bottom: 22px;
118
        border-bottom: 1px solid #ebeef5;
119
      }
120
    }
121
  }
122
</style>
123

+ 0 - 55
src/views/layout/index.vue

@ -61,58 +61,3 @@
61 61
    }
62 62
  }
63 63
</script>
64
65
<style lang="scss">
66
  .site-wrapper {
67
    position: relative;
68
    min-width: 1180px;
69
  }
70
  .site-content__wrapper {
71
    position: relative;
72
    padding-top: 50px;
73
    margin-left: 230px;
74
    min-height: 100%;
75
  }
76
  .site-content {
77
    position: relative;
78
    padding: 15px;
79
  }
80
81
  /* sidebar-collapse */
82
  .site-sidebar--collapse {
83
    .site-topbar__header,
84
    .site-sidebar,
85
    .site-sidebar__inner,
86
    .el-menu.site-sidebar__menu {
87
      width: 64px;
88
    }
89
    .site-topbar__body,
90
    .site-content__wrapper {
91
      margin-left: 64px;
92
    }
93
    .site-logo {
94
      &__lg {
95
        display: none;
96
      }
97
      &__mini {
98
        display: inline-block;
99
      }
100
    }
101
    .site-sidebar,
102
    .site-sidebar__inner {
103
      overflow: initial;
104
    }
105
    .el-menu-item,
106
    .el-submenu__title {
107
      text-align: center;
108
    }
109
    .site-sidebar__menu-icon {
110
      margin-right: 0;
111
      font-size: 20px;
112
    }
113
    .el-menu-item span,
114
    .el-submenu > .el-submenu__title span {
115
      display: none;
116
    }
117
  }
118
</style>

+ 9 - 33
src/views/layout/sidebar.vue

@ -1,7 +1,9 @@
1 1
<template>
2 2
  <aside class="site-sidebar">
3 3
    <div class="site-sidebar__inner">
4
      <!--  -->
4 5
      <el-menu
6
        ref="menuNav"
5 7
        :default-active="menuNavActive"
6 8
        :default-openeds="menuNavOpeneds"
7 9
        :collapse="$store.state.sidebarCollapse"
@ -33,15 +35,19 @@
33 35
    data () {
34 36
      return {
35 37
        menuNavActive: '1-1',
36
        menuNavOpeneds: ['1'],
37
        isCollapse: false
38
        menuNavOpeneds: ['1']
38 39
      }
39 40
    },
40 41
    components: {
41 42
      SubMenuNav
42 43
    },
43 44
    watch: {
44
      $route: 'routeHandle'
45
      $route: 'routeHandle',
46
      '$store.state.sidebarCollapse': function (val) {
47
        if (!val) {
48
          this.$refs.menuNav.open(this.menuNavOpeneds[0])
49
        }
50
      }
45 51
    },
46 52
    created () {
47 53
      this.routeHandle(this.$route, true)
@ -63,7 +69,6 @@
63 69
            }
64 70
          } else {
65 71
            this.UPDATE_CONTENT_TABS_ACTIVE_NAME({ name: route.name })
66
            this.menuNavActive = tab[0].id + ''
67 72
          }
68 73
        } else {
69 74
          if (isInit) {
@ -108,32 +113,3 @@
108 113
    }
109 114
  }
110 115
</script>
111
112
<style lang="scss">
113
  .site-sidebar {
114
    position: fixed;
115
    top: 50px;
116
    left: 0;
117
    bottom: 0;
118
    z-index: 1020;
119
    width: 230px;
120
    background-color: #545c64;
121
    overflow: hidden;
122
  }
123
  .site-sidebar__inner {
124
    position: relative;
125
    z-index: 1;
126
    width: 250px;
127
    height: 100%;
128
    padding-bottom: 15px;
129
    overflow-y: scroll;
130
  }
131
  .el-menu.site-sidebar__menu {
132
    width: 230px;
133
    border-right: 0;
134
  }
135
  .site-sidebar__menu-icon {
136
    margin-right: 5px;
137
    font-size: 18px;
138
  }
139
</style>

+ 0 - 81
src/views/layout/topbar.vue

@ -146,84 +146,3 @@
146 146
    }
147 147
  }
148 148
</script>
149
150
<style lang="scss">
151
  .site-topbar {
152
    position: fixed;
153
    top: 0;
154
    right: 0;
155
    left: 0;
156
    z-index: 1030;
157
    height: 50px;
158
    box-shadow: 0 2px 4px rgba(0, 0, 0, .08);
159
    background-color: #3e8ef7;
160
  }
161
  .site-topbar__header {
162
    float: left;
163
    width: 230px;
164
    height: 50px;
165
  }
166
  .site-logo {
167
    display: table-cell;
168
    vertical-align: middle;
169
    width: 230px;
170
    height: 50px;
171
    margin: 0;
172
    font-size: 20px;
173
    text-align: center;
174
    text-transform: uppercase;
175
    
176
    &__lg,
177
    &__mini {
178
      color: #fff;
179
      &:focus,
180
      &:hover {
181
        color: #fff;
182
        text-decoration: none;
183
      }
184
    }
185
    &__mini {
186
      display: none;
187
    }
188
  }
189
  .site-topbar__switch {
190
    font-size: 18px;
191
    border-bottom: none !important;
192
  }
193
  .site-topbar__avatar {
194
    border-bottom: none !important;
195
196
    .el-dropdown-link {
197
      > img {
198
        width: 36px;
199
        height: auto;
200
        margin-right: 5px;
201
        border-radius: 100%;
202
      }
203
    }
204
  }
205
  .site-topbar__body {
206
    position: relative;
207
    margin-left: 230px;
208
    padding-right: 15px;
209
    background-color: #fff;
210
  }
211
  .site-topbar__menu {
212
    float: left;
213
    background-color: transparent;
214
    border-bottom: 0;
215
216
    &--right {
217
      float: right;
218
    }
219
220
    .el-menu-item,
221
    .el-submenu .el-submenu__title {
222
      height: 50px;
223
      line-height: 50px;
224
    }
225
    .el-submenu > .el-menu {
226
      top: 55px;
227
    }
228
  }
229
</style>