diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 8ed2eaa..ecfb97f 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -2,16 +2,16 @@ diff --git a/src/store/getters.js b/src/store/getters.js index df156c6..bc86946 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -17,6 +17,8 @@ const getters = { topbarRouters: (state) => state.permission.topbarRouters, defaultRoutes: (state) => state.permission.defaultRoutes, sidebarRouters: (state) => state.permission.sidebarRouters, - language: (state) => state.app.language + language: (state) => state.app.language, + + defaultUrl: (state) => state.user.defaultUrl } export default getters diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 2199cf7..94c5f0c 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -13,7 +13,9 @@ const user = { nickName: '', avatar: '', roles: [], - permissions: [] + permissions: [], + + defaultUrl: '/user/work' }, mutations: { @@ -40,6 +42,9 @@ const user = { }, SET_PERMISSIONS: (state, permissions) => { state.permissions = permissions + }, + SET_DEFAULTURL: (state, defaultUrl) => { + state.defaultUrl = defaultUrl } }, @@ -59,7 +64,8 @@ const user = { commit('SET_TOKEN', data.access_token) setExpiresIn(data.expires_in) commit('SET_EXPIRES_IN', data.expires_in) - resolve() + commit('SET_DEFAULTURL', data.defaultUrl) + resolve(data.defaultUrl) }) .catch((error) => { reject(error) diff --git a/src/views/login.vue b/src/views/login.vue index dab6767..4d9c330 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -156,8 +156,8 @@ export default { Cookies.remove("password"); Cookies.remove('rememberMe'); } - this.$store.dispatch("Login", this.loginForm).then(() => { - this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); + this.$store.dispatch("Login", this.loginForm).then((url) => { + this.$router.push({ path: url }).catch(()=>{}); }).catch(err => { if(err && err.message==='exists'){ this.$confirm(this.$t('system.crowdOut'), this.$t('system.tip'), {