From aaf8a50511d77dbc209ca93bbba308c21179a8bc Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期二, 31 三月 2026 15:38:47 +0800
Subject: [PATCH] #前端

---
 rsf-design/src/router/guards/beforeEach.js |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/rsf-design/src/router/guards/beforeEach.js b/rsf-design/src/router/guards/beforeEach.js
index d49d94a..8a71148 100644
--- a/rsf-design/src/router/guards/beforeEach.js
+++ b/rsf-design/src/router/guards/beforeEach.js
@@ -99,20 +99,41 @@
   })
   return false
 }
+function normalizeRoutePathSegment(path = '') {
+  if (!path) {
+    return ''
+  }
+  return path.replace(/^\/+/, '').replace(/\/+$/, '')
+}
+
+function joinRoutePath(parentPath = '', childPath = '') {
+  if (!childPath) {
+    return parentPath || '/'
+  }
+  if (childPath.startsWith('/')) {
+    return childPath
+  }
+
+  const normalizedParent = parentPath === '/' ? '' : normalizeRoutePathSegment(parentPath)
+  const normalizedChild = normalizeRoutePathSegment(childPath)
+  const fullPath = [normalizedParent, normalizedChild].filter(Boolean).join('/')
+  return `/${fullPath}`.replace(/\/+/g, '/')
+}
+
 function isStaticRoute(path) {
-  const checkRoute = (routes, targetPath) => {
+  const checkRoute = (routes, targetPath, parentPath = '') => {
     return routes.some((route) => {
       if (route.name === 'Exception404') {
         return false
       }
-      const routePath = route.path
+      const routePath = joinRoutePath(parentPath, route.path)
       const pattern = routePath.replace(/:[^/]+/g, '[^/]+').replace(/\*/g, '.*')
       const regex = new RegExp(`^${pattern}$`)
       if (regex.test(targetPath)) {
         return true
       }
       if (route.children && route.children.length > 0) {
-        return checkRoute(route.children, targetPath)
+        return checkRoute(route.children, targetPath, routePath)
       }
       return false
     })

--
Gitblit v1.9.1