Commit b858224eb6e45b32e8cdc01feda2cd7a8164f1b8

Authored by BigBoss
1 parent 8a0e4eede0
Exists in master

layout修改

src/layout/components/Sidebar/index.vue
1 1 <template>
2 2 <div :class="{'has-logo':showLogo}">
3   - <logo v-if="showLogo" :collapse="isCollapse" />
4   - <el-scrollbar wrap-class="scrollbar-wrapper">
5   - <el-menu
6   - :default-active="activeMenu"
7   - :collapse="isCollapse"
8   - :background-color="variables.menuBg"
9   - :text-color="variables.menuText"
10   - :unique-opened="false"
11   - :active-text-color="variables.menuActiveText"
12   - :collapse-transition="false"
13   - mode="vertical"
14   - >
15   - <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />
16   - </el-menu>
17   - </el-scrollbar>
  3 + <logo v-if="showLogo" class="logo" :collapse="isCollapse" />
  4 + <!-- <el-scrollbar wrap-class="scrollbar-wrapper"> -->
  5 + <el-menu
  6 + :default-active="activeMenu"
  7 + :background-color="variables.menuBg"
  8 + :text-color="variables.menuText"
  9 + :unique-opened="false"
  10 + :active-text-color="variables.menuActiveText"
  11 + :collapse-transition="false"
  12 + mode="horizontal"
  13 + >
  14 + <el-menu-item v-for="route in permission_routes" :key="route.path">
  15 + <sidebar-item :key="route.path" :item="route" :base-path="route.path" />
  16 + </el-menu-item>
  17 +
  18 + </el-menu>
  19 + <!-- </el-scrollbar> -->
18 20 </div>
19 21 </template>
20 22  
... ... @@ -52,3 +54,8 @@ export default {
52 54 }
53 55 }
54 56 </script>
  57 +<style>
  58 +.logo{
  59 + width:115px;
  60 +}
  61 +</style>
... ...
src/layout/index.vue
... ... @@ -88,12 +88,15 @@ export default {
88 88 top: 0;
89 89 right: 0;
90 90 z-index: 9;
91   - width: calc(100% - #{$sideBarWidth});
  91 + // width: calc(100% - #{$sideBarWidth});
  92 + width: 100%;
  93 + margin-top: 54px;
92 94 transition: width 0.28s;
93 95 }
94 96  
95 97 .hideSidebar .fixed-header {
96   - width: calc(100% - 54px)
  98 + // width: calc(100% - 54px)
  99 + width:100%;
97 100 }
98 101  
99 102 .mobile .fixed-header {
... ...
src/router/index.js
... ... @@ -206,20 +206,20 @@ export const asyncRoutes = [
206 206 // chartsRouter,
207 207 // nestedRouter,
208 208 // tableRouter,
209   - {
210   - path: '/icon',
211   - component: Layout,
212   - children: [{
213   - path: 'index',
214   - component: () => import('@/views/icons/index'),
215   - name: 'Icons',
216   - meta: {
217   - title: 'icons',
218   - icon: 'icon',
219   - noCache: true
220   - }
221   - }]
222   - },
  209 + // {
  210 + // path: '/icon',
  211 + // component: Layout,
  212 + // children: [{
  213 + // path: 'index',
  214 + // component: () => import('@/views/icons/index'),
  215 + // name: 'Icons',
  216 + // meta: {
  217 + // title: 'icons',
  218 + // icon: 'icon',
  219 + // noCache: true
  220 + // }
  221 + // }]
  222 + // },
223 223 /** when your routing map is too long, you can split it into small modules **/
224 224  
225 225 // {
... ...
src/router/modules/user.js
... ... @@ -14,62 +14,17 @@ const chartsRouter = {
14 14 roles: ['admin', 'assistant'] // you can set roles in root nav
15 15 },
16 16 children: [{
17   - path: 'assistant',
  17 + path: '用户管理',
18 18 component: () => import('@/views/users/list'),
19   - name: 'assistant',
  19 + name: '用户管理',
20 20 query: {
21 21 test: 'ssssss'
22 22 },
23 23 meta: {
24   - title: 'users.assistant',
  24 + title: '用户管理',
25 25 roles: ['admin'] // or you can only set roles in sub nav
26 26 }
27   - },
28   - {
29   - path: 'runner',
30   - component: () => import('@/views/users/list'),
31   - name: 'runner',
32   - query: {
33   - test: 'ssssss'
34   - },
35   - meta: {
36   - title: 'users.runner',
37   - roles: ['admin', 'assistant'] // or you can only set roles in sub nav
38   - }
39   - },
40   - {
41   - path: 'shoper',
42   - component: () => import('@/views/users/list'),
43   - name: 'shoper',
44   - query: {
45   - test: 'ssssss'
46   - },
47   - meta: {
48   - title: 'users.shoper',
49   - roles: ['admin', 'assistant'] // or you can only set roles in sub nav
50   - }
51   - },
52   - {
53   - path: 'users',
54   - component: () => import('@/views/users/list'),
55   - name: 'users',
56   - query: {
57   - test: 'ssssss'
58   - },
59   - meta: {
60   - title: 'users.user',
61   - roles: ['admin', 'assistant'] // or you can only set roles in sub nav
62   - }
63 27 }
64   - // ,{
65   - // path: '/icons',
66   - // component: () => import('@/views/icons/index'),
67   - // name: 'icons',
68   - // meta: {
69   - // title: 'icons',
70   - // roles: ['admin', 'assistant', 'shoper', 'runner'] // or you can only set roles in sub nav
71   - // }
72   - // }
73 28 ]
74 29 }
75 30  
... ...
src/styles/sidebar.scss
... ... @@ -3,15 +3,18 @@
3 3 .main-container {
4 4 min-height: 100%;
5 5 transition: margin-left .28s;
6   - margin-left: $sideBarWidth;
  6 + // margin-left: $sideBarWidth;
  7 + margin-top: 54px;
7 8 position: relative;
8 9 }
9 10  
10 11 .sidebar-container {
11 12 transition: width 0.28s;
12   - width: $sideBarWidth !important;
  13 + // width: $sideBarWidth !important;
  14 + width: 100% !important;
13 15 background-color: $menuBg;
14   - height: 100%;
  16 + // height: 100%;
  17 + height: 54px;
15 18 position: fixed;
16 19 font-size: 0px;
17 20 top: 0;
... ...
src/views/operations/operations.vue
1 1 <template>
2   - <div class="login-container">
3   - <el-button
4   - type="primary"
5   - @click="() => addNode()"
6   - >{{ $t('users.add') }}</el-button>
7   - <el-tree
8   - ref="tree"
9   - :data="data"
10   - show-checkbox
11   - node-key="id"
12   - highlight-current
13   - check-strictly
14   - indent="40"
15   - icon-class="el-icon-pc"
16   - :props="defaultProps"
17   - >
18   - <!-- <el-tree
19   - :data="data"
20   - show-checkbox
21   - node-key="id"
22   - default-expand-all
23   - highlight-current
24   - isLeaf
25   - @node-contextmenu="()=>rightKey(node, data)"
26   - check-strictly//在显示复选框的情况下,是否严格的遵循父子不互相关联的做法,默认为 false
27   - :expand-on-click-node="false"//是否在点击节点的时候展开或者收缩节点, 默认值为 true,如果为 false,则只有点箭头图标的时候才会展开或者收缩节点。
28   - :props="defaultProps"
29   - > -->
30   - <span
31   - slot-scope="{ node, data }"
32   - class="custom-tree-node"
33   - >
34   - <span>{{ node.label }}</span>
35   - <span>
36   - <el-button
37   - type="primary"
38   - icon="el-icon-upload"
39   - size="mini"
40   - @click="() => append(data)"
41   - >
42   - {{ $t('users.add') }}
43   - </el-button>
44   - <el-button
45   - type="primary"
46   - icon="el-icon-edit"
47   - size="mini"
48   - @click="() => update(node, data)"
49   - >
50   - {{ $t('users.update') }}
51   - </el-button>
52   - <el-button
53   - type="primary"
54   - icon="el-icon-delete"
55   - size="mini"
56   - class="danger"
57   - @click="() => remove(node, data)"
58   - >
59   - {{ $t('users.del') }}
60   - </el-button>
61   - </span>
62   - </span>
63   - </el-tree>
64   -
65   - <!-- <div class="buttons">
66   - <el-button @click="getCheckedNodes">通过 node 获取</el-button>
67   - <el-button @click="getCheckedKeys">通过 key 获取</el-button>
68   - <el-button @click="setCheckedNodes">通过 node 设置</el-button>
69   - <el-button @click="setCheckedKeys">通过 key 设置</el-button>
70   - <el-button @click="resetChecked">清空</el-button>
71   - </div> -->
72   - </div>
  2 + <el-container style=" border: 1px solid #eee">
  3 + <el-main>
  4 + <el-tabs v-model="activeName" tab-position="top" @tab-click="handleClick">
  5 + <el-tab-pane label="秀野堂主" name="first">
  6 + <span />
  7 + </el-tab-pane>
  8 + <el-tab-pane label="Richa" name="second" />
  9 + </el-tabs>
  10 + </el-main>
  11 + </el-container>
73 12 </template>
74 13 <script>
75   -let id = 1000
76 14 export default {
77 15 data() {
78 16 return {
79   - data: [
80   - {
81   - label: '成镜',
82   - id: '1',
83   - children: [
84   - {
85   - label: '款式',
86   - id: '11',
87   - children: [
88   - { label: '青春学子风' },
89   - { label: '休闲' },
90   - { label: '商务' },
91   - { label: '复古' },
92   - { label: '时尚' },
93   - { label: '质感哥特潮' },
94   - { label: '轻简北欧风' },
95   - { label: '理性几何派' },
96   - { label: '多元新风尚' },
97   - { label: '立体巴洛克' },
98   - { label: '有机未来时' },
99   - { label: '无界人文系' },
100   - { label: '自然舒视角' },
101   - { label: '流线洛可可' },
102   - { label: '奶奶风' },
103   - { label: '简约-极简文艺范' },
104   - { label: '运动风' },
105   - { label: '行政风' },
106   - { label: '折射率' }
107   - ]
108   - },
109   - { label: '个性化服务', id: '267', children: [] },
110   - {
111   - label: '赠品',
112   - id: '259',
113   - children: [{ label: '眼镜布' }, { label: '眼镜盒' }]
114   - },
115   - {
116   - label: '场景',
117   - id: '258',
118   - children: [
119   - { label: '学校场景' },
120   - { label: '出行交际' },
121   - { label: '夜店迷人' },
122   - { label: '明星同款' }
123   - ]
124   - },
125   - {
126   - label: '销售保障',
127   - id: '245',
128   - children: [
129   - { label: '可退' },
130   - { label: '可换' },
131   - { label: '可修' }
132   - ]
133   - },
134   - {
135   - label: '功能',
136   - id: '140',
137   - children: [
138   - { label: '防踩压' },
139   - { label: '防扭曲' },
140   - { label: '抗过敏' },
141   - { label: '防腐蚀' },
142   - { label: '耐磨损' },
143   - { label: '抗蓝光' }
144   - ]
145   - },
146   - {
147   - label: '品牌',
148   - id: '71',
149   - children: [
150   - { label: '购易' },
151   - { label: '海俪恩' },
152   - { label: '沙漠风暴' },
153   - { label: '古诗' },
154   - { label: '暴龙' },
155   - { label: '犀牛' },
156   - { label: 'Ray-Ban雷朋' },
157   - { label: 'PARIM派丽蒙' },
158   - { label: '石狼' },
159   - { label: '木九十' }
160   - ]
161   - },
162   - {
163   - label: '边形',
164   - id: '49',
165   - children: [
166   - { label: '半框' },
167   - { label: '全框' },
168   - { label: '无框' }
169   - ]
170   - },
171   - {
172   - label: '性别',
173   - id: '23',
174   - children: [{ label: '男性' }, { label: '女性' }]
175   - },
176   - {
177   - label: '梁型',
178   - id: '20',
179   - children: [{ label: '双梁' }, { label: '单梁' }]
180   - },
181   - {
182   - label: '重量',
183   - id: '19',
184   - children: [{ label: '30克以下' }, { label: '80克以上' }]
185   - },
186   - {
187   - label: '适用脸型',
188   - id: '15',
189   - children: [{ label: '方' }, { label: '圆' }, { label: '瓜子' }]
190   - },
191   - {
192   - label: '形状',
193   - id: '14',
194   - children: [
195   - { label: '正圆形' },
196   - { label: '椭圆形' },
197   - { label: '方圆' },
198   - { label: '方形' },
199   - { label: '多边形' },
200   - { label: '内三角(蛤蟆)' },
201   - { label: '外三角(蝶形)' }
202   - ]
203   - },
204   - { label: '年龄', id: '12', children: [{ label: '通用' }] },
205   - {
206   - label: '材质',
207   - id: '10',
208   - children: [
209   - { label: '板材' },
210   - { label: '纯钛' },
211   - { label: 'TR90' },
212   - { label: '木质' },
213   - { label: '竹质' },
214   - { label: 'β钛' },
215   - { label: 'PC' },
216   - { label: 'ULTEM塑钢' },
217   - { label: '钨钛塑钢' },
218   - { label: '镁铝合金' },
219   - { label: '碳纤维' }
220   - ]
221   - },
222   - { label: '折射率', id: '286', children: [] },
223   - {
224   - label: '颜色',
225   - id: '13',
226   - children: [
227   - { label: '金色' },
228   - { label: '银色' },
229   - { label: '黑色' },
230   - { label: '彩色' },
231   - { label: '枪色' }
232   - ]
233   - }
234   - ]
235   - },
236   - {
237   - label: '镜片',
238   - id: '2',
239   - children: [
240   - {
241   - label: '面型',
242   - id: '85',
243   - children: [{ label: '球面单光' }, { label: '非球面单光' }]
244   - },
245   - { label: '近视度数', id: '92', children: [] },
246   - { label: '散光', id: '93', children: [] },
247   - {
248   - label: '功能',
249   - id: '95',
250   - children: [
251   - { label: '防起雾' },
252   - { label: '防蓝光' },
253   - { label: '防紫外线' },
254   - { label: '偏光' },
255   - { label: '染色' },
256   - { label: '抗疲劳' },
257   - { label: '青少年渐进' },
258   - { label: '内渐进' },
259   - { label: '变色' },
260   - { label: '双光' },
261   - { label: '耐磨损' },
262   - { label: '防尘' },
263   - { label: '防水' },
264   - { label: '防摔' },
265   - { label: '防指纹' },
266   - { label: '防反光' }
267   - ]
268   - },
269   - {
270   - label: '颜色',
271   - id: '100',
272   - children: [
273   - { label: '透明' },
274   - { label: '染色' },
275   - { label: '变色' },
276   - { label: '单色' }
277   - ]
278   - },
279   - {
280   - label: '折射率',
281   - id: '101',
282   - children: [
283   - { label: '1.56' },
284   - { label: '1.60' },
285   - { label: '1.65' },
286   - { label: '1.67' },
287   - { label: '1.71' },
288   - { label: '1.74' }
289   - ]
290   - },
291   - { label: '阿贝数(色散)', id: '102', children: [] },
292   - { label: '重量', id: '103', children: [] },
293   - {
294   - label: '材质',
295   - id: '104',
296   - children: [
297   - { label: '树脂' },
298   - { label: '玻璃' },
299   - { label: '宇宙PC' },
300   - { label: 'PC' }
301   - ]
302   - },
303   - {
304   - label: '品牌',
305   - id: '118',
306   - children: [
307   - { label: '好视力' },
308   - { label: 'RAISE锐视' },
309   - { label: '依视路' },
310   - { label: '凯米' },
311   - { label: '蔡司' },
312   - { label: '舒曼' }
313   - ]
314   - },
315   - {
316   - label: '销售保障',
317   - id: '249',
318   - children: [
319   - { label: '可退' },
320   - { label: '可换' },
321   - { label: '可修' }
322   - ]
323   - }
324   - ]
325   - },
326   - {
327   - label: '隐形眼镜',
328   - id: '88',
329   - children: [
330   - {
331   - label: '颜色',
332   - id: '105',
333   - children: [
334   - { label: '绿' },
335   - { label: '灰' },
336   - { label: '黑' },
337   - { label: '紫' },
338   - { label: '蓝' },
339   - { label: '棕色' },
340   - { label: '紫色' }
341   - ]
342   - },
343   - {
344   - label: '颜料',
345   - id: '106',
346   - children: [{ label: '水性' }, { label: '油性' }]
347   - },
348   - { label: '度数', id: '107', children: [] },
349   - {
350   - label: '周期',
351   - id: '108',
352   - children: [
353   - { label: '日抛' },
354   - { label: '周抛' },
355   - { label: '双周抛' },
356   - { label: '月抛' },
357   - { label: '季抛' },
358   - { label: '半年抛' },
359   - { label: '年抛' }
360   - ]
361   - },
362   - {
363   - label: '品牌',
364   - id: '133',
365   - children: [
366   - { label: 'HolyNara' },
367   - { label: '爱尔康' },
368   - { label: 'MaxLook' },
369   - { label: 'NEO' },
370   - { label: 'GEO' },
371   - { label: '实瞳' },
372   - { label: '茵洛' },
373   - { label: 'DAZZSHOP' },
374   - { label: 'O-LENS' },
375   - { label: 'envie' },
376   - { label: '曼秀雷敦' },
377   - { label: '妃蜜莉' },
378   - { label: '海俪恩' },
379   - { label: '凯达' },
380   - { label: '蔡司' },
381   - { label: '酷视' },
382   - { label: 'LILMOON' },
383   - { label: 'RICHBABY' },
384   - { label: 'T-Garden' },
385   - { label: 'lenstown' },
386   - { label: '新加坡P2' },
387   - { label: '星欧' },
388   - { label: '美尼康' },
389   - { label: '美汐' },
390   - { label: '欧舒天' },
391   - { label: '海昌' },
392   - { label: '菲士康' },
393   - { label: '卫康' },
394   - { label: '库博' },
395   - { label: '安视优' },
396   - { label: '美若康' },
397   - { label: '视康' },
398   - { label: '澜柏' },
399   - { label: '3N' },
400   - { label: 'BIJOU' },
401   - { label: '依视明' },
402   - { label: '博士伦' },
403   - { label: '瞳昕' },
404   - { label: '科莱博' },
405   - { label: '绮芙莉' },
406   - { label: '雅培' },
407   - { label: '爱能视' },
408   - { label: '女神秘语' },
409   - { label: '博视顿' },
410   - { label: '妆美堂' },
411   - { label: '人鱼姬' },
412   - { label: 'EverColor' },
413   - { label: 'Sincere' }
414   - ]
415   - },
416   - {
417   - label: '工艺',
418   - id: '159',
419   - children: [{ label: '涂层工艺' }, { label: '三层夹色工艺' }]
420   - },
421   - {
422   - label: '材质',
423   - id: '164',
424   - children: [{ label: '硅水凝胶' }, { label: '水凝胶' }]
425   - },
426   - {
427   - label: '含水量',
428   - id: '174',
429   - children: [
430   - { label: '0-40%' },
431   - { label: '40-44%' },
432   - { label: '45%以上' }
433   - ]
434   - },
435   - {
436   - label: '基弧',
437   - id: '178',
438   - children: [{ label: '0.0-8.4' }, { label: '8.4以上' }]
439   - },
440   - {
441   - label: '直径',
442   - id: '181',
443   - children: [{ label: '13.4-14' }, { label: '14以上' }]
444   - },
445   - {
446   - label: '中心厚度',
447   - id: '184',
448   - children: [
449   - { label: '0.0 - 0.03' },
450   - { label: '0.04 - 0.09' },
451   - { label: '0.1以上' }
452   - ]
453   - },
454   - { label: '销售保障', id: '253', children: [] },
455   - { label: '赠品', id: '260', children: [] }
456   - ]
457   - },
458   - {
459   - label: '特种镜',
460   - id: '146',
461   - children: [
462   - {
463   - label: '镜面颜色',
464   - id: '237',
465   - children: [{ label: '透明' }, { label: '亮金色' }]
466   - },
467   - {
468   - label: '品牌',
469   - id: '238',
470   - children: [{ label: '宁哥牌' }, { label: '秀野牌' }]
471   - },
472   - {
473   - label: '销售保障',
474   - id: '254',
475   - children: [{ label: '包退' }, { label: '包换' }]
476   - },
477   - {
478   - label: '功能',
479   - id: '268',
480   - children: [
481   - { label: '防风镜' },
482   - { label: '防爆溅工作镜' },
483   - { label: '泳镜' },
484   - { label: '智能镜' }
485   - ]
486   - }
487   - ]
488   - }
489   - ],
490   - defaultProps: {
491   - children: 'children',
492   - label: 'label'
493   - }
  17 +
494 18 }
495 19 },
496 20 methods: {
497   - getCheckedNodes() {
498   - console.log(this.$refs.tree.getCheckedNodes())
499   - },
500   - getCheckedKeys() {
501   - console.log(this.$refs.tree.getCheckedKeys())
502   - },
503   - addNode() {
504   - let h
505   - this.$message({
506   - message: h('p', null, [
507   - h('span', null, '添加一个新节点 ')
508   - // h("i", { style: "color: teal" }, "VNode")
509   - ])
510   - })
511   - },
512   - append(data) {
513   - const newChild = { id: id++, label: 'testtest', children: [] }
514   - if (!data.children) {
515   - this.$set(data, 'children', [])
516   - }
517   - data.children.push(newChild)
518   - },
519   - remove(node, data) {
520   - // 删除
521   - const parent = node.parent
522   - const children = parent.data.children || parent.data
523   - const index = children.findIndex(d => d.id === data.id)
524   - children.splice(index, 1)
525   - },
526   - rightKey(node, data) {
527   - // 右键
528   - const h = this.$createElement
529   - // console.log(data, this.$refs.tree);
530   - this.$message({
531   - message: h('p', null, [
532   - h('span', null, '右键了啊! ' + node + data),
533   - h('i', { style: 'color: teal' }, 'VNode')
534   - ])
535   - })
536   - },
537   - update(node, data) {
538   - // 更新
539   - const h = this.$createElement
540   - this.$message({
541   - message: h('p', null, [
542   - h('span', null, '内容可以是 '),
543   - h('i', { style: 'color: teal' }, 'VNode')
544   - ])
545   - })
546   - },
547   - setCheckedNodes() {
548   - this.$refs.tree.setCheckedNodes([
549   - {
550   - id: 5,
551   - label: '二级 2-1'
552   - },
553   - {
554   - id: 9,
555   - label: '三级 1-1-1'
556   - }
557   - ])
558   - },
559   - setCheckedKeys() {
560   - this.$refs.tree.setCheckedKeys([3])
561   - },
562   - resetChecked() {
563   - this.$refs.tree.setCheckedKeys([])
564   - }
565 21 }
566 22 }
567 23 </script>
568 24 <style>
569   -.custom-tree-node {
570   - flex: 1;
571   - display: flex;
572   - align-items: center;
573   - justify-content: space-between;
574   - font-size: 14px;
575   - padding-right: 8px;
576   -}
577 25 </style>
... ...