diff --git a/.env.dev b/.env.dev index dc7d250..151151b 100644 --- a/.env.dev +++ b/.env.dev @@ -3,8 +3,8 @@ NODE_ENV=production VITE_DEV=true -# 请求路径 -VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn' +# 请求路径 /adminInspect +VITE_BASE_URL='http://localhost:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 VITE_UPLOAD_TYPE=server @@ -21,8 +21,8 @@ VITE_DROP_CONSOLE=false # 是否sourcemap VITE_SOURCEMAP=true -# 打包路径 -VITE_BASE_PATH=/ +# 打包路径 inspect +VITE_BASE_PATH=/inspect # 输出路径 VITE_OUT_DIR=dist diff --git a/.eslintrc.js b/.eslintrc.js index 7117c6f..72b71de 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,8 +21,7 @@ module.exports = defineConfig({ 'plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'prettier', - 'plugin:prettier/recommended', - '@unocss' + 'plugin:prettier/recommended' ], rules: { '@typescript-eslint/no-this-alias': 'off', @@ -69,8 +68,6 @@ module.exports = defineConfig({ ], 'vue/multi-word-component-names': 'off', 'vue/no-v-html': 'off', - 'prettier/prettier': 'off', // 芋艿:默认关闭 prettier 的 ESLint 校验,因为我们使用的是 IDE 的 Prettier 插件 - '@unocss/order': 'off', // 芋艿:禁用 unocss 【css】顺序的提示,因为暂时不需要这么严格,警告也有点繁琐 - '@unocss/order-attributify': 'off' // 芋艿:禁用 unocss 【属性】顺序的提示,因为暂时不需要这么严格,警告也有点繁琐 + 'prettier/prettier': 'off' } }) diff --git a/package.json b/package.json index f4c1142..fd375a7 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "dev-server": "vite --mode dev", "ts:check": "vue-tsc --noEmit", "build:local": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build", - "build:dev": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode dev", + "build:dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode dev", "build:test": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode test", "build:stage": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode stage", "build:prod": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode prod", @@ -67,6 +67,7 @@ "sortablejs": "^1.15.3", "steady-xml": "^0.1.0", "url": "^0.11.3", + "validator": "^13.15.0", "video.js": "^7.21.5", "viewerjs": "^1.11.7", "vue": "3.5.12", @@ -93,6 +94,7 @@ "@types/nprogress": "^0.2.3", "@types/qrcode": "^1.5.5", "@types/qs": "^6.9.12", + "@types/validator": "^13.15.0", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "@unocss/eslint-config": "^0.57.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bbea8d8..849fd46 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -134,6 +134,9 @@ importers: url: specifier: ^0.11.3 version: 0.11.4 + validator: + specifier: ^13.15.0 + version: 13.15.0 video.js: specifier: ^7.21.5 version: 7.21.6 @@ -207,6 +210,9 @@ importers: '@types/qs': specifier: ^6.9.12 version: 6.9.17 + '@types/validator': + specifier: ^13.15.0 + version: 13.15.0 '@typescript-eslint/eslint-plugin': specifier: ^7.1.0 version: 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.3.3))(eslint@8.57.1)(typescript@5.3.3) @@ -215,7 +221,7 @@ importers: version: 7.18.0(eslint@8.57.1)(typescript@5.3.3) '@unocss/eslint-config': specifier: ^0.57.4 - version: 0.57.7(eslint@8.57.1)(typescript@5.3.3) + version: 0.57.4(eslint@8.57.1)(typescript@5.3.3) '@unocss/transformer-variant-group': specifier: ^0.58.5 version: 0.58.9 @@ -1913,6 +1919,9 @@ packages: '@types/trusted-types@2.0.7': resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} + '@types/validator@13.15.0': + resolution: {integrity: sha512-nh7nrWhLr6CBq9ldtw0wx+z9wKnnv/uTVLA9g/3/TcOYxbpOSZE+MhKPmWqU+K0NvThjhv12uD8MuqijB0WzEA==} + '@types/video.js@7.3.58': resolution: {integrity: sha512-1CQjuSrgbv1/dhmcfQ83eVyYbvGyqhTvb2Opxr0QCV+iJ4J6/J+XWQ3Om59WiwCd1MN3rDUHasx5XRrpUtewYQ==} @@ -2033,26 +2042,26 @@ packages: engines: {node: '>=14'} hasBin: true - '@unocss/config@0.57.7': - resolution: {integrity: sha512-UG8G9orWEdk/vyDvGUToXYn/RZy/Qjpx66pLsaf5wQK37hkYsBoReAU5v8Ia/6PL1ueJlkcNXLaNpN6/yVoJvg==} + '@unocss/config@0.57.4': + resolution: {integrity: sha512-Si0fA6fb6kLymgWbXvgM50PtX8zKV5p+BMeAn17ihefnasjg0fdPe1Zgdj/QdLJpwIcJ5yOw3uFwVgrOYRqIfQ==} engines: {node: '>=14'} '@unocss/config@0.58.9': resolution: {integrity: sha512-90wRXIyGNI8UenWxvHUcH4l4rgq813MsTzYWsf6ZKyLLvkFjV2b2EfGXI27GPvZ7fVE1OAqx+wJNTw8CyQxwag==} engines: {node: '>=14'} - '@unocss/core@0.57.7': - resolution: {integrity: sha512-1d36M0CV3yC80J0pqOa5rH1BX6g2iZdtKmIb3oSBN4AWnMCSrrJEPBrUikyMq2TEQTrYWJIVDzv5A9hBUat3TA==} + '@unocss/core@0.57.4': + resolution: {integrity: sha512-JXufixa501p7+uwUkfG9voIUvNYXv58shZCKXO4Q9AojOzOMu6TDj35x8f3Sv5WFtZ3tp03sIETAfQRo7ksshw==} '@unocss/core@0.58.9': resolution: {integrity: sha512-wYpPIPPsOIbIoMIDuH8ihehJk5pAZmyFKXIYO/Kro98GEOFhz6lJoLsy6/PZuitlgp2/TSlubUuWGjHWvp5osw==} - '@unocss/eslint-config@0.57.7': - resolution: {integrity: sha512-EJlI6rV0ZfDCphIiddHSWZVeoHdYDTVohVXGo+NfNOuRuvYWGna3n4hY3VEAiT3mWLK0/0anzHF7X0PNzCR5lQ==} + '@unocss/eslint-config@0.57.4': + resolution: {integrity: sha512-YQqTwVFmPFS2E65ZWA4WI/1c75GAMAmAEDoqItOWOu/Qf7FZZ2Fx15hOygzpdgDnYMbGVXezYz9BYedzJW9ePg==} engines: {node: '>=14'} - '@unocss/eslint-plugin@0.57.7': - resolution: {integrity: sha512-nwj7UJF7wCfPVl5B7cUB0xrSk6yuVMdMgABnsy4N5xBlds8cclrUO+boaTB9qzh8Lg9nfJVLB3+cW3po2SJoew==} + '@unocss/eslint-plugin@0.57.4': + resolution: {integrity: sha512-FeaabugemDJaCHrSYtIVL94m5fRZRkE0S65clL2dMAtoBiR0gevxzWXAdwW4OxI93b81tufWF7o+toFvS9E9kA==} engines: {node: '>=14'} '@unocss/extractor-arbitrary-variants@0.58.9': @@ -5643,6 +5652,10 @@ packages: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} hasBin: true + validator@13.15.0: + resolution: {integrity: sha512-36B2ryl4+oL5QxZ3AzD0t5SsMNGvTtQHpjgFO5tbNxfXbMFkY822ktCDe1MnlqV3301QQI9SLHDNJokDI+Z9pA==} + engines: {node: '>= 0.10'} + vary@1.1.2: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} @@ -7650,6 +7663,8 @@ snapshots: '@types/trusted-types@2.0.7': optional: true + '@types/validator@13.15.0': {} + '@types/video.js@7.3.58': {} '@types/web-bluetooth@0.0.16': {} @@ -7821,9 +7836,9 @@ snapshots: transitivePeerDependencies: - rollup - '@unocss/config@0.57.7': + '@unocss/config@0.57.4': dependencies: - '@unocss/core': 0.57.7 + '@unocss/core': 0.57.4 unconfig: 0.3.13 '@unocss/config@0.58.9': @@ -7831,23 +7846,23 @@ snapshots: '@unocss/core': 0.58.9 unconfig: 0.3.13 - '@unocss/core@0.57.7': {} + '@unocss/core@0.57.4': {} '@unocss/core@0.58.9': {} - '@unocss/eslint-config@0.57.7(eslint@8.57.1)(typescript@5.3.3)': + '@unocss/eslint-config@0.57.4(eslint@8.57.1)(typescript@5.3.3)': dependencies: - '@unocss/eslint-plugin': 0.57.7(eslint@8.57.1)(typescript@5.3.3) + '@unocss/eslint-plugin': 0.57.4(eslint@8.57.1)(typescript@5.3.3) transitivePeerDependencies: - eslint - supports-color - typescript - '@unocss/eslint-plugin@0.57.7(eslint@8.57.1)(typescript@5.3.3)': + '@unocss/eslint-plugin@0.57.4(eslint@8.57.1)(typescript@5.3.3)': dependencies: '@typescript-eslint/utils': 6.21.0(eslint@8.57.1)(typescript@5.3.3) - '@unocss/config': 0.57.7 - '@unocss/core': 0.57.7 + '@unocss/config': 0.57.4 + '@unocss/core': 0.57.4 magic-string: 0.30.14 synckit: 0.8.8 transitivePeerDependencies: @@ -11968,6 +11983,8 @@ snapshots: uuid@10.0.0: {} + validator@13.15.0: {} + vary@1.1.2: {} video.js@7.21.6: diff --git a/src/layout/components/Menu/src/components/useRenderMenuItem.tsx b/src/layout/components/Menu/src/components/useRenderMenuItem.tsx index 301313f..5875ebf 100644 --- a/src/layout/components/Menu/src/components/useRenderMenuItem.tsx +++ b/src/layout/components/Menu/src/components/useRenderMenuItem.tsx @@ -9,13 +9,19 @@ const { renderMenuTitle } = useRenderMenuTitle() export const useRenderMenuItem = () => // allRouters: AppRouteRecordRaw[] = [], { - const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => { - return routers + const renderMenuItem = (routers: AppRouteRecordRaw[] = [], parentPath = '/') => { + return (routers || []) .filter((v) => !v.meta?.hidden) .map((v) => { const meta = v.meta ?? {} const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v) - const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath(allRouters, v.path).join('/') + // 确保 v.path 存在且为字符串 + const currentPath = v.path || '' + const fullPath = isUrl(currentPath) + ? currentPath + : currentPath.startsWith('/') + ? currentPath + : pathResolve(parentPath, currentPath) if ( oneShowingChild && @@ -24,7 +30,11 @@ export const useRenderMenuItem = () => ) { return ( {{ default: () => renderMenuTitle(onlyOneChild ? onlyOneChild?.meta : meta)