From cb1a1e349fe599c23ee3dcc94a62f2ef33ff027d Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 16 Oct 2026 16:50:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=84=E4=BB=B6=E5=B0=B1?= =?UTF-8?q?=E8=BF=91=E8=BF=81=E7=A7=BB=E3=80=81=E6=93=8D=E4=BD=9C=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=BB=84=E4=BB=B6=E5=8C=96=E5=B9=B6=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 组件文件统一 PascalCase 并就近迁入所属目录 - 操作菜单抽为 ActionSheet 组件,危险操作确认拆为 useConfirmAction - 导航栏测量拆为 useNavbarMetrics 并收缩对外接口 - 页面方法按动词约定重命名,show 前缀与 handle 误用一并修正 - 通知与菜单接口类型改用字面量联合并修正取值注释 - 多行空壳注释收回单行 --- eslint.config.mjs | 9 +- package.json | 3 +- src/api/file.ts | 8 +- src/api/menu.ts | 17 +- src/api/notice.ts | 11 +- .../index.vue => AppNavbar.vue} | 118 ++++----- .../index.vue => AppProvider.vue} | 11 +- src/composables/useActionSheet.ts | 67 ----- src/composables/useCacheCleaner.ts | 22 +- src/composables/useConfirmAction.ts | 42 +++ src/composables/useCountdown.ts | 32 ++- src/composables/useLogout.ts | 36 ++- src/composables/useNavbar.ts | 244 ------------------ src/composables/useNavbarMetrics.ts | 195 ++++++++++++++ src/composables/useNavigation.ts | 22 +- src/composables/useScanLogin.ts | 52 +++- src/composables/useSmsLoginCode.ts | 34 ++- src/composables/useTheme.ts | 8 +- src/config/index.ts | 4 +- src/config/work-menu.ts | 4 +- src/constants/index.ts | 4 +- src/constants/permissions.ts | 4 +- src/layouts/tabbar.vue | 20 +- src/pages/index/index.vue | 101 ++++---- ...d-mobile-popup.vue => BindMobilePopup.vue} | 22 +- src/pages/login/index.vue | 25 +- .../{menu-section.vue => MenuSection.vue} | 42 +-- ...unity-card.vue => OfficialAccountCard.vue} | 49 ++-- .../{profile-card.vue => ProfileCard.vue} | 49 ++-- .../{quick-cards.vue => QuickActions.vue} | 12 +- src/pages/mine/index.vue | 243 +++++++++-------- src/pages/work/index.vue | 26 +- src/store/modules/theme.ts | 12 +- src/store/modules/user.ts | 28 +- src/styles/index.scss | 28 +- src/styles/theme.scss | 20 +- src/subPages/mine/about/index.vue | 38 +-- src/subPages/mine/account/index.vue | 97 +++---- .../mine/profile/complete-profile/index.vue | 36 +-- src/subPages/mine/profile/index.vue | 45 ++-- src/subPages/mine/scan-confirm/index.vue | 136 ++++++---- src/subPages/mine/settings/network/index.vue | 116 ++++++--- src/subPages/mine/settings/theme/index.vue | 27 +- src/subPages/work/components/ActionSheet.vue | 61 +++++ .../{custom-tree.vue => TreeView.vue} | 103 +++++--- src/subPages/work/config/index.vue | 37 ++- src/subPages/work/dept/index.vue | 73 +++--- src/subPages/work/dict/index.vue | 44 ++-- src/subPages/work/dict/item/index.vue | 51 ++-- src/subPages/work/log/index.vue | 4 +- src/subPages/work/menu/index.vue | 177 +++++++------ src/subPages/work/notice/index.vue | 59 +++-- src/subPages/work/role/assign-perm/index.vue | 117 +++++---- src/subPages/work/role/index.vue | 45 ++-- src/subPages/work/user/index.vue | 78 +++--- src/types/wot-ui-component-shims.d.ts | 20 -- src/utils/auth.ts | 47 ++-- src/utils/permission.ts | 4 +- src/utils/request.ts | 8 +- src/utils/storage.ts | 10 +- tsconfig.json | 5 +- tsconfig.templates.json | 11 + unocss.config.ts | 3 +- 63 files changed, 1653 insertions(+), 1423 deletions(-) rename src/components/{custom-navbar/index.vue => AppNavbar.vue} (54%) rename src/components/{app-provider/index.vue => AppProvider.vue} (70%) delete mode 100644 src/composables/useActionSheet.ts create mode 100644 src/composables/useConfirmAction.ts delete mode 100644 src/composables/useNavbar.ts create mode 100644 src/composables/useNavbarMetrics.ts rename src/pages/login/components/{bind-mobile-popup.vue => BindMobilePopup.vue} (85%) rename src/pages/mine/components/{menu-section.vue => MenuSection.vue} (74%) rename src/pages/mine/components/{community-card.vue => OfficialAccountCard.vue} (65%) rename src/pages/mine/components/{profile-card.vue => ProfileCard.vue} (70%) rename src/pages/mine/components/{quick-cards.vue => QuickActions.vue} (88%) create mode 100644 src/subPages/work/components/ActionSheet.vue rename src/subPages/work/components/{custom-tree.vue => TreeView.vue} (79%) delete mode 100644 src/types/wot-ui-component-shims.d.ts create mode 100644 tsconfig.templates.json diff --git a/eslint.config.mjs b/eslint.config.mjs index 97e8193..f9d3b69 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -51,10 +51,11 @@ export default [ definePage: "readonly", // uni-pages 页面宏 getCurrentPages: "readonly", // uni-app 全局 API wx: "readonly", // 微信小程序 API - useToast: "readonly", // wot-design-uni - useDialog: "readonly", // wot-design-uni - useMessage: "readonly", // wot-design-uni - useNotify: "readonly", // wot-design-uni + UniHelper: "readonly", // uni-app 类型命名空间 + useToast: "readonly", // @wot-ui/ui + useDialog: "readonly", // @wot-ui/ui + useMessage: "readonly", // @wot-ui/ui + useNotify: "readonly", // @wot-ui/ui }, }, }, diff --git a/package.json b/package.json index b04f871..43a25f5 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei", "build:quickapp-webview-union": "uni build -p quickapp-webview-union", "type-check": "vue-tsc --noEmit", - "check": "pnpm type-check && pnpm lint:eslint:check && pnpm lint:stylelint:check", + "type-check:templates": "node scripts/check-templates.mjs", + "check": "pnpm type-check && pnpm type-check:templates && pnpm lint:eslint:check && pnpm lint:stylelint:check", "lint:eslint:check": "eslint \"src/**/*.{vue,ts}\"", "lint:eslint": "eslint \"src/**/*.{vue,ts}\" --fix", "lint:prettier": "prettier --write \"**/*.{js,cjs,ts,json,css,scss,vue,html,md}\"", diff --git a/src/api/file.ts b/src/api/file.ts index 65daf30..bd63153 100644 --- a/src/api/file.ts +++ b/src/api/file.ts @@ -9,9 +9,7 @@ baseApi = import.meta.env.VITE_APP_BASE_API; // #endif const FileAPI = { - /** - * 文件上传地址 - */ + /** 文件上传地址 */ uploadUrl: baseApi + "/api/v1/files", /** @@ -55,9 +53,7 @@ const FileAPI = { export default FileAPI; -/** - * 文件API类型声明 - */ +/** 文件API类型声明 */ export interface FileInfo { /** 文件名 */ name: string; diff --git a/src/api/menu.ts b/src/api/menu.ts index 77f696e..b7e8e85 100644 --- a/src/api/menu.ts +++ b/src/api/menu.ts @@ -77,7 +77,14 @@ export interface MenuQuery { keywords?: string; } -/** 菜单类型 */ +/** + * 菜单类型 + * + * 与后端 MenuTypeEnum 一致:C 目录、M 菜单、E 外链、B 按钮。 + */ +export type MenuType = "C" | "M" | "E" | "B"; + +/** 菜单实体 */ export interface MenuItem { children?: MenuItem[]; component?: string; @@ -93,8 +100,8 @@ export interface MenuItem { sort?: number; /** 状态(1:显示;0:隐藏) */ visible?: number; - /** 菜单类型(C:目录;M:菜单;B:按钮) */ - type?: string | number; + /** 菜单类型 */ + type?: MenuType; } /** 菜单表单类型 */ @@ -103,8 +110,8 @@ export interface MenuForm { id?: string; name?: string; parentId: string; - /** 菜单类型(C:目录;M:菜单;B:按钮) */ - type: string | number; + /** 菜单类型 */ + type: MenuType; routeName?: string; routePath?: string; component?: string; diff --git a/src/api/notice.ts b/src/api/notice.ts index 5d4faea..fecd890 100644 --- a/src/api/notice.ts +++ b/src/api/notice.ts @@ -114,20 +114,17 @@ export interface NoticeForm { export interface NoticeItem { id: string; title?: string; - content?: string; /** 通知类型 */ type?: number; publisherName?: string; - /** 优先级(0-低 1-中 2-高) */ - priority?: number; - /** 目标类型(0-全体 1-指定) */ + /** 目标类型(1-全体 2-指定) */ targetType?: number; - /** 发布状态(0-未发布 1已发布 2已撤回) */ + /** 发布状态(0-未发布 1-已发布 -1-已撤回) */ publishStatus?: number; publishTime?: Date; revokeTime?: Date; /** 优先级(L-低 M-中 H-高) */ - level?: string | number; + level?: string; } export interface NoticeDetail { @@ -140,6 +137,6 @@ export interface NoticeDetail { /** 优先级(L-低 M-中 H-高) */ level?: string; publishTime?: Date; - /** 发布状态(0-未发布 1-已发布 2-已撤回) */ + /** 发布状态(0-未发布 1-已发布 -1-已撤回) */ publishStatus?: number; } diff --git a/src/components/custom-navbar/index.vue b/src/components/AppNavbar.vue similarity index 54% rename from src/components/custom-navbar/index.vue rename to src/components/AppNavbar.vue index b7c06a0..9b4228d 100644 --- a/src/components/custom-navbar/index.vue +++ b/src/components/AppNavbar.vue @@ -1,38 +1,38 @@