guhongwei 3 năm trước cách đây
mục cha
commit
5de32963c1
3 tập tin đã thay đổi với 12 bổ sung5 xóa
  1. 5 2
      src/store/adminLogin.js
  2. 6 2
      src/views/Login.vue
  3. 1 1
      vue.config.js

+ 5 - 2
src/store/adminLogin.js

@@ -39,9 +39,12 @@ const actions = {
     if (res.errcode === 0) {
       localStorage.setItem('token', res.data);
       user = jwt.decode(res.data);
-      commit('setUser', user, { root: true });
+      console.log(user);
+      if (user.code == 'WJDCXT') {
+        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);

+ 6 - 2
src/views/Login.vue

@@ -103,8 +103,12 @@ export default {
         if (valid) {
           let res = await this.login({ user: this.form });
           if (this.$checkRes(res)) {
-            this.$message.success('登录成功');
-            this.$router.push('/homeIndex');
+            if (res) {
+              this.$message.success('登录成功');
+              this.$router.push('/homeIndex');
+            } else {
+              this.$message.error('当前用户不是此平台用户,请更换账号登录');
+            }
           }
         } else {
           console.log('error submit!!');

+ 1 - 1
vue.config.js

@@ -25,7 +25,7 @@ module.exports = {
         target: 'http://broadcast.waityou24.cn',
       },
       '/api/question': {
-        target: 'http://192.168.1.19:9104',
+        target: 'http://broadcast.waityou24.cn',
         changeOrigin: true,
         ws: false,
       },