liugc 6 år sedan
förälder
incheckning
852ad0b2c9

+ 1
- 1
hksystem/build/env.js Visa fil

@@ -1 +1 @@
1
-export default "production";
1
+export default "development";

+ 5
- 0
hksystem/src/components/login/index.vue Visa fil

@@ -44,6 +44,11 @@ export default {
44 44
                 if (res.data.status === 0) {
45 45
                     Cookies.set('user', this.username);
46 46
                     Cookies.set('token', res.data.token);
47
+                    if (res.data.role == "admin") {
48
+                        Cookies.set("access", 1);
49
+                    } else {
50
+                        Cookies.set("access", 0);
51
+                    }
47 52
                     this.axios.defaults.headers.common['Authorization'] = "Bearer " + res.data.token;
48 53
                     this.show = false;
49 54
                 }

+ 1
- 1
hksystem/src/router/index.js Visa fil

@@ -38,7 +38,7 @@ router.beforeEach((to, from, next) => {
38 38
         } else {
39 39
             const curRouterObj = Util.getRouterObjByName([otherRouter, ...appRouter], to.name);
40 40
             if (curRouterObj && curRouterObj.access !== undefined) { // 需要判断权限的路由
41
-                if (curRouterObj.access === parseInt(Cookies.get('access'))) {
41
+                if (Util.oneOf(parseInt(Cookies.get('access')), curRouterObj.access)) {
42 42
                     Util.toDefaultPage([otherRouter, ...appRouter], to.name, router, next); // 如果在地址栏输入的是一级菜单则默认打开其第一个二级菜单的页面
43 43
                 } else {
44 44
                     next({

+ 25
- 31
hksystem/src/router/router.js Visa fil

@@ -77,6 +77,7 @@ export const appRouter = [{
77 77
                 path: 'housekeeper',
78 78
                 title: '通用服务订单',
79 79
                 name: 'order_housekeeper',
80
+                access: [0, 1],
80 81
                 component: resolve => {
81 82
                     require(['@/views/housekeeper/index.vue'], resolve);
82 83
                 }
@@ -85,6 +86,7 @@ export const appRouter = [{
85 86
                 path: 'matron',
86 87
                 title: '月嫂订单',
87 88
                 name: 'order_matron',
89
+                access: [1],
88 90
                 component: resolve => {
89 91
                     require(['@/views/matron/index.vue'], resolve);
90 92
                 }
@@ -93,6 +95,7 @@ export const appRouter = [{
93 95
                 path: 'product',
94 96
                 title: '母婴产品订单',
95 97
                 name: 'order_product',
98
+                access: [0, 1],
96 99
                 component: resolve => {
97 100
                     require(['@/views/product-order/index.vue'], resolve);
98 101
                 }
@@ -106,6 +109,7 @@ export const appRouter = [{
106 109
         icon: 'bag',
107 110
         name: 'product',
108 111
         title: '母婴产品管理',
112
+        access: [1],
109 113
         component: Main,
110 114
         children: [{
111 115
                 path: 'classify',
@@ -131,6 +135,7 @@ export const appRouter = [{
131 135
         name: 'service',
132 136
         title: '分类管理',
133 137
         component: Main,
138
+        access: [1],
134 139
         children: [{
135 140
             path: 'index',
136 141
             title: '分类管理',
@@ -145,6 +150,7 @@ export const appRouter = [{
145 150
         icon: 'social-usd',
146 151
         name: 'reward',
147 152
         title: '打赏金额',
153
+        access: [1],
148 154
         component: Main,
149 155
         children: [{
150 156
             path: 'index',
@@ -160,6 +166,7 @@ export const appRouter = [{
160 166
         icon: 'ios-person',
161 167
         name: 'introduce',
162 168
         title: '企业介绍',
169
+        access: [1],
163 170
         component: Main,
164 171
         children: [{
165 172
             path: 'index',
@@ -175,6 +182,7 @@ export const appRouter = [{
175 182
         icon: 'home',
176 183
         name: 'image',
177 184
         title: '首页介绍和图片配置',
185
+        access: [1],
178 186
         component: Main,
179 187
         children: [{
180 188
             path: 'index',
@@ -242,42 +250,28 @@ export const appRouter = [{
242 250
     // }
243 251
 ];
244 252
 
245
-// var other = [{
246
-//         path: '/banner',
247
-//         icon: 'images',
248
-//         name: 'banner',
249
-//         title: 'banner轮播图',
250
-//         component: Main,
251
-//         children: [{
252
-//             path: 'index',
253
-//             title: 'banner轮播图',
254
-//             name: 'banner_index',
255
-//             component: resolve => {
256
-//                 require(['@/views/banner/banner.vue'], resolve);
257
-//             }
258
-//         }]
259
-//     },
260
-//     {
261
-//         path: '/homework',
262
-//         icon: 'images',
263
-//         name: 'homework',
264
-//         title: '家政详情',
265
-//         component: Main,
266
-//         children: [{
267
-//             path: 'index',
268
-//             title: '家政详情',
269
-//             name: 'homework_index',
270
-//             component: resolve => {
271
-//                 require(['@/views/homework/homework.vue'], resolve);
272
-//             }
273
-//         }]
274
-//     }
275
-// ];
253
+var other = [{
254
+        path: '/banner',
255
+        icon: 'images',
256
+        name: 'banner',
257
+        title: 'banner轮播图',
258
+        component: Main,
259
+        children: [{
260
+            path: 'index',
261
+            title: 'banner轮播图',
262
+            name: 'banner_index',
263
+            component: resolve => {
264
+                require(['@/views/banner/banner.vue'], resolve);
265
+            }
266
+        }]
267
+    }
268
+];
276 269
 
277 270
 // 所有上面定义的路由都要写在下面的routers里
278 271
 export const routers = [
279 272
     loginRouter,
280 273
     otherRouter,
274
+    ...other,
281 275
     locking,
282 276
     ...appRouter,
283 277
     page500,

+ 40
- 0
hksystem/src/views/banner/banner.less Visa fil

@@ -27,4 +27,44 @@
27 27
             height: 200px;
28 28
         }
29 29
     }
30
+}
31
+.upload-list {
32
+    display: inline-block;
33
+    height: 60px;
34
+}
35
+.admin-upload-list{
36
+    display: inline-block;
37
+    width: 60px;
38
+    height: 60px;
39
+    text-align: center;
40
+    line-height: 60px;
41
+    border: 1px solid transparent;
42
+    border-radius: 4px;
43
+    overflow: hidden;
44
+    background: #fff;
45
+    position: relative;
46
+    box-shadow: 0 1px 1px rgba(0,0,0,.2);
47
+    margin-right: 4px;
48
+}
49
+.admin-upload-list img{
50
+    width: 100%;
51
+    height: 100%;
52
+}
53
+.admin-upload-list-cover{
54
+    display: none;
55
+    position: absolute;
56
+    top: 0;
57
+    bottom: 0;
58
+    left: 0;
59
+    right: 0;
60
+    background: rgba(0,0,0,.6);
61
+}
62
+.admin-upload-list:hover .admin-upload-list-cover{
63
+    display: block;
64
+}
65
+.admin-upload-list-cover i{
66
+    color: #fff;
67
+    font-size: 20px;
68
+    cursor: pointer;
69
+    margin: 0 2px;
30 70
 }

+ 5
- 8
hksystem/src/views/banner/banner.vue Visa fil

@@ -31,14 +31,7 @@
31 31
                                 <Icon type="camera" size="20"></Icon>
32 32
                             </div>
33 33
                         </Upload>
34
-                        <Modal title="查看图片" v-model="visible">
35
-                            <img :src="'https://o5wwk8baw.qnssl.com/' + imgName + '/large'" v-if="visible" style="width: 100%">
36
-                        </Modal>
37
-                    </Card>
38
-                </Col>
39
-                <Col span="16" class="padding-left-10">
40
-                    <Card>
41
-                        <div class="height-460px">
34
+                        <div class="upload-list">
42 35
                             <div class="admin-upload-list" v-for="item in uploadList" :key="item.url">
43 36
                                 <template v-if="item.status === 'finished'">
44 37
                                     <img :src="item.url">
@@ -52,6 +45,10 @@
52 45
                                 </template>
53 46
                             </div>
54 47
                         </div>
48
+                        
49
+                        <Modal title="查看图片" v-model="visible">
50
+                            <img :src="'https://o5wwk8baw.qnssl.com/' + imgName + '/large'" v-if="visible" style="width: 100%">
51
+                        </Modal>
55 52
                     </Card>
56 53
                 </Col>
57 54
             </div>

+ 5
- 0
hksystem/src/views/login.vue Visa fil

@@ -71,6 +71,11 @@ export default {
71 71
                         if (res.data.status === 0) {
72 72
                             Cookies.set('user', this.form.userName);
73 73
                             Cookies.set('token', res.data.token);
74
+                            if (res.data.role == "admin") {
75
+                                Cookies.set("access", 1);
76
+                            } else {
77
+                                Cookies.set("access", 0);
78
+                            }
74 79
                             this.axios.defaults.headers.common['Authorization'] = "Bearer " + res.data.token;
75 80
                             this.$router.push({
76 81
                                 name: 'home_index'

Loading…
Avbryt
Spara