✨ feat(user): Integrate subscription list into user management, update request parameters and types
This commit is contained in:
parent
cf5c39cfe5
commit
8d49daca21
@ -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<ProTableActions>(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 (
|
||||
<ProTable<API.User, Record<string, unknown>>
|
||||
<ProTable<API.User, API.GetUserListParams>
|
||||
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 [
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @ts-ignore
|
||||
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as ads from './ads';
|
||||
|
||||
6
apps/admin/services/admin/typings.d.ts
vendored
6
apps/admin/services/admin/typings.d.ts
vendored
@ -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 = {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @ts-ignore
|
||||
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as auth from './auth';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @ts-ignore
|
||||
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as auth from './auth';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @ts-ignore
|
||||
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as announcement from './announcement';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user