gx
chenyc
2025-08-26 7e50470dc3e1297b226719c7e5b4357287e44b19
src/router/index.ts
@@ -39,18 +39,20 @@
    }
    // 看看有没有toke
    const token = Session.get('token')
    console.log(!token)
    if (to.path === '/login') {
    console.log(token,'token查看')
    if (to.path === '/login'|| to.path === '/HomeLoading'){
        console.log('进入了登录也或者是初始化页')
        next()
    } else {
        console.log('不是登录页')
        if (!token){
            console.log('没有token,去登录')
            next('/login')
        } else {
            console.log('---')
            console.log('有token,就随便看看')
            if (to.path === '/'){
                await userInfo.setPatientApi()
                console.log('去首页,设置患者信息')
                await userInfo.setPatientApi()
            }
            next()