From 907b07f552ee901d3ad751dd07caa875d8494041 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Sun, 23 Aug 2026 16:22:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20SSE=E3=80=81=E8=AF=B7=E6=B1=82=E6=8B=A6=E6=88=AA=E4=B8=8E?= =?UTF-8?q?=E5=A4=9A=E9=A1=B5=E9=9D=A2=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.ts | 4 +- src/components/cu-date-query/index.vue | 2 +- src/components/custom-navbar/index.vue | 3 +- src/components/custom-tree/index.vue | 4 +- src/composables/useNavigation.ts | 1 - src/composables/useScanLogin.ts | 28 +++++++++++ src/composables/useSse.ts | 6 +-- src/layouts/tabbar.vue | 7 ++- src/pages/login/index.vue | 40 +++++++-------- src/pages/mine/index.vue | 54 +++++++++------------ src/pages/mine/profile/complete-profile.vue | 23 ++++++--- src/pages/mine/profile/index.vue | 7 ++- src/pages/mine/scan-confirm/index.vue | 11 +++-- src/pages/mine/settings/theme/index.vue | 4 +- src/pages/webview/index.vue | 4 +- src/pages/work/config/index.vue | 8 ++- src/pages/work/dept/index.vue | 25 +++++++--- src/pages/work/dict/index.vue | 4 +- src/pages/work/dict/item/index.vue | 10 ++-- src/pages/work/menu/index.vue | 35 ++++++++----- src/pages/work/notice/index.vue | 6 +-- src/pages/work/role/assign-perm.vue | 4 +- src/pages/work/role/index.vue | 4 +- src/pages/work/user/index.vue | 40 +++++++++------ src/router/index.ts | 19 ++++++-- src/types/auto-imports.d.ts | 6 +++ src/types/uni-pages.d.ts | 2 +- src/utils/auth.ts | 2 +- src/utils/index.ts | 26 +++++++++- src/utils/request.ts | 12 +++-- 30 files changed, 259 insertions(+), 142 deletions(-) create mode 100644 src/composables/useScanLogin.ts diff --git a/src/api/user.ts b/src/api/user.ts index aecbf02..46217fb 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -292,8 +292,8 @@ export interface UserForm { mobile?: string; /** 昵称 */ nickname?: string; - /** 角色ID集合 */ - roleIds: number[]; + /** 角色ID集合(后端 Long 序列化为字符串,兼容数字) */ + roleIds: (number | string)[]; /** 用户状态(1:正常;0:禁用) */ status?: number; /** 用户名 */ diff --git a/src/components/cu-date-query/index.vue b/src/components/cu-date-query/index.vue index f2da517..4ea37db 100644 --- a/src/components/cu-date-query/index.vue +++ b/src/components/cu-date-query/index.vue @@ -63,7 +63,7 @@ const handleConfirm = () => { const startDate = dayjs(dateRange.value[0]).format("YYYY-MM-DD"); const endDate = dayjs(dateRange.value[1]).format("YYYY-MM-DD"); - let newVal: any = [startDate, endDate]; + let newVal: string | string[] = [startDate, endDate]; // #ifdef MP-WEIXIN newVal = `${startDate},${endDate}`; diff --git a/src/components/custom-navbar/index.vue b/src/components/custom-navbar/index.vue index 59348b1..9767fc5 100644 --- a/src/components/custom-navbar/index.vue +++ b/src/components/custom-navbar/index.vue @@ -30,8 +30,9 @@ - + + diff --git a/src/components/custom-tree/index.vue b/src/components/custom-tree/index.vue index 4b90b43..374fee8 100644 --- a/src/components/custom-tree/index.vue +++ b/src/components/custom-tree/index.vue @@ -71,7 +71,7 @@ import { ref, computed, watch } from "vue"; export interface TreeOption { - [key: string]: any; + [key: string]: unknown; value: string; label: string; children?: TreeOption[]; @@ -163,7 +163,7 @@ const flatNodes = computed(() => { result.push({ ...node, value: String(node[props.valueKey]), - label: node[props.labelKey], + label: node[props.labelKey] as string, level, hasChildren: !!(children && children.length > 0), raw: node, diff --git a/src/composables/useNavigation.ts b/src/composables/useNavigation.ts index ba3652e..568beb4 100644 --- a/src/composables/useNavigation.ts +++ b/src/composables/useNavigation.ts @@ -2,7 +2,6 @@ import { checkLogin } from "@/utils/auth"; interface NavItem { url?: string; - [key: string]: any; } export function useNavigation() { diff --git a/src/composables/useScanLogin.ts b/src/composables/useScanLogin.ts new file mode 100644 index 0000000..f3d9b84 --- /dev/null +++ b/src/composables/useScanLogin.ts @@ -0,0 +1,28 @@ +import { checkLogin } from "@/utils/auth"; + +/** + * 扫码登录 PC 端 + * + * 调起相机扫描 PC 端登录二维码,校验票据后跳转扫码确认页。 + * 未登录时跳转登录页,用户取消扫码静默处理。 + */ +export function useScanLogin() { + const scanLogin = async () => { + if (!checkLogin()) return; + try { + const res = await uni.scanCode({ scanType: ["qrCode"] }); + const ticket = (res.result || "").trim(); + if (!ticket) { + uni.showToast({ title: "无效的二维码", icon: "none" }); + return; + } + uni.navigateTo({ + url: `/pages/mine/scan-confirm/index?ticket=${encodeURIComponent(ticket)}`, + }); + } catch { + // 用户取消扫码,静默处理 + } + }; + + return { scanLogin }; +} diff --git a/src/composables/useSse.ts b/src/composables/useSse.ts index e1342fd..899eaf2 100644 --- a/src/composables/useSse.ts +++ b/src/composables/useSse.ts @@ -9,7 +9,7 @@ export interface UseSseOptions { maxReconnectAttempts?: number; } -type EventHandler = (data: any) => void; +type EventHandler = (data: unknown) => void; export enum SseConnectionState { DISCONNECTED = "DISCONNECTED", @@ -44,8 +44,8 @@ function createSseConnection(options: UseSseOptions = {}) { const eventHandlers = new Map>(); - const log = (...args: any[]) => config.debug && console.log("[SSE]", ...args); - const logError = (...args: any[]) => console.error("[SSE]", ...args); + const log = (...args: unknown[]) => config.debug && console.log("[SSE]", ...args); + const logError = (...args: unknown[]) => console.error("[SSE]", ...args); const clearTimer = (timer: typeof connectionTimeoutTimer) => { if (timer) { diff --git a/src/layouts/tabbar.vue b/src/layouts/tabbar.vue index 7bab790..42d9329 100644 --- a/src/layouts/tabbar.vue +++ b/src/layouts/tabbar.vue @@ -1,6 +1,11 @@