import { useLocalStorageState, useRequest } from "ahooks"; import { Input, Table, Spin, Typography, Flex } from "antd"; import type { XCXFindUser, XCXFindUserResp } from "@/types"; import User from "@/components/User"; import { SEX } from "@/utils/front"; import dayjs from "dayjs"; export function FindUserPage() { const [searchKey, setSearchKey] = useLocalStorageState('findUser:searchKey'); const findUserReq = useRequest(async (searchKey: string, page: number = 1) => { const findOutUsers: XCXFindUserResp = await (await fetch(`/api/user/find?page=${page}&key=${searchKey}`)).json(); return findOutUsers; }, { manual: true, cacheKey: 'findUser:result' }); return (
查找用户 setSearchKey(e.target.value)} onSearch={async (value) => { setSearchKey(value); if (!value) return; return findUserReq.runAsync(value); }} /> e.uid} dataSource={findUserReq.data?.data} pagination={{ total: findUserReq.data?.total, current: findUserReq.data?.current_page, pageSize: findUserReq.data?.per_page, onChange(page) { findUserReq.run(searchKey, page); }, }} > ( )} /> SEX[sex]} /> year !== '0' ? dayjs().diff(dayjs(year), 'year') : '-'} />
); }