Эх сурвалжийг харах

feat: 添加Authorization

Gaokun Wang 1 сар өмнө
parent
commit
b0e52a218e

+ 4 - 5
.husky/lint-staged-c.cjs

@@ -1,9 +1,8 @@
 module.exports = {
   '*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
-  '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --parser json --write'],
+  '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --write--parser json'],
   'package.json': ['prettier --write'],
-  '*.vue': ['prettier --write', 'stylelint --fix']
-  // '*.{scss,less,styl,css,html}': ['stylelint --fix', 'prettier --write'],
-  // '*.md': ['prettier --write'],
-  // '*.hbs': ['prettier --write']
+  '*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix'],
+  '*.{scss,less,styl,html}': ['stylelint --fix', 'prettier --write'],
+  '*.md': ['prettier --write']
 }

+ 3 - 5
package.json

@@ -28,7 +28,6 @@
     "@vueuse/core": "^13.5.0",
     "axios": "^1.10.0",
     "element-plus": "^2.10.3",
-    "js-cookie": "^3.0.5",
     "nprogress": "^0.2.0",
     "pinia": "^3.0.3",
     "pinia-plugin-persistedstate": "^4.4.1",
@@ -40,8 +39,7 @@
     "@commitlint/cli": "^19.8.1",
     "@commitlint/config-conventional": "^19.8.1",
     "@eslint/js": "^9.30.1",
-    "@types/js-cookie": "^3.0.6",
-    "@types/node": "^24.0.12",
+    "@types/node": "^24.0.13",
     "@types/nprogress": "^0.2.3",
     "@vitejs/plugin-vue": "^6.0.0",
     "@vitejs/plugin-vue-jsx": "^5.0.1",
@@ -49,7 +47,7 @@
     "@vue/eslint-config-typescript": "^14.6.0",
     "@vue/tsconfig": "^0.7.0",
     "commitizen": "^4.3.1",
-    "cz-git": "^1.11.2",
+    "cz-git": "^1.12.0",
     "eslint": "^9.30.1",
     "eslint-plugin-prettier": "^5.5.1",
     "eslint-plugin-vue": "^10.3.0",
@@ -71,7 +69,7 @@
     "unplugin-auto-import": "^19.3.0",
     "unplugin-icons": "^22.1.0",
     "unplugin-vue-components": "^28.8.0",
-    "vite": "^7.0.3",
+    "vite": "^7.0.4",
     "vite-plugin-ejs": "^1.7.0",
     "vite-plugin-svg-icons": "^2.0.1",
     "vite-plugin-vue-setup-extend": "^0.4.0",

+ 55 - 72
pnpm-lock.yaml

@@ -23,9 +23,6 @@ importers:
       element-plus:
         specifier: ^2.10.3
         version: 2.10.3(vue@3.5.17(typescript@5.8.3))
-      js-cookie:
-        specifier: ^3.0.5
-        version: 3.0.5
       nprogress:
         specifier: ^0.2.0
         version: 0.2.0
@@ -47,28 +44,25 @@ importers:
     devDependencies:
       '@commitlint/cli':
         specifier: ^19.8.1
-        version: 19.8.1(@types/node@24.0.12)(typescript@5.8.3)
+        version: 19.8.1(@types/node@24.0.13)(typescript@5.8.3)
       '@commitlint/config-conventional':
         specifier: ^19.8.1
         version: 19.8.1
       '@eslint/js':
         specifier: ^9.30.1
         version: 9.30.1
-      '@types/js-cookie':
-        specifier: ^3.0.6
-        version: 3.0.6
       '@types/node':
-        specifier: ^24.0.12
-        version: 24.0.12
+        specifier: ^24.0.13
+        version: 24.0.13
       '@types/nprogress':
         specifier: ^0.2.3
         version: 0.2.3
       '@vitejs/plugin-vue':
         specifier: ^6.0.0
-        version: 6.0.0(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))
+        version: 6.0.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))
       '@vitejs/plugin-vue-jsx':
         specifier: ^5.0.1
-        version: 5.0.1(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))
+        version: 5.0.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))
       '@vue/eslint-config-prettier':
         specifier: ^10.2.0
         version: 10.2.0(eslint@9.30.1(jiti@2.4.2))(prettier@3.6.2)
@@ -80,10 +74,10 @@ importers:
         version: 0.7.0(typescript@5.8.3)(vue@3.5.17(typescript@5.8.3))
       commitizen:
         specifier: ^4.3.1
-        version: 4.3.1(@types/node@24.0.12)(typescript@5.8.3)
+        version: 4.3.1(@types/node@24.0.13)(typescript@5.8.3)
       cz-git:
-        specifier: ^1.11.2
-        version: 1.11.2
+        specifier: ^1.12.0
+        version: 1.12.0
       eslint:
         specifier: ^9.30.1
         version: 9.30.1(jiti@2.4.2)
@@ -148,17 +142,17 @@ importers:
         specifier: ^28.8.0
         version: 28.8.0(@babel/parser@7.28.0)(vue@3.5.17(typescript@5.8.3))
       vite:
-        specifier: ^7.0.3
-        version: 7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
+        specifier: ^7.0.4
+        version: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
       vite-plugin-ejs:
         specifier: ^1.7.0
-        version: 1.7.0(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))
+        version: 1.7.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))
       vite-plugin-svg-icons:
         specifier: ^2.0.1
-        version: 2.0.1(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))
+        version: 2.0.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))
       vite-plugin-vue-setup-extend:
         specifier: ^0.4.0
-        version: 0.4.0(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))
+        version: 0.4.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))
       vue-tsc:
         specifier: ^2.2.12
         version: 2.2.12(typescript@5.8.3)
@@ -752,8 +746,8 @@ packages:
   '@rolldown/pluginutils@1.0.0-beta.19':
     resolution: {integrity: sha512-3FL3mnMbPu0muGOCaKAhhFEYmqv9eTfPSJRJmANrCwtgK8VuxpsZDGK+m0LYAGoyO8+0j5uRe4PeyPDK1yA/hA==}
 
-  '@rolldown/pluginutils@1.0.0-beta.24':
-    resolution: {integrity: sha512-NMiim/enJlffMP16IanVj1ajFNEg8SaMEYyxyYfJoEyt5EiFT3HUH/T2GRdeStNWp+/kg5U8DiJqnQBgLQ8uCw==}
+  '@rolldown/pluginutils@1.0.0-beta.26':
+    resolution: {integrity: sha512-r/5po89voz/QRPDmoErL10+hVuTAuz1SHvokx+yWBlOIPB5C41jC7QhLqq9kaebx/+EHyoV3z22/qBfX81Ns8A==}
 
   '@rollup/rollup-android-arm-eabi@4.44.2':
     resolution: {integrity: sha512-g0dF8P1e2QYPOj1gu7s/3LVP6kze9A7m6x0BZ9iTdXK8N5c2V7cpBKHV3/9A4Zd8xxavdhK0t4PnqjkqVmUc9Q==}
@@ -879,9 +873,6 @@ packages:
   '@types/estree@1.0.8':
     resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
 
-  '@types/js-cookie@3.0.6':
-    resolution: {integrity: sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==}
-
   '@types/json-schema@7.0.15':
     resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
 
@@ -894,8 +885,8 @@ packages:
   '@types/node-forge@1.3.12':
     resolution: {integrity: sha512-a0ToKlRVnUw3aXKQq2F+krxZKq7B8LEQijzPn5RdFAMatARD2JX9o8FBpMXOOrjob0uc13aN+V/AXniOXW4d9A==}
 
-  '@types/node@24.0.12':
-    resolution: {integrity: sha512-LtOrbvDf5ndC9Xi+4QZjVL0woFymF/xSTKZKPgrrl7H7XoeDvnD+E2IclKVDyaK9UM756W/3BXqSU+JEHopA9g==}
+  '@types/node@24.0.13':
+    resolution: {integrity: sha512-Qm9OYVOFHFYg3wJoTSrz80hoec5Lia/dPp84do3X7dZvLikQvM1YpmvTBEdIr/e+U8HTkFjLHLnl78K/qjf+jQ==}
 
   '@types/nprogress@0.2.3':
     resolution: {integrity: sha512-k7kRA033QNtC+gLc4VPlfnue58CM1iQLgn1IMAU8VPHGOj7oIHPp9UlhedEnD/Gl8evoCjwkZjlBORtZ3JByUA==}
@@ -1535,8 +1526,8 @@ packages:
     resolution: {integrity: sha512-U466fIzU5U22eES5lTNiNbZ+d8dfcHcssH4o7QsdWaCcRs/feIPCxKYSWkYBNs5mny7MvEfwpTLWjvbm94hecw==}
     engines: {node: '>= 10'}
 
-  cz-git@1.11.2:
-    resolution: {integrity: sha512-e54u6yJc80usJCWRQE9z8egpkqEvlM6aC70lTGjIsGI/ggtzeGU6udNAuHSBvLV+hMyss0ZS4KfodfwO9UJpqQ==}
+  cz-git@1.12.0:
+    resolution: {integrity: sha512-LaZ+8whPPUOo6Y0Zy4nIbf6JOleV3ejp41sT6N4RPKiKKA+ICWf4ueeIlxIO8b6JtdlDxRzHH/EcRji07nDxcg==}
     engines: {node: '>=v12.20.0'}
 
   dargs@8.1.0:
@@ -1689,8 +1680,8 @@ packages:
     engines: {node: '>=0.10.0'}
     hasBin: true
 
-  electron-to-chromium@1.5.180:
-    resolution: {integrity: sha512-ED+GEyEh3kYMwt2faNmgMB0b8O5qtATGgR4RmRsIp4T6p7B8vdMbIedYndnvZfsaXvSzegtpfqRMDNCjjiSduA==}
+  electron-to-chromium@1.5.182:
+    resolution: {integrity: sha512-Lv65Btwv9W4J9pyODI6EWpdnhfvrve/us5h1WspW8B2Fb0366REPtY3hX7ounk1CkV/TBjWCEvCBBbYbmV0qCA==}
 
   element-plus@2.10.3:
     resolution: {integrity: sha512-OLpf0iekuvWJrz1+H9ybvem6TYTKSNk6L1QDA3tYq2YWbogKXJnWpHG1UAGKR1B7gx+vUH7M15VIH3EijE9Kgw==}
@@ -2472,10 +2463,6 @@ packages:
   js-base64@2.6.4:
     resolution: {integrity: sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==}
 
-  js-cookie@3.0.5:
-    resolution: {integrity: sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==}
-    engines: {node: '>=14'}
-
   js-tokens@4.0.0:
     resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
 
@@ -3695,8 +3682,8 @@ packages:
     peerDependencies:
       vite: '>=2.0.0'
 
-  vite@7.0.3:
-    resolution: {integrity: sha512-y2L5oJZF7bj4c0jgGYgBNSdIu+5HF+m68rn2cQXFbGoShdhV1phX9rbnxy9YXj82aS8MMsCLAAFkRxZeWdldrQ==}
+  vite@7.0.4:
+    resolution: {integrity: sha512-SkaSguuS7nnmV7mfJ8l81JGBFV7Gvzp8IzgE8A8t23+AxuNX61Q5H1Tpz5efduSN7NHC8nQXD3sKQKZAu5mNEA==}
     engines: {node: ^20.19.0 || >=22.12.0}
     hasBin: true
     peerDependencies:
@@ -4037,11 +4024,11 @@ snapshots:
       '@babel/helper-string-parser': 7.27.1
       '@babel/helper-validator-identifier': 7.27.1
 
-  '@commitlint/cli@19.8.1(@types/node@24.0.12)(typescript@5.8.3)':
+  '@commitlint/cli@19.8.1(@types/node@24.0.13)(typescript@5.8.3)':
     dependencies:
       '@commitlint/format': 19.8.1
       '@commitlint/lint': 19.8.1
-      '@commitlint/load': 19.8.1(@types/node@24.0.12)(typescript@5.8.3)
+      '@commitlint/load': 19.8.1(@types/node@24.0.13)(typescript@5.8.3)
       '@commitlint/read': 19.8.1
       '@commitlint/types': 19.8.1
       tinyexec: 1.0.1
@@ -4088,7 +4075,7 @@ snapshots:
       '@commitlint/rules': 19.8.1
       '@commitlint/types': 19.8.1
 
-  '@commitlint/load@19.8.1(@types/node@24.0.12)(typescript@5.8.3)':
+  '@commitlint/load@19.8.1(@types/node@24.0.13)(typescript@5.8.3)':
     dependencies:
       '@commitlint/config-validator': 19.8.1
       '@commitlint/execute-rule': 19.8.1
@@ -4096,7 +4083,7 @@ snapshots:
       '@commitlint/types': 19.8.1
       chalk: 5.4.1
       cosmiconfig: 9.0.0(typescript@5.8.3)
-      cosmiconfig-typescript-loader: 6.1.0(@types/node@24.0.12)(cosmiconfig@9.0.0(typescript@5.8.3))(typescript@5.8.3)
+      cosmiconfig-typescript-loader: 6.1.0(@types/node@24.0.13)(cosmiconfig@9.0.0(typescript@5.8.3))(typescript@5.8.3)
       lodash.isplainobject: 4.0.6
       lodash.merge: 4.6.2
       lodash.uniq: 4.5.0
@@ -4430,7 +4417,7 @@ snapshots:
 
   '@rolldown/pluginutils@1.0.0-beta.19': {}
 
-  '@rolldown/pluginutils@1.0.0-beta.24': {}
+  '@rolldown/pluginutils@1.0.0-beta.26': {}
 
   '@rollup/rollup-android-arm-eabi@4.44.2':
     optional: true
@@ -4498,12 +4485,10 @@ snapshots:
 
   '@types/conventional-commits-parser@5.0.1':
     dependencies:
-      '@types/node': 24.0.12
+      '@types/node': 24.0.13
 
   '@types/estree@1.0.8': {}
 
-  '@types/js-cookie@3.0.6': {}
-
   '@types/json-schema@7.0.15': {}
 
   '@types/lodash-es@4.17.12':
@@ -4514,9 +4499,9 @@ snapshots:
 
   '@types/node-forge@1.3.12':
     dependencies:
-      '@types/node': 24.0.12
+      '@types/node': 24.0.13
 
-  '@types/node@24.0.12':
+  '@types/node@24.0.13':
     dependencies:
       undici-types: 7.8.0
 
@@ -4524,7 +4509,7 @@ snapshots:
 
   '@types/svgo@2.6.4':
     dependencies:
-      '@types/node': 24.0.12
+      '@types/node': 24.0.13
 
   '@types/web-bluetooth@0.0.16': {}
 
@@ -4622,21 +4607,21 @@ snapshots:
       '@typescript-eslint/types': 8.36.0
       eslint-visitor-keys: 4.2.1
 
-  '@vitejs/plugin-vue-jsx@5.0.1(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))':
+  '@vitejs/plugin-vue-jsx@5.0.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))':
     dependencies:
       '@babel/core': 7.28.0
       '@babel/plugin-transform-typescript': 7.28.0(@babel/core@7.28.0)
-      '@rolldown/pluginutils': 1.0.0-beta.24
+      '@rolldown/pluginutils': 1.0.0-beta.26
       '@vue/babel-plugin-jsx': 1.4.0(@babel/core@7.28.0)
-      vite: 7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
+      vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
       vue: 3.5.17(typescript@5.8.3)
     transitivePeerDependencies:
       - supports-color
 
-  '@vitejs/plugin-vue@6.0.0(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))':
+  '@vitejs/plugin-vue@6.0.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))':
     dependencies:
       '@rolldown/pluginutils': 1.0.0-beta.19
-      vite: 7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
+      vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
       vue: 3.5.17(typescript@5.8.3)
 
   '@volar/language-core@2.4.15':
@@ -5009,7 +4994,7 @@ snapshots:
   browserslist@4.25.1:
     dependencies:
       caniuse-lite: 1.0.30001727
-      electron-to-chromium: 1.5.180
+      electron-to-chromium: 1.5.182
       node-releases: 2.0.19
       update-browserslist-db: 1.1.3(browserslist@4.25.1)
 
@@ -5165,10 +5150,10 @@ snapshots:
 
   commander@7.2.0: {}
 
-  commitizen@4.3.1(@types/node@24.0.12)(typescript@5.8.3):
+  commitizen@4.3.1(@types/node@24.0.13)(typescript@5.8.3):
     dependencies:
       cachedir: 2.3.0
-      cz-conventional-changelog: 3.3.0(@types/node@24.0.12)(typescript@5.8.3)
+      cz-conventional-changelog: 3.3.0(@types/node@24.0.13)(typescript@5.8.3)
       dedent: 0.7.0
       detect-indent: 6.1.0
       find-node-modules: 2.1.3
@@ -5228,9 +5213,9 @@ snapshots:
       object-assign: 4.1.1
       vary: 1.1.2
 
-  cosmiconfig-typescript-loader@6.1.0(@types/node@24.0.12)(cosmiconfig@9.0.0(typescript@5.8.3))(typescript@5.8.3):
+  cosmiconfig-typescript-loader@6.1.0(@types/node@24.0.13)(cosmiconfig@9.0.0(typescript@5.8.3))(typescript@5.8.3):
     dependencies:
-      '@types/node': 24.0.12
+      '@types/node': 24.0.13
       cosmiconfig: 9.0.0(typescript@5.8.3)
       jiti: 2.4.2
       typescript: 5.8.3
@@ -5280,21 +5265,21 @@ snapshots:
 
   csstype@3.1.3: {}
 
-  cz-conventional-changelog@3.3.0(@types/node@24.0.12)(typescript@5.8.3):
+  cz-conventional-changelog@3.3.0(@types/node@24.0.13)(typescript@5.8.3):
     dependencies:
       chalk: 2.4.2
-      commitizen: 4.3.1(@types/node@24.0.12)(typescript@5.8.3)
+      commitizen: 4.3.1(@types/node@24.0.13)(typescript@5.8.3)
       conventional-commit-types: 3.0.0
       lodash.map: 4.6.0
       longest: 2.0.1
       word-wrap: 1.2.5
     optionalDependencies:
-      '@commitlint/load': 19.8.1(@types/node@24.0.12)(typescript@5.8.3)
+      '@commitlint/load': 19.8.1(@types/node@24.0.13)(typescript@5.8.3)
     transitivePeerDependencies:
       - '@types/node'
       - typescript
 
-  cz-git@1.11.2: {}
+  cz-git@1.12.0: {}
 
   dargs@8.1.0: {}
 
@@ -5446,7 +5431,7 @@ snapshots:
     dependencies:
       jake: 10.9.2
 
-  electron-to-chromium@1.5.180: {}
+  electron-to-chromium@1.5.182: {}
 
   element-plus@2.10.3(vue@3.5.17(typescript@5.8.3)):
     dependencies:
@@ -6341,8 +6326,6 @@ snapshots:
 
   js-base64@2.6.4: {}
 
-  js-cookie@3.0.5: {}
-
   js-tokens@4.0.0: {}
 
   js-tokens@9.0.1: {}
@@ -7650,12 +7633,12 @@ snapshots:
 
   vary@1.1.2: {}
 
-  vite-plugin-ejs@1.7.0(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)):
+  vite-plugin-ejs@1.7.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)):
     dependencies:
       ejs: 3.1.10
-      vite: 7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
+      vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
 
-  vite-plugin-svg-icons@2.0.1(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)):
+  vite-plugin-svg-icons@2.0.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)):
     dependencies:
       '@types/svgo': 2.6.4
       cors: 2.8.5
@@ -7665,17 +7648,17 @@ snapshots:
       pathe: 0.2.0
       svg-baker: 1.7.0
       svgo: 2.8.0
-      vite: 7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
+      vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
     transitivePeerDependencies:
       - supports-color
 
-  vite-plugin-vue-setup-extend@0.4.0(vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)):
+  vite-plugin-vue-setup-extend@0.4.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)):
     dependencies:
       '@vue/compiler-sfc': 3.5.17
       magic-string: 0.25.9
-      vite: 7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
+      vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0)
 
-  vite@7.0.3(@types/node@24.0.12)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0):
+  vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(yaml@2.8.0):
     dependencies:
       esbuild: 0.25.6
       fdir: 6.4.6(picomatch@4.0.2)
@@ -7684,7 +7667,7 @@ snapshots:
       rollup: 4.44.2
       tinyglobby: 0.2.14
     optionalDependencies:
-      '@types/node': 24.0.12
+      '@types/node': 24.0.13
       fsevents: 2.3.3
       jiti: 2.4.2
       sass: 1.89.2

+ 1 - 1
src/api/module/system/menu.ts

@@ -1,7 +1,7 @@
 import http from '@/axios'
 class MenuApi {
   static getMenuList = (): Promise<ResultData<any>> => {
-    return http.get<Menu.MenuOptions[]>({ url: '/system/menu/list' })
+    return http.get<Menu.MenuOptions[]>({ url: '/system/menu/getRouters' })
   }
 }
 export default MenuApi

BIN
src/assets/images/404.png


BIN
src/assets/images/500.png


BIN
src/assets/images/avatar.png


BIN
src/assets/images/notData.png


+ 5 - 0
src/axios/config.ts

@@ -1,6 +1,11 @@
 import type { InternalAxiosRequestConfig, AxiosResponse } from 'axios'
 import { ResultEnum } from '@/enums/HttpEnum'
+import { useUserStoreWithOut } from '@/stores'
 const defaultRequestInterceptors = (config: InternalAxiosRequestConfig) => {
+  const userStore = useUserStoreWithOut()
+  if (config.headers && typeof config.headers.set === 'function') {
+    config.headers.set('Authorization', 'Bearer ' + userStore.token)
+  }
   return config
 }
 

+ 19 - 23
src/router/modules/authRouts.ts

@@ -1,34 +1,30 @@
-import router from '@/router'
+import router, { resetRouter } from '@/router'
 import { WHITE_LIST, LOGIN_URL } from '@/constants'
 import { useAuthStore, useUserStore } from '@/stores'
-import { getToken, removeToken } from '@/utils/token'
-import { type RouteRecordRaw } from 'vue-router'
 import { useNProgress } from '@/utils/nprogress'
+import { initDynamicRouter } from '@/router/modules/dynamicRouter'
+
 const { start, done } = useNProgress()
 export const setupAuthRoutes = () => {
-  router.beforeEach(async (to, _from, next) => {
+  router.beforeEach(async (to, from, next) => {
+    const userStore = useUserStore()
+    const authStore = useAuthStore()
     start()
-    if (getToken()) {
-      if (to.path.toLocaleLowerCase() === LOGIN_URL) {
-        // 如果已登录,跳转到首页
-        next({ path: '/' })
-        return
-      }
-      const authStore = useAuthStore()
-      const userStore = useUserStore()
-      const hasRoles = userStore.roles && userStore.roles.length > 0
-      if (hasRoles) return next()
-      await userStore.getUserInfo()
-      await authStore.setAuthRoutes()
-      const authRoutes = authStore.getAuthRoutes
-      authRoutes.forEach((route: RouteRecordRaw) => router.addRoute(route))
+
+    if (to.path.toLocaleLowerCase() === LOGIN_URL) {
+      if (userStore.token) return next(from.fullPath)
+      resetRouter()
+      return next()
+    }
+    if (WHITE_LIST.includes(to.path)) return next()
+    if (!userStore.token) return next({ path: LOGIN_URL, replace: true })
+
+    if (!authStore.getMenuList.length) {
+      await initDynamicRouter()
       return next({ ...to, replace: true })
-    } else {
-      if (WHITE_LIST.includes(to.path)) return next()
-      removeToken()
-      // 重定向登录页面
-      next(`/login?redirect=${to.path}`)
     }
+    authStore.setRouteName(to.name as string)
+    next()
   })
   router.afterEach(() => {
     done() // 结束Progress

+ 9 - 6
src/router/modules/dynamicRouter.ts

@@ -2,7 +2,6 @@ import { LOGIN_URL } from '@/constants'
 import router from '@/router'
 import { useAuthStore, useUserStore } from '@/stores'
 import type { RouteRecordRaw } from 'vue-router'
-import MenuApi from '@/api/module/system/menu'
 
 // 引入 views 文件夹下所有 vue 文件
 const modules = import.meta.glob('@/views/**/*.vue')
@@ -13,16 +12,20 @@ const modules = import.meta.glob('@/views/**/*.vue')
 export const initDynamicRouter = async () => {
   const userStore = useUserStore()
   const authStore = useAuthStore()
-  //   const optionsStore = useOptionsStore()
   try {
     if (authStore.isLoaded) return
-    authStore.setMenuList()
-    // optionsStore.setReloadOptions()
-    // await optionsStore.getAllDictList()
-    authStore.setLoaded()
+    await authStore.setMenuList()
+    await authStore.setLoaded()
+
+    if (!authStore.getMenuList.length) {
+      userStore.setToken('')
+      router.replace(LOGIN_URL)
+      return Promise.reject('No permission')
+    }
 
     // 3.添加动态路由
     authStore.flatMenuListGet.forEach((item: Menu.MenuOptions) => {
+      console.log('item', item)
       if (item.children) delete item.children
       if (item.component && typeof item.component == 'string') {
         item.component = modules['/src/views' + item.component + '.vue']

+ 3 - 9
src/stores/modules/auth.ts

@@ -20,15 +20,9 @@ export const useAuthStore = defineStore('eco-auth', {
     getMenuList: state => state.menuList,
     getRoleCodes: state => state.roleCodes,
     getRouteName: state => state.routeName,
-    showMenuListGet: state => {
-      getShowMenuList(state.menuList)
-    },
-    flatMenuListGet: state => {
-      return getFlatMenuList(state.menuList)
-    },
-    breadcrumbListGet: state => {
-      return getAllBreadcrumbList(state.menuList)
-    }
+    showMenuListGet: state => getShowMenuList(state.menuList),
+    flatMenuListGet: state => getFlatMenuList(state.menuList),
+    breadcrumbListGet: state => getAllBreadcrumbList(state.menuList)
   },
   actions: {
     setLoaded() {

+ 1 - 7
src/stores/modules/user.ts

@@ -1,5 +1,4 @@
 import { type UserState } from '@/stores/interface'
-import { getToken, setToken, removeToken } from '@/utils/token'
 import { type LoginData } from '@/api/interface/login'
 import UserApi from '@/api/module/system/user'
 import { type UserInfo } from '@/api/interface/system/user'
@@ -7,7 +6,7 @@ import LoginApi from '@/api/module/login'
 import { pinia } from '../index'
 export const useUserStore = defineStore('eco-user', {
   state: (): UserState => ({
-    token: getToken(),
+    token: '',
     expireIn: 0,
     user: {
       userId: undefined,
@@ -28,7 +27,6 @@ export const useUserStore = defineStore('eco-user', {
           .then(({ code, data, msg }) => {
             if (code === 200) {
               const { accessToken, user, roleCodes, permissionCodes, expireIn } = data
-              setToken(accessToken)
               this.token = accessToken
               this.user = user
               this.roleCodes = roleCodes
@@ -50,7 +48,6 @@ export const useUserStore = defineStore('eco-user', {
               this.token = ''
               this.roleCodes = []
               this.permissionCodes = []
-              removeToken()
               resolve({ code, msg })
             }
           })
@@ -71,19 +68,16 @@ export const useUserStore = defineStore('eco-user', {
               resolve(data)
             } else {
               this.roleCodes = []
-              removeToken()
             }
           })
           .catch(error => {
             this.roleCodes = []
-            removeToken()
             reject(error)
           })
       })
     },
     setToken(tokenStr: string) {
       this.token = tokenStr
-      setToken(tokenStr)
     }
   }
 })

+ 0 - 15
src/utils/token.ts

@@ -1,15 +0,0 @@
-import Cookies from 'js-cookie'
-
-export const TOKEN_KEY = 'eco-token'
-
-export const setToken = (token: string) => {
-  Cookies.set(TOKEN_KEY, token)
-}
-
-export const getToken = () => {
-  return Cookies.get(TOKEN_KEY)
-}
-
-export const removeToken = () => {
-  Cookies.remove(TOKEN_KEY)
-}

+ 3 - 0
src/views/home/index.vue

@@ -0,0 +1,3 @@
+<template>
+  <div>HOME</div>
+</template>

+ 1 - 1
src/views/login/index.vue

@@ -3,7 +3,7 @@
     <div class="login-container">
       <div class="login-card">
         <h2 class="login-title">卫星轨道仿真演示系统</h2>
-        <el-form ref="ruleFormRef" style="width: 400px" :model="loginForm" status-icon label-width="auto">
+        <el-form ref="ruleFormRef" :model="loginForm">
           <el-form-item label="账号" prop="account">
             <el-input v-model="loginForm.account" />
           </el-form-item>