登录优化

master
fanluyan 2 years ago
parent ec3b3d6a1d
commit 20920a0d1d

@ -46,6 +46,22 @@ Viewer.setDefaults({
zIndexInline: 9999, 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({ new Vue({
router, router,
store, 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();
}
});

@ -70,7 +70,7 @@ export default {
data: function () { data: function () {
return { return {
userInfo: { userInfo: {
userName: "xytest", userName: "admin",
password: "123456", password: "123456",
//verificationCode: "", //verificationCode: "",
}, },

@ -786,7 +786,7 @@ export default {
} }
} }
.el-loading-mask { .el-loading-mask {
z-index: 9999; z-index: 99;
} }
.picdropStyle, .picdropStyle,
.videodropStyle, .videodropStyle,

Loading…
Cancel
Save