From 089041abef30bebecc0e04f154a4cab9acc1688e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=B8=96=E7=9D=BF?= <2839904623@qq.com> Date: Sun, 5 Jul 2026 15:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=E6=9C=80?= =?UTF-8?q?=E8=BF=91=E7=99=BB=E5=BD=95=E5=88=97=E6=94=B9=E4=B8=BA=E6=9C=80?= =?UTF-8?q?=E8=BF=91=E6=B4=BB=E8=B7=83,=E5=B1=95=E7=A4=BA=E3=80=81?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E3=80=81=E7=AD=9B=E9=80=89=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=8D=A2=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app/(main)/users/page.tsx | 25 ++++++++++++++++--------- src/lib/types.ts | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/app/(main)/users/page.tsx b/src/app/(main)/users/page.tsx index d53269b..01845e2 100644 --- a/src/app/(main)/users/page.tsx +++ b/src/app/(main)/users/page.tsx @@ -5,7 +5,7 @@ import type { Key } from 'react'; import { useRouter } from 'next/navigation'; import type { ColumnsType } from 'antd/es/table'; import type { SorterResult } from 'antd/es/table/interface'; -import { App, Button, DatePicker, Input, Select, Space, Table, Tag } from 'antd'; +import { App, Button, DatePicker, Input, Select, Space, Table, Tag, Tooltip } from 'antd'; import dayjs, { type Dayjs } from 'dayjs'; import { api, errMsg } from '@/lib/api'; import { canDo } from '@/lib/auth'; @@ -18,7 +18,7 @@ const { RangePicker } = DatePicker; const STATUS_COLOR: Record = { active: 'green', disabled: 'red', deleted: 'default' }; -type SortField = 'id' | 'created_at' | 'last_login_at'; +type SortField = 'id' | 'created_at' | 'last_active_at'; export default function UsersPage() { const router = useRouter(); @@ -61,8 +61,8 @@ export default function UsersPage() { register_channel: channel || undefined, created_from: regRange?.[0] ? regRange[0].startOf('day').toISOString() : undefined, created_to: regRange?.[1] ? regRange[1].endOf('day').toISOString() : undefined, - last_login_from: loginRange?.[0] ? loginRange[0].startOf('day').toISOString() : undefined, - last_login_to: loginRange?.[1] ? loginRange[1].endOf('day').toISOString() : undefined, + last_active_from: loginRange?.[0] ? loginRange[0].startOf('day').toISOString() : undefined, + last_active_to: loginRange?.[1] ? loginRange[1].endOf('day').toISOString() : undefined, }); const resetFilters = () => { @@ -235,12 +235,19 @@ export default function UsersPage() { render: (v: string) => formatUtcTime(v), }, { - title: '最近登录', - dataIndex: 'last_login_at', + // 最近活跃 = max(最近登录, 最近发起比价, 最近发起领券),与大盘 DAU/留存活跃口径一致(2026-07-05) + title: ( + + 最近活跃 + + ), + dataIndex: 'last_active_at', width: 160, sorter: true, - sortOrder: sortOrderOf('last_login_at'), - render: (v: string) => formatUtcTime(v), + // 关掉 antd 默认的「点击升序/降序」表头提示,否则与上面自定义口径 Tooltip 同时弹出互相遮挡 + showSorterTooltip: false, + sortOrder: sortOrderOf('last_active_at'), + render: (v: string | null, u: UserListItem) => formatUtcTime(v ?? u.last_login_at), }, { title: '操作', @@ -324,7 +331,7 @@ export default function UsersPage() { allowClear /> setLoginRange(v as [Dayjs, Dayjs] | null)} allowClear diff --git a/src/lib/types.ts b/src/lib/types.ts index 209c482..204b6aa 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -56,6 +56,8 @@ export interface UserListItem { wechat_openid: string | null; created_at: string; last_login_at: string; + // 最近活跃 = max(最近登录, 最近发起比价, 最近发起领券);与大盘 DAU/留存活跃口径一致 + last_active_at: string | null; } // 设备维度新手引导:一台设备(ANDROID_ID)聚合,走过引导的账号数 + 最近完成时间。