zhaoxiaoqiang
2022-08-05 a16a5dc8235c565db7858faa28a82956989a025f
src/router/index.js
@@ -1,8 +1,8 @@
/*
 * @Author: 小明丶
 * @Date: 2019-08-19 15:23:17
 * @LastEditors: zxq
 * @LastEditTime: 2022-08-02 17:27:35
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-10-28 17:34:08
 * @Description:
 */
import Vue from "vue";
@@ -25,14 +25,16 @@
// 全局前置守卫:页面跳转前拦截
router.beforeEach((to, from, next) => {
    if(to.meta.isLogin){
        next()
    }else{
        // 需要登录的页面
        if(Store.state.sessionId){
            next()
        }else{
            
            next('/login')
            next('/')
        }
    }
})