From 2a14a16b5a6774b67afee2e114e15f8af5de6b82 Mon Sep 17 00:00:00 2001 From: Mickey wu Date: Mon, 25 May 2026 21:30:26 +0800 Subject: [PATCH 1/6] =?UTF-8?q?refactor:=20=E6=8F=90=E5=8F=96=20ProviderTh?= =?UTF-8?q?emeVars=20=E7=B1=BB=E5=9E=8B=E5=B9=B6=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=86=97=E4=BD=99=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/types/theme.ts | 4 ++++ src/pages/mine/settings/theme/index.vue | 4 ++-- src/store/modules/theme.ts | 8 ++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/composables/types/theme.ts b/src/composables/types/theme.ts index a70d74f..9817480 100644 --- a/src/composables/types/theme.ts +++ b/src/composables/types/theme.ts @@ -34,3 +34,7 @@ export const themeColorOptions: ThemeColorOption[] = [ { name: "紫罗兰", value: "purple", primary: "#8A2BE2" }, { name: "朱砂红", value: "red", primary: "#FF4757" }, ]; + +export interface ProviderThemeVars extends ConfigProviderThemeVars { + colorTheme: string; +} \ No newline at end of file diff --git a/src/pages/mine/settings/theme/index.vue b/src/pages/mine/settings/theme/index.vue index 9611bd8..97885a6 100644 --- a/src/pages/mine/settings/theme/index.vue +++ b/src/pages/mine/settings/theme/index.vue @@ -101,7 +101,7 @@ }); // 使用主题组合函数 - const { isDark, themeVars, themeColorOptions, toggleTheme, setThemeColor } = useTheme(); + const { isDark, themeColorOptions, toggleTheme, setThemeColor } = useTheme(); const toast = useToast(); const { confirm } = useDialog(); @@ -115,7 +115,7 @@ // 当前选中的主题色 const currentThemeColor = computed(() => { - return themeVars.colorTheme || themeColorOptions[0].primary; + return themeColorOptions[0].primary; }); // 选择预设颜色 diff --git a/src/store/modules/theme.ts b/src/store/modules/theme.ts index 6d6027b..556299b 100644 --- a/src/store/modules/theme.ts +++ b/src/store/modules/theme.ts @@ -1,7 +1,7 @@ import { defineStore } from "pinia"; import { Storage } from "@/utils/storage"; import { THEME_MODE_KEY, THEME_COLOR_KEY } from "@/constants"; -import type { ThemeColorOption, ThemeMode } from "@/composables/types/theme"; +import type { ProviderThemeVars, ThemeColorOption, ThemeMode } from "@/composables/types/theme"; import type { ConfigProviderThemeVars } from "@wot-ui/ui"; import { themeColorOptions } from "@/composables/types/theme"; @@ -36,12 +36,12 @@ export const useThemeStore = defineStore("theme", () => { const darkThemeVars = {}; /** 主题变量(计算属性,根据模式动态切换) */ - const themeVars = computed(() => { + const themeVars = computed(() => { const base = { colorTheme: currentThemeColor.value.primary }; if (theme.value === "dark") { - return { ...base, ...darkThemeVars } as ConfigProviderThemeVars; + return { ...base, ...darkThemeVars } as ProviderThemeVars; } - return base as ConfigProviderThemeVars; + return base as ProviderThemeVars; }); // ========================================================================== From c7f3c08dc12ce316060d175bd19f4cef5cfe8ffe Mon Sep 17 00:00:00 2001 From: Mickey wu Date: Mon, 25 May 2026 21:31:11 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=20usePagination?= =?UTF-8?q?=20=E6=B3=9B=E5=9E=8B=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/useRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/composables/useRequest.ts b/src/composables/useRequest.ts index 08edaf8..d14caf4 100644 --- a/src/composables/useRequest.ts +++ b/src/composables/useRequest.ts @@ -212,7 +212,7 @@ export interface UsePaginationReturn { * @param options 配置选项 */ export function usePagination( - requestFn: (params: PaginationParams) => Promise>, + requestFn: (params: PaginationParams) => Promise>, options: UsePaginationOptions = {} ): UsePaginationReturn { const { pageSize = 10, initialData = [], onSuccess, onError } = options; From 7b68fce5af8ced5671a91cea786c1eac205ed1c1 Mon Sep 17 00:00:00 2001 From: Mickey wu Date: Mon, 25 May 2026 21:32:01 +0800 Subject: [PATCH 3/6] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=20tsconfig=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=20ignoreDeprecations=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index e841100..32c23ed 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "strict": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "ignoreDeprecations": "6.0", "sourceMap": true, "baseUrl": ".", "paths": { From d740e1cce3a6cfbcb1b78b0551d161d32c71d102 Mon Sep 17 00:00:00 2001 From: Mickey wu Date: Mon, 25 May 2026 21:32:51 +0800 Subject: [PATCH 4/6] =?UTF-8?q?chore:=20=E9=85=8D=E7=BD=AE=20pnpm-workspac?= =?UTF-8?q?e=20=E6=9E=84=E5=BB=BA=E7=99=BD=E5=90=8D=E5=8D=95,=E4=BB=A5?= =?UTF-8?q?=E5=85=BC=E5=AE=B9pnpm=20v9=E4=B9=8B=E5=90=8E=E7=9A=84=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pnpm-workspace.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 pnpm-workspace.yaml diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..1d59544 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,4 @@ +allowBuilds: + core-js: false + esbuild: false + vue-demi: false From 7761370f36a3071eb421ac2bbb37d60149132b8a Mon Sep 17 00:00:00 2001 From: Mickey wu Date: Mon, 25 May 2026 21:33:04 +0800 Subject: [PATCH 5/6] =?UTF-8?q?chore:=20=E5=9C=A8=20.gitignore=20=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20.vscode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 109295f..91734d4 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ launch.json pnpm-lock.yaml +.vscode .claude/ .cursor/ .windsurf/ From 325316d0b059de4315534997190a9e21c0fdd51e Mon Sep 17 00:00:00 2001 From: Mickey wu Date: Mon, 25 May 2026 21:55:04 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=8F=8A=E5=A4=9A=E5=A4=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 补充字典项备注字段及部门排序必填约束 - 使用 Ref/ComputedRef 替代 ReturnType 简化类型 - 兜底胶囊按钮默认尺寸,避免获取失败时导航栏异常 - 移除不可靠的新版 API 降级调用,统一使用 getSystemInfoSync - 修复防抖函数定时器未清空及类型不严谨问题 --- src/api/dept.ts | 2 +- src/api/dict.ts | 6 ++++-- src/composables/useLoading.ts | 8 ++++---- src/composables/useNavbar.ts | 18 ++++++++++-------- src/utils/index.ts | 5 +++-- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/api/dept.ts b/src/api/dept.ts index bc54d2c..a8b41f8 100644 --- a/src/api/dept.ts +++ b/src/api/dept.ts @@ -124,7 +124,7 @@ export interface DeptForm { /** 父部门ID */ parentId: number; /** 排序 */ - sort?: number; + sort: number; /** 状态(1:启用;0:禁用) */ status?: number; } diff --git a/src/api/dict.ts b/src/api/dict.ts index 91f4efb..70d1e87 100644 --- a/src/api/dict.ts +++ b/src/api/dict.ts @@ -112,8 +112,9 @@ export interface DictItemForm { dictCode?: string; label?: string; value?: string; - sort?: number; + sort: number; status?: number; + remark?: string; } export interface DictDataItem { @@ -123,4 +124,5 @@ export interface DictDataItem { value?: string; sort?: number; status?: number; -} + remark?: string; +} \ No newline at end of file diff --git a/src/composables/useLoading.ts b/src/composables/useLoading.ts index e953fdd..10670f9 100644 --- a/src/composables/useLoading.ts +++ b/src/composables/useLoading.ts @@ -1,4 +1,4 @@ -import { ref, computed } from "vue"; +import { type Ref, type ComputedRef } from "vue"; /** * 加载状态管理 @@ -35,11 +35,11 @@ export interface UseLoadingOptions { export interface UseLoadingReturn { /** 是否处于加载状态 */ - isLoading: ReturnType>; + isLoading: ComputedRef; /** 加载计数(支持并发) */ - loadingCount: ReturnType>; + loadingCount: Ref; /** 当前加载消息 */ - message: ReturnType>; + message: Ref; /** 开始加载 */ start: (msg?: string) => void; /** 结束加载 */ diff --git a/src/composables/useNavbar.ts b/src/composables/useNavbar.ts index 57ea93f..5199394 100644 --- a/src/composables/useNavbar.ts +++ b/src/composables/useNavbar.ts @@ -187,6 +187,15 @@ export function useNavbar(options: UseNavbarOptions = {}): UseNavbarReturn { } } catch (e) { console.warn("获取胶囊按钮位置失败,使用默认值", e); + // 兜底:设置合理的默认胶囊按钮尺寸 + menuButton.value = { + width: 87, + height: 32, + top: statusBarHeight.value + 6, + right: windowWidth.value - 10, + bottom: statusBarHeight.value + 38, + left: windowWidth.value - 97, + }; } }; // #endif @@ -194,14 +203,7 @@ export function useNavbar(options: UseNavbarOptions = {}): UseNavbarReturn { // 初始化 const init = () => { try { - // 优先使用新版 API(uni.getWindowInfo),降级到 uni.getSystemInfoSync - let systemInfo: UniApp.GetSystemInfoSyncSuccess; - try { - // @ts-expect-error uni.getWindowInfo 是新版 API - systemInfo = uni.getWindowInfo?.() || uni.getSystemInfoSync(); - } catch { - systemInfo = uni.getSystemInfoSync(); - } + const systemInfo = uni.getSystemInfoSync(); statusBarHeight.value = systemInfo.statusBarHeight || 0; safeAreaBottom.value = systemInfo.safeAreaInsets?.bottom || 0; diff --git a/src/utils/index.ts b/src/utils/index.ts index 95d7ac5..f8f3d23 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -5,11 +5,12 @@ * @returns */ const debounce = any>(fn: T, delay: number) => { - let timer: number | null = null; + let timer: ReturnType | null = null; return function (this: any, ...args: Parameters) { - if (timer) clearTimeout(timer); + if (timer !== null) clearTimeout(timer); timer = setTimeout(() => { fn.apply(this, args); + timer = null; }, delay); }; };