seimin %!s(int64=2) %!d(string=hai) anos
pai
achega
3f4f177d3c
Modificáronse 1 ficheiros con 29 adicións e 5 borrados
  1. 29 5
      src/views/Login.vue

+ 29 - 5
src/views/Login.vue

@@ -54,7 +54,7 @@ export default {
54
               "loginUser",
54
               "loginUser",
55
               JSON.stringify(res.data.user.requester)
55
               JSON.stringify(res.data.user.requester)
56
             );
56
             );
57
-            this.loginNext();
57
+            this.loginNext(res.data.user.requester);
58
           }
58
           }
59
         }
59
         }
60
       });
60
       });
@@ -77,7 +77,7 @@ export default {
77
                 "loginUser",
77
                 "loginUser",
78
                 JSON.stringify(res.data.user.requester)
78
                 JSON.stringify(res.data.user.requester)
79
               );
79
               );
80
-              this.loginNext();
80
+              this.loginNext(res.data.user.requester);
81
             }
81
             }
82
           } else if (res.data.state == 501) {
82
           } else if (res.data.state == 501) {
83
             that
83
             that
@@ -99,7 +99,31 @@ export default {
99
         });
99
         });
100
       }
100
       }
101
     },
101
     },
102
-    loginNext() {
102
+    // 判断角色
103
+    roleHandler(user,requester){
104
+      let isReq = false;
105
+      // let userRoles = user.role.map(v=>({id:v.id,rolecode:v.rolecode}));
106
+      // if(userRoles.length){
107
+      //   this.isService = userRoles.some(v=>(v.rolecode === 'call center' || v.rolecode === 'call center admin'))
108
+      //   this.isUser = userRoles.some(v=>(v.rolecode === 'first-line support' || v.rolecode === 'second-line support' || v.rolecode === 'incident manager' || v.rolecode === 'inspectman' || v.rolecode === 'incident-category-manager'))
109
+      // }else{
110
+      //   this.isService = false;
111
+      //   this.isUser = false;
112
+      // }
113
+      isReq = requester ? true : false;
114
+      if(isReq){
115
+        this.$router.push({ path: "/main" });
116
+      }else{
117
+        this.$createDialog({
118
+          type: "alert",
119
+          title: "提示",
120
+          content: "没有权限,无法进入!",
121
+          icon: "cubeic-wrong",
122
+          color: "red"
123
+        }).show();
124
+      }
125
+    },
126
+    loginNext(requester) {
103
       // seimin
127
       // seimin
104
       // 获取报修主体
128
       // 获取报修主体
105
       this.$http
129
       this.$http
@@ -135,7 +159,7 @@ export default {
135
                   break;
159
                   break;
136
               }
160
               }
137
             });
161
             });
138
-            this.$router.push({ path: "/main" });
162
+            this.roleHandler(null,requester);
139
           }
163
           }
140
         });
164
         });
141
       // seimin
165
       // seimin
@@ -190,7 +214,7 @@ export default {
190
           if (!requester.place || !requester.mphone) {
214
           if (!requester.place || !requester.mphone) {
191
             this.$router.push({ path: "/supplementary" });
215
             this.$router.push({ path: "/supplementary" });
192
           } else {
216
           } else {
193
-            this.loginNext();
217
+            this.loginNext(res.data.data.requester);
194
           }
218
           }
195
         } else {
219
         } else {
196
           that
220
           that