From f4b3db4fea0d15978e7f9715354f0a4bcd252914 Mon Sep 17 00:00:00 2001 From: zimo493 <2081182432@qq.com> Date: Wed, 3 Sep 2025 08:48:34 +0800 Subject: [PATCH 1/7] =?UTF-8?q?build:=20:package:=20(eslint)=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20`ESLint`=20=E9=85=8D=E7=BD=AE=E4=BB=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20`TypeScript`=20=E5=92=8C=20`Prettier`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加 TypeScript 支持,包括 tsconfigRootDir 设置 - 集成 Prettier 插件,将 Prettier 输出作为 ESLint 问题报告 #ICVVIH --- eslint.config.ts | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/eslint.config.ts b/eslint.config.ts index 7e3fb4c4..20aade82 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -1,11 +1,16 @@ // https://eslint.org/docs/latest/use/configure/configuration-files-new +// 基础ESLint配置 import eslint from "@eslint/js"; -import pluginVue from "eslint-plugin-vue"; -import * as typescriptEslint from "typescript-eslint"; -import vueParser from "vue-eslint-parser"; import globals from "globals"; +// TypeScript支持 +import * as typescriptEslint from "typescript-eslint"; +// Vue支持 +import pluginVue from "eslint-plugin-vue"; +import vueParser from "vue-eslint-parser"; +// 代码风格与格式化 import configPrettier from "eslint-config-prettier"; +import prettierPlugin from "eslint-plugin-prettier"; // 解析自动导入配置 import fs from "node:fs"; @@ -132,6 +137,7 @@ export default [ sourceType: "module", parser: typescriptEslint.parser, extraFileExtensions: [".vue"], + tsconfigRootDir: __dirname, }, }, rules: { @@ -174,8 +180,10 @@ export default [ languageOptions: { parser: typescriptEslint.parser, parserOptions: { - project: true, - tsconfigRootDir: import.meta.dirname, + ecmaVersion: "latest", + sourceType: "module", + project: "./tsconfig.json", + tsconfigRootDir: __dirname, }, }, rules: { @@ -212,5 +220,15 @@ export default [ }, // Prettier 集成(必须放在最后) - configPrettier, + { + plugins: { + prettier: prettierPlugin, // 将 Prettier 的输出作为 ESLint 的问题来报告 + }, + rules: { + ...configPrettier.rules, + "prettier/prettier": ["error", {}, { usePrettierrc: true }], + "arrow-body-style": "off", + "prefer-arrow-callback": "off", + }, + }, ]; From 3208edbb18edfcae3e67ba35c216afbced5934ac Mon Sep 17 00:00:00 2001 From: zimo493 <2081182432@qq.com> Date: Wed, 3 Sep 2025 13:17:15 +0800 Subject: [PATCH 2/7] =?UTF-8?q?refactor:=20:recycle:=20(store)=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=B7=AF=E7=94=B1=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E6=95=B4=E8=BF=94=E5=9B=9E=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/permission-store.ts | 28 ++++++++------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/store/modules/permission-store.ts b/src/store/modules/permission-store.ts index bf67da4e..b980176d 100644 --- a/src/store/modules/permission-store.ts +++ b/src/store/modules/permission-store.ts @@ -107,31 +107,19 @@ const parseDynamicRoutes = (rawRoutes: RouteVO[]): RouteRecordRaw[] => { }; /** - * 去除中间层的路由 `component` 属性 + * 路由处理函数 + * - 去除中间层路由 `component: Layout` 的 `component` 属性 * @param routes 路由数组 * @param isTopLevel 是否是顶层路由 */ const processRoutes = (routes: RouteVO[], isTopLevel: boolean = true): RouteVO[] => { - return routes.map((route) => { - // 创建新对象 - const newRoute: RouteVO = { - path: route.path, - name: route.name, - children: route.children, - meta: { ...route.meta }, + return routes.map(({ component, children, ...args }) => { + return { + ...args, + component: isTopLevel || component !== "Layout" ? component : undefined, + // 递归处理children,标记为非顶层 + children: children && children.length > 0 ? processRoutes(children, false) : [], }; - - // 如果是顶层或者component不是"Layout",保留component属性 - if (isTopLevel || route.component !== "Layout") { - newRoute.component = route.component; - } - - // 递归处理children,标记为非顶层 - if (route.children && route.children.length > 0) { - newRoute.children = processRoutes(route.children, false); - } - - return newRoute; }); }; From 6cce9581fb3e47ed4fb2b346db6567d98231d4b1 Mon Sep 17 00:00:00 2001 From: zimo493 <2081182432@qq.com> Date: Thu, 4 Sep 2025 16:23:40 +0800 Subject: [PATCH 3/7] =?UTF-8?q?style:=20:lipstick:=20(settings)=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=92=8C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将底部按钮放入footer插槽中,保留原有的样式 #ICWDUU --- src/layouts/components/Settings/index.vue | 104 ++++++++-------------- 1 file changed, 37 insertions(+), 67 deletions(-) diff --git a/src/layouts/components/Settings/index.vue b/src/layouts/components/Settings/index.vue index 2ebb6bb5..7c26f240 100644 --- a/src/layouts/components/Settings/index.vue +++ b/src/layouts/components/Settings/index.vue @@ -107,40 +107,35 @@ -