From 7080538a005de24b9b2d6eb8654d98b439df6449 Mon Sep 17 00:00:00 2001 From: zhx Date: Tue, 30 Jun 2026 10:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=9D=93=E5=8F=B7=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/region-blocks/api.ts | 2 ++ .../region-blocks/hooks/useRegionBlockPage.js | 3 ++- .../region-blocks/pages/RegionBlockPage.jsx | 16 +++++++++++----- .../region-blocks/region-blocks.module.css | 2 +- src/features/region-blocks/schema.ts | 6 +++--- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/features/region-blocks/api.ts b/src/features/region-blocks/api.ts index 623d224..579e9e8 100644 --- a/src/features/region-blocks/api.ts +++ b/src/features/region-blocks/api.ts @@ -22,6 +22,7 @@ export interface IPWhitelistDto { export interface UserWhitelistDto { whitelistId: number; userId: string; + displayUserId: string; enabled: boolean; createdAtMs: number; updatedAtMs: number; @@ -124,6 +125,7 @@ function normalizeUserWhitelist(item: RawUserWhitelist): UserWhitelistDto { return { whitelistId: numberValue(item.whitelistId ?? item.whitelist_id), userId: stringValue(item.userId ?? item.user_id), + displayUserId: stringValue(item.displayUserId ?? item.display_user_id), enabled: Boolean(item.enabled), createdAtMs: numberValue(item.createdAtMs ?? item.created_at_ms), updatedAtMs: numberValue(item.updatedAtMs ?? item.updated_at_ms), diff --git a/src/features/region-blocks/hooks/useRegionBlockPage.js b/src/features/region-blocks/hooks/useRegionBlockPage.js index bdab6e7..19f80bb 100644 --- a/src/features/region-blocks/hooks/useRegionBlockPage.js +++ b/src/features/region-blocks/hooks/useRegionBlockPage.js @@ -113,6 +113,7 @@ export function useRegionBlockPage() { saved || { whitelistId: `draft-user-${index}-${userID}`, userId: userID, + displayUserId: "", createdAtMs: 0, enabled: true, updatedAtMs: 0, @@ -182,7 +183,7 @@ export function useRegionBlockPage() { setUserIDInput(""); setDirty(true); } catch (err) { - showValidationError(err, showToast, "用户 ID 参数不正确"); + showValidationError(err, showToast, "用户 ID/短 ID/靓号参数不正确"); } }; diff --git a/src/features/region-blocks/pages/RegionBlockPage.jsx b/src/features/region-blocks/pages/RegionBlockPage.jsx index 5add838..7235131 100644 --- a/src/features/region-blocks/pages/RegionBlockPage.jsx +++ b/src/features/region-blocks/pages/RegionBlockPage.jsx @@ -105,8 +105,8 @@ export function RegionBlockPage() { page.setUserIDInput(event.target.value)} @@ -144,11 +144,11 @@ export function RegionBlockPage() { />
-

用户ID白名单

+

用户ID/短ID/靓号白名单

item.whitelistId || item.userId} />
@@ -241,10 +241,16 @@ function buildUserWhitelistColumns(page) { return [ { key: "userId", - label: "用户ID", + label: "内部用户ID", width: "minmax(220px, 1fr)", render: (item) => , }, + { + key: "displayUserId", + label: "当前短ID/靓号", + width: "minmax(180px, 0.8fr)", + render: (item) => item.displayUserId || (String(item.whitelistId || "").startsWith("draft-user-") ? "保存后解析" : "-"), + }, { key: "updatedAtMs", label: "更新时间", diff --git a/src/features/region-blocks/region-blocks.module.css b/src/features/region-blocks/region-blocks.module.css index 17706c0..f3edd92 100644 --- a/src/features/region-blocks/region-blocks.module.css +++ b/src/features/region-blocks/region-blocks.module.css @@ -21,7 +21,7 @@ } .userInput { - flex: 0 1 220px; + flex: 0 1 280px; } .tableGroup { diff --git a/src/features/region-blocks/schema.ts b/src/features/region-blocks/schema.ts index 120dc7c..bdd1601 100644 --- a/src/features/region-blocks/schema.ts +++ b/src/features/region-blocks/schema.ts @@ -16,9 +16,9 @@ export const regionBlockIPSchema = z export const regionBlockUserIDSchema = z .string() .trim() - .min(1, "请输入用户 ID") - .max(20, "用户 ID 不能超过 20 位") - .regex(/^[1-9]\d*$/, "请输入正确的用户 ID"); + .min(1, "请输入用户 ID/短 ID/靓号") + .max(64, "用户 ID/短 ID/靓号不能超过 64 个字符") + .refine((value) => !/\s/.test(value), "用户 ID/短 ID/靓号不能包含空白"); export const regionBlockReplaceSchema = z.object({ keywords: z.array(regionBlockKeywordSchema).max(200, "最多配置 200 个屏蔽词"),