src/router/index.ts
@@ -36,18 +36,22 @@ document.title = to.meta.title } // 看看有没有toke const token = Session.get('token'); console.log(!token) const token = Session.get('token') console.log(!token) if (to.path === '/login') { next(); }else{ next() } else { if (!token){ next('/login'); }else{ next('/login') } else { console.log('---') await userInfo.setPatientApi() next(); if (to.path === '/'){ await userInfo.setPatientApi() await userInfo.setPatientApi() } next() } } })