| | |
| | | |
| | | /** 路由白名单 */ |
| | | const whiteList = ["/login"]; |
| | | const noLoginList = ["/index", "/register", "/registersucess"]; |
| | | const noLoginList = [ |
| | | "/index", |
| | | "/register", |
| | | "/registernav", |
| | | "/registersucess", |
| | | "/gonggaoDetail" |
| | | ]; |
| | | // const whiteList = []; |
| | | |
| | | const { VITE_HIDE_HOME } = import.meta.env; |
| | |
| | | if (!item.meta.title) return ""; |
| | | const Title = getConfig().Title; |
| | | if (Title) document.title = `${item.meta.title} | ${Title}`; |
| | | else document.title = item.meta.title as string; |
| | | else document.title = item.meta.title; |
| | | }); |
| | | } |
| | | /** 如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面 */ |
| | |
| | | } |
| | | if (Cookies.get(multipleTabsKey) && userInfo) { |
| | | // 无权限跳转403页面 |
| | | if (to.meta?.roles && !isOneOfArray(to.meta?.roles, userInfo?.exRoles)) { |
| | | if (to.meta?.roles && !isOneOfArray(to.meta?.roles, userInfo?.roles)) { |
| | | next({ path: "/error/403" }); |
| | | } |
| | | // 开启隐藏首页后在浏览器地址栏手动输入首页welcome路由则跳转到404页面 |
| | |
| | | } |
| | | } else { |
| | | if (to.path !== "/login") { |
| | | if (whiteList.indexOf(to.path) !== -1) { |
| | | if (noLoginList.indexOf(to.path) !== -1) { |
| | | next(); |
| | | } else { |
| | | // if (noLoginList.indexOf(to.path) == -1) { |
| | | next(); |
| | | // } else { |
| | | // removeToken(); |
| | | // next({ path: "/login" }); |
| | | // } |
| | | removeToken(); |
| | | next({ path: "/index" }); |
| | | } |
| | | } else { |
| | | next(); |