From 6b74b782230c86ac77e867c3f96f95a7073dfe44 Mon Sep 17 00:00:00 2001 From: wangpeng Date: Mon, 14 Jul 2025 17:33:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=90=8E=EF=BC=8C=E8=BF=94=E5=9B=9E=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2404?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/asyncRouter.js | 1 + src/layout/components/Navbar.vue | 10 ++++------ src/views/index/index.vue | 10 +++------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/asyncRouter.js b/src/asyncRouter.js index dc8cc25..d75f080 100644 --- a/src/asyncRouter.js +++ b/src/asyncRouter.js @@ -8,6 +8,7 @@ var routers router.beforeEach((to, from, next) => { if (to.path == `/login`) { sessionStorage.clear() + routers = null } if (sessionStorage.getItem('user')) { if (!routers) { diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index b1a297d..280c166 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -137,7 +137,7 @@ import Screenfull from '@/components/Screenfull' import SizeSelect from '@/components/SizeSelect' import { requestFN } from '@/utils/request' import { upload } from '@/utils/upload' -import { MessageBox } from 'element-ui' + export default { components: { Breadcrumb, @@ -362,13 +362,13 @@ export default { // this.fwebsocket.close() // this.fwebsocket && this.fwebsocket.close() sessionStorage.clear() - location.reload() + this.$router.push('/login') }) .catch((e) => { // this.fwebsocket.close() this.fwebsocket && this.fwebsocket.close() sessionStorage.clear() - location.reload() + this.$router.push('/login') }) }, changePassword() { @@ -402,12 +402,10 @@ export default { OPERATIONTYPE: '1' } ).then((data) => { if (this.userForm.newpwd) { - MessageBox.alert('密码修改成功,请重新登录!', { + this.$alert('密码修改成功,请重新登录!', { confirmButtonText: '确定', callback: action => { - sessionStorage.clear() this.goOut() - location.reload() } }) } else { diff --git a/src/views/index/index.vue b/src/views/index/index.vue index 2029a87..fd39fc8 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -131,12 +131,10 @@ export default { BZ: this.userForm.BZ, OPERATIONTYPE: '1' } ).then((data) => { - MessageBox.alert('密码修改成功,请重新登录!', { + this.$alert('密码修改成功,请重新登录!', { confirmButtonText: '确定', callback: action => { - sessionStorage.clear() this.goOut() - location.reload() } }) this.dialogFormEdit = false @@ -155,14 +153,12 @@ export default { ).then((data) => { // this.fwebsocket.close() sessionStorage.clear() - window.location.href = localStorage.getItem('out_url') - // window.location.href = 'http://192.168.0.112:8080/' + this.$router.push('/login') }) .catch((e) => { // this.fwebsocket.close() sessionStorage.clear() - window.location.href = localStorage.getItem('out_url') - // window.location.href = 'http://192.168.0.112:8080/' + this.$router.push('/login') }) }, closeWarn(){