From 75f043dfa6660716364e66ee0b3cf99f44255686 Mon Sep 17 00:00:00 2001
From: DYL0109 <dn18191638832@163.com>
Date: 星期三, 16 四月 2025 19:20:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/develop1.0' into dyl_dev

---
 zhitan-vue/src/store/modules/permission.js |   64 ++++++++++++++++++++++++++++++--
 1 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/zhitan-vue/src/store/modules/permission.js b/zhitan-vue/src/store/modules/permission.js
index 958fe63..5613f1c 100644
--- a/zhitan-vue/src/store/modules/permission.js
+++ b/zhitan-vue/src/store/modules/permission.js
@@ -56,8 +56,27 @@
   })
 
 // 閬嶅巻鍚庡彴浼犳潵鐨勮矾鐢卞瓧绗︿覆锛岃浆鎹负缁勪欢瀵硅薄
-function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
+function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false, parentRoute = null) {
   return asyncRouterMap.filter(route => {
+    // 涓嶅啀杩囨护鎺夐椤电湅鏉跨浉鍏宠矾鐢�
+    /* 
+    // 杩囨护鎺夐椤电湅鏉跨浉鍏宠矾鐢�
+    if (route.name === 'Index' && route.meta && route.meta.title === '棣栭〉鐪嬫澘') {
+      return false;
+    }
+    
+    // 濡傛灉鏄椤电湅鏉跨殑瀛愯彍鍗曪紝涔熻繃婊ゆ帀
+    if (route.path === '/index' || route.path === 'index' || 
+        (route.meta && route.meta.title === '棣栭〉鐪嬫澘')) {
+      return false;
+    }
+    */
+    
+    // 璁剧疆鐖惰矾鐢卞紩鐢�
+    if (parentRoute) {
+      route.parent = parentRoute;
+    }
+    
     if (type && route.children) {
       route.children = filterChildren(route.children)
     }
@@ -73,8 +92,17 @@
         route.component = loadView(route.component)
       }
     }
+    // 澶勭悊 query 鍙傛暟锛屽皢瀛楃涓茶浆鎹负瀵硅薄
+    if (route.query && typeof route.query === 'string') {
+      try {
+        route.query = JSON.parse(route.query);
+      } catch (error) {
+        console.error('Error parsing query string:', route.query, error);
+      }
+    }
     if (route.children != null && route.children && route.children.length) {
-      route.children = filterAsyncRouter(route.children, route, type)
+      // 灏嗗綋鍓嶈矾鐢变綔涓虹埗璺敱浼犻�掔粰瀛愯矾鐢�
+      route.children = filterAsyncRouter(route.children, route, type, route)
     } else {
       delete route['children']
       delete route['redirect']
@@ -89,7 +117,21 @@
     if (el.children && el.children.length) {
       if (el.component === 'ParentView' && !lastRouter) {
         el.children.forEach(c => {
-          c.path = el.path + '/' + c.path
+          // 璁剧疆鐖惰矾鐢卞紩鐢�
+          c.parent = el;
+          
+          // 纭繚璺緞鏍煎紡姝g‘鎷兼帴
+          if (el.path) {
+            if (c.path.startsWith('/')) {
+              // 缁濆璺緞淇濇寔涓嶅彉
+              // 浣嗕篃璁剧疆鍘熷鐖惰矾寰勭敤浜庤彍鍗曞鑸�
+              c.parentPath = el.path;
+            } else {
+              // 鐩稿璺緞闇�瑕佹嫾鎺�
+              c.path = el.path.endsWith('/') ? el.path + c.path : el.path + '/' + c.path;
+            }
+          }
+          
           if (c.children && c.children.length) {
             children = children.concat(filterChildren(c.children, c))
             return
@@ -100,7 +142,21 @@
       }
     }
     if (lastRouter) {
-      el.path = lastRouter.path + '/' + el.path
+      // 璁剧疆鐖惰矾鐢卞紩鐢�
+      el.parent = lastRouter;
+      
+      // 纭繚璺緞鏍煎紡姝g‘鎷兼帴
+      if (lastRouter.path) {
+        if (el.path.startsWith('/')) {
+          // 缁濆璺緞淇濇寔涓嶅彉 
+          // 浣嗕篃璁剧疆鍘熷鐖惰矾寰勭敤浜庤彍鍗曞鑸�
+          el.parentPath = lastRouter.path;
+        } else {
+          // 鐩稿璺緞闇�瑕佹嫾鎺�
+          el.path = lastRouter.path.endsWith('/') ? lastRouter.path + el.path : lastRouter.path + '/' + el.path;
+        }
+      }
+      
       if (el.children && el.children.length) {
         children = children.concat(filterChildren(el.children, el))
         return

--
Gitblit v1.9.3