From 362b2f5863acc5f9ea5ffb6e73cb21c22849b65d Mon Sep 17 00:00:00 2001 From: zyh Date: Thu, 9 Mar 2023 18:06:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix=EF=BC=9A=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=20=E7=9B=B4=E6=8E=A5=E8=BF=94=E5=9B=9E=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/layout/header.vue | 3 +-- nezha-fronted/src/http.js | 4 ++-- nezha-fronted/src/permission.js | 6 ++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/nezha-fronted/src/components/layout/header.vue b/nezha-fronted/src/components/layout/header.vue index ab7e5eb5e..25455384e 100644 --- a/nezha-fronted/src/components/layout/header.vue +++ b/nezha-fronted/src/components/layout/header.vue @@ -181,8 +181,7 @@ export default { logout () { this.$get('logout').then(() => { this.logoutSuccess() - window.location.href = '/' - // this.$router.push('/login') + window.location.href = '/ui/login' }) }, showPinDialog () { diff --git a/nezha-fronted/src/http.js b/nezha-fronted/src/http.js index e8c32eb4f..4d20b545f 100644 --- a/nezha-fronted/src/http.js +++ b/nezha-fronted/src/http.js @@ -103,11 +103,11 @@ axios.interceptors.response.use( return response } if (licenceErrorCode.indexOf(response.data.code) !== -1 && noJumpPath.indexOf(window.location.pathname) == -1) { - sessionStorage.setItem('nz-previous-page', router.currentRoute.fullPath + '1') + sessionStorage.setItem('nz-previous-page', router.currentRoute.fullPath) window.location.href = '/' } else if (response.status === 200) { if (accountErrorCode.indexOf(response.data.code) !== -1 && noJumpPath.indexOf(window.location.pathname) == -1) { - sessionStorage.setItem('nz-previous-page', router.currentRoute.fullPath + '2') + sessionStorage.setItem('nz-previous-page', router.currentRoute.fullPath) window.location.href = '/' } } else { diff --git a/nezha-fronted/src/permission.js b/nezha-fronted/src/permission.js index b6c13e019..8dafe8870 100644 --- a/nezha-fronted/src/permission.js +++ b/nezha-fronted/src/permission.js @@ -149,7 +149,7 @@ router.beforeEach((to, from, next) => { resolve() } else { localStorage.removeItem('nz-token') - sessionStorage.setItem('nz-previous-page', to.fullPath + '5') + sessionStorage.setItem('nz-previous-page', to.fullPath) next({ path: '/login' }) } }) @@ -180,7 +180,9 @@ router.beforeEach((to, from, next) => { if (loginWhiteList.indexOf(to.path) !== -1) { next() } else { - sessionStorage.setItem('nz-previous-page', to.fullPath + '6') + console.log(to.path) + console.log(from.path) + sessionStorage.setItem('nz-previous-page', to.fullPath) next({ path: '/login' }) } } From 5f7909365f8f7f29b14956fab75eda898c0e72ff Mon Sep 17 00:00:00 2001 From: zyh Date: Fri, 10 Mar 2023 09:05:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=EF=BC=9A=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=B8=85=E9=99=A4session?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/layout/header.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nezha-fronted/src/components/layout/header.vue b/nezha-fronted/src/components/layout/header.vue index 25455384e..13f09d3e6 100644 --- a/nezha-fronted/src/components/layout/header.vue +++ b/nezha-fronted/src/components/layout/header.vue @@ -180,8 +180,9 @@ export default { }, logout () { this.$get('logout').then(() => { + window.location.href = '/' this.logoutSuccess() - window.location.href = '/ui/login' + sessionStorage.removeItem('nz-previous-page') }) }, showPinDialog () { From 12d8f3f5b440817913809a9d322d2512a1e434e1 Mon Sep 17 00:00:00 2001 From: zyh Date: Fri, 10 Mar 2023 09:44:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix=EF=BC=9A=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/layout/header.vue | 3 +-- nezha-fronted/src/permission.js | 2 -- nezha-fronted/src/store/user.js | 3 ++- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nezha-fronted/src/components/layout/header.vue b/nezha-fronted/src/components/layout/header.vue index 13f09d3e6..84b5b0e66 100644 --- a/nezha-fronted/src/components/layout/header.vue +++ b/nezha-fronted/src/components/layout/header.vue @@ -180,9 +180,8 @@ export default { }, logout () { this.$get('logout').then(() => { - window.location.href = '/' this.logoutSuccess() - sessionStorage.removeItem('nz-previous-page') + window.location.href = '/' }) }, showPinDialog () { diff --git a/nezha-fronted/src/permission.js b/nezha-fronted/src/permission.js index 8dafe8870..165a35acd 100644 --- a/nezha-fronted/src/permission.js +++ b/nezha-fronted/src/permission.js @@ -180,8 +180,6 @@ router.beforeEach((to, from, next) => { if (loginWhiteList.indexOf(to.path) !== -1) { next() } else { - console.log(to.path) - console.log(from.path) sessionStorage.setItem('nz-previous-page', to.fullPath) next({ path: '/login' }) } diff --git a/nezha-fronted/src/store/user.js b/nezha-fronted/src/store/user.js index 5d680d3e8..e08dbca23 100644 --- a/nezha-fronted/src/store/user.js +++ b/nezha-fronted/src/store/user.js @@ -152,12 +152,13 @@ const user = { sessionStorage.removeItem('nz-previous-page') }) } else { - sessionStorage.removeItem('nz-previous-page') router.push({ path: path[0], query: { t: +new Date() } + }).then(() => { + sessionStorage.removeItem('nz-previous-page') }) } })