From 20920a0d1d2328966a9dcb695981012161661a9b Mon Sep 17 00:00:00 2001 From: fanluyan <754122931@qq.com> Date: Wed, 24 May 2023 09:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 27 ++++++++++++++++----------- src/views/Login.vue | 2 +- src/views/realTimeMonitor/index.vue | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/main.js b/src/main.js index 71989d4..dbc2a96 100644 --- a/src/main.js +++ b/src/main.js @@ -46,6 +46,22 @@ Viewer.setDefaults({ zIndexInline: 9999, }); +//使用钩子函数对路由进行权限跳转 +router.beforeEach((to, from, next) => { + document.title = `${to.meta.title} | 视频监控可视化平台`; + const role = localStorage.getItem("userName"); + const token = localStorage.getItem("token"); + console.log(role, token); + if (!token && to.path !== "/login") { + //next("/login"); + next({ + path: "/login", + }); + } else { + next(); + } +}); + new Vue({ router, store, @@ -65,14 +81,3 @@ Vue.directive("debounce", { }); }, }); -//使用钩子函数对路由进行权限跳转 -router.beforeEach((to, from, next) => { - document.title = `${to.meta.title} | 视频监控可视化平台`; - const role = localStorage.getItem("userName"); - const token = localStorage.getItem("token"); - if (!token && to.path !== "/login") { - next("/login"); - } else { - next(); - } -}); diff --git a/src/views/Login.vue b/src/views/Login.vue index 8bdbfca..8b5192b 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -70,7 +70,7 @@ export default { data: function () { return { userInfo: { - userName: "xytest", + userName: "admin", password: "123456", //verificationCode: "", }, diff --git a/src/views/realTimeMonitor/index.vue b/src/views/realTimeMonitor/index.vue index 7892f81..44bbff4 100644 --- a/src/views/realTimeMonitor/index.vue +++ b/src/views/realTimeMonitor/index.vue @@ -786,7 +786,7 @@ export default { } } .el-loading-mask { - z-index: 9999; + z-index: 99; } .picdropStyle, .videodropStyle,