feat(web-admin): skip desktop chrome and login page inside mp webview routes.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
5eb7b0b193
commit
c0721786ff
3 files changed
+54
-3
No files matched your search
@@ -55,6 +55,7 @@ import { ApiStatus } from '@/utils/http/status'
|
||||
import { isHttpError } from '@/utils/http/error'
|
||||
import { RouteRegistry, MenuProcessor, IframeRouteManager, RoutePermissionValidator } from '../core'
|
||||
import { refreshMenuBadges } from '@/utils/menu-badge-registry'
|
||||
import { isMpWebviewPath } from '@/utils/mp-webview'
|
||||
|
||||
// 路由注册器实例
|
||||
let routeRegistry: RouteRegistry | null = null
|
||||
@@ -176,6 +177,11 @@ async function handleRouteGuard(
|
||||
|
||||
// 3. 处理动态路由注册
|
||||
if (!routeRegistry?.isRegistered() && userStore.isLogin) {
|
||||
if (isMpWebviewPath(to.path)) {
|
||||
setPageTitle(to)
|
||||
next()
|
||||
return
|
||||
}
|
||||
// 防止并发请求(快速连续导航场景)
|
||||
if (routeInitInProgress) {
|
||||
// 正在初始化中,等待完成后重新导航
|
||||
@@ -218,8 +224,13 @@ function handleLoginStatus(
|
||||
return false
|
||||
}
|
||||
|
||||
// 已登录或访问登录页或静态路由,直接放行
|
||||
if (userStore.isLogin || to.path === RoutesAlias.Login || isStaticRoute(to.path)) {
|
||||
// 已登录或访问登录页、静态路由、小程序 WebView 路由,直接放行
|
||||
if (
|
||||
userStore.isLogin ||
|
||||
to.path === RoutesAlias.Login ||
|
||||
isStaticRoute(to.path) ||
|
||||
isMpWebviewPath(to.path)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user