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); }; };