This commit is contained in:
2026-01-29 10:43:43 +08:00
commit 4a76df3391
426 changed files with 74975 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import {useIsMobile, useToken} from "~/composables/configState";
/**
* @description 路由守卫
*/
export default defineNuxtRouteMiddleware((to, from) => {
const matchers = ['/user','/developer'];
if(matchers.includes(to.path)){
if(import.meta.client){
let token = useToken()
if(!token.value){
return navigateTo({
path: '/passport/login',
query: {
redirect: to.path
}
})
}
}
}
// 手机版跳转
if(import.meta.client) {
const mobile = useIsMobile();
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
if (isMobile) {
mobile.value = true;
if (to.path.indexOf('/m') < 0) {
// return window.location.href = `/m`
}
}
}
})