From 2f397b9fdad9e6b8f52713c430e40bd99987a079 Mon Sep 17 00:00:00 2001 From: lik Date: Fri, 6 Nov 2026 20:59:45 +0800 Subject: [PATCH] tmp --- .env.production | 1 + src/api/profile.ts | 7 +++++++ src/types/api.ts | 5 +++++ src/utils/request.ts | 5 ++++- src/views/users/index.vue | 33 +++++++++++++++++++++++++++++++++ vite.config.ts | 6 ++++-- 6 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 .env.production diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..b2b8ab0 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_API_BASE=https://api.huashengtec.com diff --git a/src/api/profile.ts b/src/api/profile.ts index 4b274a2..800b7b7 100644 --- a/src/api/profile.ts +++ b/src/api/profile.ts @@ -36,4 +36,11 @@ export const profileApi = { request<{ profile: HealthProfile }>(`/health/health-profile/${id}`, { method: 'DELETE', }), + + // 批量统计每位用户的就诊人数量(一次最多 200 个用户) + counts: (userIds: string[]) => + request<{ counts: Record }>('/health/health-profile/counts', { + query: { userIds: userIds.join(',') }, + silent: true, + }), } diff --git a/src/types/api.ts b/src/types/api.ts index ade85b9..2b38698 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -18,6 +18,11 @@ export type UserProfile = { export type UserView = { _id: string profile?: UserProfile + location?: { + province?: string + city?: string + district?: string + } status?: { account?: 'normal' | 'lock' } diff --git a/src/utils/request.ts b/src/utils/request.ts index d74b09e..98a5d95 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,5 +1,8 @@ import { notify } from '~/utils/notify' +// 生产环境走 https://api.huashengtec.com;本地为空,仍由 vite proxy 转发 +const API_BASE = (import.meta.env.VITE_API_BASE || '').replace(/\/+$/, '') + let authToken = '' let unauthorizedHandler: (() => void) | null = null @@ -47,7 +50,7 @@ export async function request(path: string, options: RequestOptions = {}): Pr let response: Response try { - response = await fetch(`${path}${buildQuery(query)}`, { + response = await fetch(`${API_BASE}${path}${buildQuery(query)}`, { method, headers, body: body === undefined ? undefined : JSON.stringify(body), diff --git a/src/views/users/index.vue b/src/views/users/index.vue index df79c27..ff0abd4 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -82,6 +82,20 @@ {{ item.profile?.email || '-' }} + + + +