diff --git a/.env.development b/.env.development index c12a781..a247152 100644 --- a/.env.development +++ b/.env.development @@ -2,5 +2,7 @@ ENV = 'development' # base api -VUE_APP_BASE_API = http://hdcontract.ali251.langye.net -VUE_APP_OUT_URL = http://suzhouhedaooa.langye.net +VUE_APP_BASE_API = '' +#VUE_APP_OUT_URL = http://suzhouhedaooa.langye.net + +VUE_APP_OUT_URL = http://192.168.60.18:2021 diff --git a/.env.production b/.env.production index 15f6f87..6e819b9 100644 --- a/.env.production +++ b/.env.production @@ -3,4 +3,4 @@ ENV = 'production' # base api VUE_APP_BASE_API = '' -VUE_APP_OUT_URL = http://suzhouhedaooa.langye.net +VUE_APP_OUT_URL = http://192.168.60.18:2021 diff --git a/src/permission.js b/src/permission.js index 0e124be..febdc42 100644 --- a/src/permission.js +++ b/src/permission.js @@ -29,9 +29,13 @@ router.beforeEach(async (to, from, next) => { if (hasToken) { if (to.path === '/login') { // if is logged in, redirect to the home page - next({ - path: '/' - }) + console.log(to.fullPath) + await store.dispatch('user/resetToken') + + next(to.fullPath) + // next({ + // path: '/' + // }) NProgress.done() } else { // determine whether the user has obtained his permission roles through getInfo diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 383c7d7..556de8d 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -133,7 +133,8 @@ const actions = { commit, state }) { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { + console.log("logout",state.token) logout(state.token).then(() => { removeToken() // must remove token first resetRouter() diff --git a/src/views/login/index.vue b/src/views/login/index.vue index d5e53d6..c05748a 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -85,23 +85,25 @@ immediate: true } }, - created() { - var query = this.$route.query; - if (query.token && query.userid && query.tp) { + created() { + var query = this.$route.query; + if (query.token && query.userid && query.tp) { this.loading = true - this.$store.dispatch('user/loginskip', { - token: query.token, - tp: query.tp - }).then(() => { - this.$router.push({ - path: "/" - }) - this.loading = false - }).catch((error) => { - console.log(error) - this.loading = false - }) - } + console.log(query.token) + //this.$store.dispatch('user/logout') + this.$store.dispatch('user/loginskip', { + token: query.token, + tp: query.tp + }).then(() => { + this.$router.push({ + path: "/" + }) + this.loading = false + }).catch((error) => { + console.log(error) + this.loading = false + }) + } }, methods: { showPwd() { @@ -117,7 +119,7 @@ handleLogin() { this.$refs.loginForm.validate(valid => { if (valid) { - this.loading = true + this.loading = true; this.$store.dispatch('user/login', this.loginForm).then(() => { console.log(this.redirect) this.$router.push({ diff --git a/src/views/system/role.vue b/src/views/system/role.vue index cc44457..c43ad36 100644 --- a/src/views/system/role.vue +++ b/src/views/system/role.vue @@ -21,7 +21,14 @@ - + + + +