1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,6 +26,7 @@ launch.json
|
||||
pnpm-lock.yaml
|
||||
|
||||
|
||||
.vscode
|
||||
.claude/
|
||||
.cursor/
|
||||
.windsurf/
|
||||
|
||||
4
pnpm-workspace.yaml
Normal file
4
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
allowBuilds:
|
||||
core-js: false
|
||||
esbuild: false
|
||||
vue-demi: false
|
||||
@@ -124,7 +124,7 @@ export interface DeptForm {
|
||||
/** 父部门ID */
|
||||
parentId: number;
|
||||
/** 排序 */
|
||||
sort?: number;
|
||||
sort: number;
|
||||
/** 状态(1:启用;0:禁用) */
|
||||
status?: number;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<typeof computed<boolean>>;
|
||||
isLoading: ComputedRef<boolean>;
|
||||
/** 加载计数(支持并发) */
|
||||
loadingCount: ReturnType<typeof ref<number>>;
|
||||
loadingCount: Ref<number>;
|
||||
/** 当前加载消息 */
|
||||
message: ReturnType<typeof ref<string>>;
|
||||
message: Ref<string>;
|
||||
/** 开始加载 */
|
||||
start: (msg?: string) => void;
|
||||
/** 结束加载 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -212,7 +212,7 @@ export interface UsePaginationReturn<T> {
|
||||
* @param options 配置选项
|
||||
*/
|
||||
export function usePagination<T>(
|
||||
requestFn: (params: PaginationParams) => Promise<PageResult<T[]>>,
|
||||
requestFn: (params: PaginationParams) => Promise<PageResult<T>>,
|
||||
options: UsePaginationOptions<T> = {}
|
||||
): UsePaginationReturn<T> {
|
||||
const { pageSize = 10, initialData = [], onSuccess, onError } = options;
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
// 选择预设颜色
|
||||
|
||||
@@ -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<ConfigProviderThemeVars>(() => {
|
||||
const themeVars = computed<ProviderThemeVars>(() => {
|
||||
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;
|
||||
});
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
* @returns
|
||||
*/
|
||||
const debounce = <T extends (...args: any[]) => any>(fn: T, delay: number) => {
|
||||
let timer: number | null = null;
|
||||
let timer: ReturnType<typeof setTimeout> | null = null;
|
||||
return function (this: any, ...args: Parameters<T>) {
|
||||
if (timer) clearTimeout(timer);
|
||||
if (timer !== null) clearTimeout(timer);
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = null;
|
||||
}, delay);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"ignoreDeprecations": "6.0",
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
|
||||
Reference in New Issue
Block a user