Browse Source

登录角色验证

psj 1 year ago
parent
commit
e412fbf86a
1 changed files with 34 additions and 3 deletions
  1. 34 3
      src/view/login/LoginRight.vue

+ 34 - 3
src/view/login/LoginRight.vue

@@ -107,6 +107,33 @@ export default {
               return;
             }
           }
+          var bool = false;
+          if(data[0]["SYSTEM_TYPE"] == "1"){
+            for(var i = 0 ; i < data[0].ROLE_LIST.length ;i++){
+              if(data[0].ROLE_LIST[i]["ROLE_ID"] == "1" || data[0].ROLE_LIST[i]["ROLE_ID"] == "25"){
+                bool = true;
+                break;
+              }
+            }
+          }
+
+          if(data[0]["SYSTEM_TYPE"] == "2"){
+            for(var i = 0 ; i < data[0].ROLE_LIST.length ;i++){
+              if(data[0].ROLE_LIST[i]["ROLE_ID"] == "1" || data[0].ROLE_LIST[i]["ROLE_ID"] == "0"){
+                bool = true;
+                break;
+              }
+            }
+          }
+          if(bool == false){
+            this.$message({
+              showClose: true,
+              message: '当前用户无登录权限!',
+              type: 'error'
+            });
+            return;
+          }
+
           //获取用户信息  0  1 163  173  174
           var usercode = data[0].USERID;
           var username = data[0].USERNAME;
@@ -114,10 +141,12 @@ export default {
           var unitname = data[0].UNIT_NAME;
           var lasttime = data[0].LAST_TIME;
           var changetime = data[0].CHANGE_TIME;
-          var role = data[0].ROLE_CODE;
+          var role = data[0].ROLE_LIST;
           var userkeycode = data[0]["TEMPUSERKEYCODE"];
           var role_uuid = data[0]["ROLE_UUID"];
           var change_time = data[0].CHANGE_TIME;
+          //判断用户角色,只有平台管理员和系统管理员可以登录
+
           //保存用户信息
           localStorage.setItem("zhfx_usercode", usercode);
           localStorage.setItem("zhfx_username", username);
@@ -152,8 +181,10 @@ export default {
             });
           }
         }else{
-          MessageBox.alert('登录失败!', '提示', {
-            confirmButtonText: '确定'
+          this.$message({
+            showClose: true,
+            message: '登录失败,请检查用户名密码是否正确!',
+            type: 'error'
           });
           this.draw();
         }