From 8d49daca21638f73346725e97ace0b96d4103e35 Mon Sep 17 00:00:00 2001 From: "web@ppanel" Date: Wed, 26 Mar 2025 15:01:43 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(user):=20Integrate=20subscript?= =?UTF-8?q?ion=20list=20into=20user=20management,=20update=20request=20par?= =?UTF-8?q?ameters=20and=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/admin/app/dashboard/user/page.tsx | 44 ++++++++++++++++++++++++-- apps/admin/services/admin/index.ts | 2 +- apps/admin/services/admin/typings.d.ts | 6 ++++ apps/admin/services/common/index.ts | 2 +- apps/user/services/common/index.ts | 2 +- apps/user/services/user/index.ts | 2 +- 6 files changed, 51 insertions(+), 7 deletions(-) diff --git a/apps/admin/app/dashboard/user/page.tsx b/apps/admin/app/dashboard/user/page.tsx index cfd4629..18d212a 100644 --- a/apps/admin/app/dashboard/user/page.tsx +++ b/apps/admin/app/dashboard/user/page.tsx @@ -2,7 +2,9 @@ import { Display } from '@/components/display'; import { ProTable, ProTableActions } from '@/components/pro-table'; +import { getSubscribeList } from '@/services/admin/subscribe'; import { createUser, deleteUser, getUserList, updateUserBasicInfo } from '@/services/admin/user'; +import { useQuery } from '@tanstack/react-query'; import { Badge } from '@workspace/ui/components/badge'; import { Button } from '@workspace/ui/components/button'; import { Switch } from '@workspace/ui/components/switch'; @@ -20,8 +22,19 @@ export default function Page() { const [loading, setLoading] = useState(false); const ref = useRef(null); + const { data: subscribeList } = useQuery({ + queryKey: ['getSubscribeList', 'all'], + queryFn: async () => { + const { data } = await getSubscribeList({ + page: 1, + size: 9999, + }); + return data.data?.list as API.SubscribeGroup[]; + }, + }); + return ( - > + action={ref} header={{ title: t('userList'), @@ -132,13 +145,38 @@ export default function Page() { cell: ({ row }) => formatDate(row.getValue('created_at')), }, ]} - request={async (pagination) => { - const { data } = await getUserList(pagination); + request={async (pagination, filter) => { + const { data } = await getUserList({ + ...pagination, + ...filter, + }); return { list: data.data?.list || [], total: data.data?.total || 0, }; }} + params={[ + { + key: 'subscribe_id', + placeholder: t('subscription'), + options: subscribeList?.map((item) => ({ + label: item.name, + value: String(item.id), + })), + }, + { + key: 'search', + placeholder: 'Search', + }, + { + key: 'user_id', + placeholder: t('userId'), + }, + { + key: 'user_subscribe_id', + placeholder: t('subscriptionId'), + }, + ]} actions={{ render: (row) => { return [ diff --git a/apps/admin/services/admin/index.ts b/apps/admin/services/admin/index.ts index f9e3438..37cdd29 100644 --- a/apps/admin/services/admin/index.ts +++ b/apps/admin/services/admin/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as ads from './ads'; diff --git a/apps/admin/services/admin/typings.d.ts b/apps/admin/services/admin/typings.d.ts index 5983650..5623102 100644 --- a/apps/admin/services/admin/typings.d.ts +++ b/apps/admin/services/admin/typings.d.ts @@ -745,12 +745,18 @@ declare namespace API { page: number; size: number; search?: string; + user_id?: number; + subscribe_id?: number; + user_subscribe_id?: number; }; type GetUserListRequest = { page: number; size: number; search?: string; + user_id?: number; + subscribe_id?: number; + user_subscribe_id?: number; }; type GetUserListResponse = { diff --git a/apps/admin/services/common/index.ts b/apps/admin/services/common/index.ts index 73b3bda..61ba129 100644 --- a/apps/admin/services/common/index.ts +++ b/apps/admin/services/common/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as auth from './auth'; diff --git a/apps/user/services/common/index.ts b/apps/user/services/common/index.ts index 73b3bda..61ba129 100644 --- a/apps/user/services/common/index.ts +++ b/apps/user/services/common/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as auth from './auth'; diff --git a/apps/user/services/user/index.ts b/apps/user/services/user/index.ts index f988131..12fe8d0 100644 --- a/apps/user/services/user/index.ts +++ b/apps/user/services/user/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as announcement from './announcement';