Răsfoiți Sursa

fix: navigation 404

gin 5 zile în urmă
părinte
comite
b44e9882a1

+ 29 - 0
frontend/pnpm-lock.yaml

@@ -204,6 +204,9 @@ importers:
       nprogress:
       nprogress:
         specifier: ^0.2.0
         specifier: ^0.2.0
         version: 0.2.0
         version: 0.2.0
+      path:
+        specifier: ^0.12.7
+        version: 0.12.7
       pinia:
       pinia:
         specifier: ^2.1.4
         specifier: ^2.1.4
         version: 2.3.1(typescript@5.0.4)(vue@3.5.34(typescript@5.0.4))
         version: 2.3.1(typescript@5.0.4)(vue@3.5.34(typescript@5.0.4))
@@ -3995,6 +3998,9 @@ packages:
     resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
     resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
     deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
     deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
 
 
+  inherits@2.0.3:
+    resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==}
+
   inherits@2.0.4:
   inherits@2.0.4:
     resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
     resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
 
 
@@ -4774,6 +4780,9 @@ packages:
     resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
     resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
     engines: {node: '>=8'}
     engines: {node: '>=8'}
 
 
+  path@0.12.7:
+    resolution: {integrity: sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==}
+
   pathe@2.0.3:
   pathe@2.0.3:
     resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}
     resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}
 
 
@@ -5350,6 +5359,10 @@ packages:
   process-nextick-args@2.0.1:
   process-nextick-args@2.0.1:
     resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
     resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
 
 
+  process@0.11.10:
+    resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
+    engines: {node: '>= 0.6.0'}
+
   promise-polyfill@7.1.2:
   promise-polyfill@7.1.2:
     resolution: {integrity: sha512-FuEc12/eKqqoRYIGBrUptCBRhobL19PS2U31vMNTfyck1FxPyMfgsXyW4Mav85y/ZN1hop3hOwRlUDok23oYfQ==}
     resolution: {integrity: sha512-FuEc12/eKqqoRYIGBrUptCBRhobL19PS2U31vMNTfyck1FxPyMfgsXyW4Mav85y/ZN1hop3hOwRlUDok23oYfQ==}
 
 
@@ -6216,6 +6229,9 @@ packages:
   util-deprecate@1.0.2:
   util-deprecate@1.0.2:
     resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
     resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
 
 
+  util@0.10.4:
+    resolution: {integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==}
+
   uuid@8.3.2:
   uuid@8.3.2:
     resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
     resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
     hasBin: true
     hasBin: true
@@ -10917,6 +10933,8 @@ snapshots:
       once: 1.4.0
       once: 1.4.0
       wrappy: 1.0.2
       wrappy: 1.0.2
 
 
+  inherits@2.0.3: {}
+
   inherits@2.0.4: {}
   inherits@2.0.4: {}
 
 
   ini@1.3.8: {}
   ini@1.3.8: {}
@@ -11649,6 +11667,11 @@ snapshots:
 
 
   path-type@4.0.0: {}
   path-type@4.0.0: {}
 
 
+  path@0.12.7:
+    dependencies:
+      process: 0.11.10
+      util: 0.10.4
+
   pathe@2.0.3:
   pathe@2.0.3:
     optional: true
     optional: true
 
 
@@ -12160,6 +12183,8 @@ snapshots:
 
 
   process-nextick-args@2.0.1: {}
   process-nextick-args@2.0.1: {}
 
 
+  process@0.11.10: {}
+
   promise-polyfill@7.1.2: {}
   promise-polyfill@7.1.2: {}
 
 
   property-expr@2.0.6: {}
   property-expr@2.0.6: {}
@@ -13164,6 +13189,10 @@ snapshots:
 
 
   util-deprecate@1.0.2: {}
   util-deprecate@1.0.2: {}
 
 
+  util@0.10.4:
+    dependencies:
+      inherits: 2.0.3
+
   uuid@8.3.2: {}
   uuid@8.3.2: {}
 
 
   validate-html-nesting@1.2.4: {}
   validate-html-nesting@1.2.4: {}

+ 1 - 0
frontend/web/package.json

@@ -41,6 +41,7 @@
     "jsencrypt": "^3.3.2",
     "jsencrypt": "^3.3.2",
     "mitt": "^3.0.0",
     "mitt": "^3.0.0",
     "nprogress": "^0.2.0",
     "nprogress": "^0.2.0",
+    "path": "^0.12.7",
     "pinia": "^2.1.4",
     "pinia": "^2.1.4",
     "pinyin-pro": "^3.15.2",
     "pinyin-pro": "^3.15.2",
     "cropperjs": "^1.5.13",
     "cropperjs": "^1.5.13",

+ 2 - 4
frontend/web/src/layout/components/sidebar/sidebarItem.vue

@@ -1,4 +1,5 @@
 <script setup lang="ts">
 <script setup lang="ts">
+import path from "path";
 import { getConfig } from "@/config";
 import { getConfig } from "@/config";
 import { menuType } from "../../types";
 import { menuType } from "../../types";
 import extraIcon from "./extraIcon.vue";
 import extraIcon from "./extraIcon.vue";
@@ -174,10 +175,7 @@ function resolvePath(routePath) {
     return routePath || props.basePath;
     return routePath || props.basePath;
   } else {
   } else {
     // 使用path.posix.resolve替代path.resolve 避免windows环境下使用electron出现盘符问题
     // 使用path.posix.resolve替代path.resolve 避免windows环境下使用electron出现盘符问题
-    const segments = `${props.basePath}/${routePath}`
-      .split("/")
-      .filter(Boolean);
-    return `/${segments.join("/")}`;
+    return path.posix.resolve(props.basePath, routePath);
   }
   }
 }
 }
 </script>
 </script>