更新模板
This commit is contained in:
@@ -6,18 +6,7 @@ import { isNull, router, useStore } from "@/cool";
|
||||
* @param from 当前页
|
||||
* @param next 跳转函数
|
||||
*/
|
||||
// 全局路由拦截 - 已移除强制登录逻辑,支持游客模式浏览
|
||||
router.beforeEach((to, from, next) => {
|
||||
const { user } = useStore();
|
||||
|
||||
// 判断是否需要登录
|
||||
if (to.isAuth == true || (isNull(to.meta) ? true : to.meta.isAuth == true)) {
|
||||
// 如果用户信息为空,则跳转到登录页
|
||||
if (!user.isNull()) {
|
||||
next();
|
||||
} else {
|
||||
router.login();
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user