diff --git a/src/app/(main)/users/page.tsx b/src/app/(main)/users/page.tsx index f13ea44..1e4bc36 100644 --- a/src/app/(main)/users/page.tsx +++ b/src/app/(main)/users/page.tsx @@ -87,6 +87,28 @@ export default function UsersPage() { }); }; + // 一次性操作:点一下把该用户标记为「未看过引导」,下次打开 App 重看一遍,看完后端自动恢复(只触发这一次)。 + // 用户尚未重看前可「撤销」(把 force_onboarding 置回 false),纠正误点。 + const setForceOnboarding = (u: UserListItem, enable: boolean) => { + Modal.confirm({ + title: enable + ? `确认让用户 ${u.phone} 重看一次新手引导?` + : `撤销用户 ${u.phone} 的「重看新手引导」?`, + content: enable + ? '点一下即把该用户标记为「未看过引导」:Ta 下次打开 App 会重走一遍新手引导,看完自动恢复——只触发这一次。仅对已支持该功能的 App 版本生效。' + : '该用户尚未重看,撤销后下次打开 App 不再触发。', + onOk: async () => { + try { + await api.post(`/admin/api/users/${u.id}/force-onboarding`, { enabled: enable }); + message.success(enable ? '已开启:该用户下次打开 App 会重看一次' : '已撤销'); + reload(); + } catch (e) { + message.error(errMsg(e)); + } + }, + }); + }; + const columns: ColumnsType = [ { title: 'ID', dataIndex: 'id', width: 70 }, { title: '手机号', dataIndex: 'phone' }, @@ -118,6 +140,15 @@ export default function UsersPage() { {u.debug_trace_enabled ? '关调试链接' : '开调试链接'} )} + {canStatus && + u.status !== 'deleted' && + (u.force_onboarding ? ( + + 待重看 setForceOnboarding(u, false)}>撤销 + + ) : ( + setForceOnboarding(u, true)}>开启新手引导 + ))} ), }, diff --git a/src/lib/types.ts b/src/lib/types.ts index 80070cc..869432b 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -29,6 +29,8 @@ export interface UserListItem { status: string; // 调试链接权限:开了的用户在 App 比价结果页/记录页可复制 price.shaguabijia.com 的 trace 调试链接 debug_trace_enabled: boolean; + // 运营「一键开启新手引导」:true = 该用户下次打开 App 会被强制重走新手引导,走完自动取消 + force_onboarding: boolean; wechat_openid: string | null; created_at: string; last_login_at: string;