import { useLocalStorageState, useRequest } from "ahooks"; import { Input, Table, Spin, Typography, Flex, Space } from "antd"; import type { XCXFindUser, XCXFindUserResp } from "../types"; import User from "../components/User"; import { SEX } from "../utils"; import dayjs from "dayjs"; export function FindUserPage() { const [searchKey, setSearchKey] = useLocalStorageState('findUser:searchKey'); const findUserReq = useRequest(async (page: number = 1) => { const findOutUsers: XCXFindUserResp = await (await fetch(`/api/user/find?page=${page}&key=${searchKey}`)).json(); return findOutUsers; }, { manual: true, refreshDeps: [searchKey], cacheKey: 'findUser:result' }); return (
查找用户 setSearchKey(e.target.value)} onSearch={async () => findUserReq.runAsync()} /> 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(page); }, }} > ( )} /> SEX[sex]} /> year !== '0' ? dayjs().diff(dayjs(year), 'year') : '-'} />
); }