Skip to content

Commit

Permalink
添加路由守卫
Browse files Browse the repository at this point in the history
  • Loading branch information
12ain committed Oct 18, 2019
1 parent fb89681 commit 894e32b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/login/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export default {
Toast(res.data.msg);
window.localStorage.setItem("uid", this.userLogin.uid);
window.localStorage.setItem("udept", res.data.data.udept);
window.localStorage.setItem("isLogined",true)
this.update({
uid: res.data.data.uid,
upsd: res.data.data.upsd,
Expand Down
3 changes: 1 addition & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ const router= new Router({
router.beforeEach((to, from, next) => {
if (to.meta.checkLogined) {
if (
window.localStorage.getItem("uid") &&
window.localStorage.getItem("upsd")
Boolean(window.localStorage.getItem("isLogined")) === true
) {
next();
} else {
Expand Down

0 comments on commit 894e32b

Please sign in to comment.