Explorar o código

账号密码登陆

panhui %!s(int64=5) %!d(string=hai) anos
pai
achega
3795b5ac0f
Modificáronse 2 ficheiros con 6 adicións e 12 borrados
  1. 1 0
      src/main/vue/src/views/Admin.vue
  2. 5 12
      src/main/vue/src/views/Login.vue

+ 1 - 0
src/main/vue/src/views/Admin.vue

@@ -217,6 +217,7 @@ export default {
             if (command === 'logout') {
                 localStorage.removeItem('token');
                 this.$store.commit('updateUserInfo', null);
+                this.$store.commit('updateOrganization', null);
                 this.$router.replace('/login');
             } else if (command === 'pwd') {
                 this.onShowPwdDialog();

+ 5 - 12
src/main/vue/src/views/Login.vue

@@ -280,21 +280,14 @@ export default {
                         })
                         .then(res => {
                             localStorage.setItem('token', res);
-                            return this.$http.get('/user/my');
+                            return this.$store.dispatch('getUserInfo');
                         })
                         .then(res => {
-                            this.loading = false;
-                            this.$store.commit('updateUserInfo', res);
-                            let flag = res.authorities.find(item => {
-                                return item.name == 'ROLE_ORGANIZER';
-                            });
-                            if (typeof flag != 'undefined') {
-                                this.$http.get('/organization/getByUserId/' + res.id).then(index => {
-                                    this.$store.commit('updateOrganization', index);
+                            this.$nextTick(() => {
+                                this.loading = false;
+                                this.$router.replace({
+                                    name: this.$route.params.name || 'dashboard'
                                 });
-                            }
-                            this.$router.replace({
-                                name: this.$route.params.name || 'dashboard'
                             });
                         })
                         .catch(e => {