guhongwei 4 年 前
コミット
5c47fb37e5
2 ファイル変更7 行追加3 行削除
  1. 2 2
      src/store/live/adminLogin.js
  2. 5 1
      src/views/login.vue

+ 2 - 2
src/store/live/adminLogin.js

@@ -40,12 +40,12 @@ const actions = {
       localStorage.setItem('token', res.data);
       localStorage.setItem('type', 'FWJG');
       user = jwt.decode(res.data);
-      if (user.code == 'HNHGLY') {
+      console.log(user);
+      if (user.code == 'HNHGLY' && user.role == '1') {
         commit('setUser', user, { root: true });
         return res;
       }
     }
-    return res;
   },
   async updatePwd({ commit }, { id, ...data }) {
     const res = await this.$axios.$post(`${api.adminLoginInfo}/password/${id}`, data);

+ 5 - 1
src/views/login.vue

@@ -114,7 +114,11 @@ export default {
       data.code_phone = data.phone;
       let res = await this.adminLogin({ user: this.form });
       if (this.$checkRes(res)) {
-        this.$router.push({ path: '/adminCenter/homeIndex' });
+        if (res) {
+          this.$router.push({ path: '/adminCenter/homeIndex' });
+        } else {
+          this.$message.error('当前用户不是此平台用户,请更换账号登录');
+        }
       }
     },
     // 企业