import React from 'react'; import { Box, Flex, useTheme } from '@chakra-ui/react'; import { getInforms, readInform } from '@/api/user'; import { usePagination } from '@/hooks/usePagination'; import { useLoading } from '@/hooks/useLoading'; import type { informSchema } from '@/types/mongoSchema'; import { formatTimeToChatTime } from '@/utils/tools'; import { useGlobalStore } from '@/store/global'; import MyIcon from '@/components/Icon'; const BillTable = () => { const theme = useTheme(); const { Loading } = useLoading(); const { isPc } = useGlobalStore(); const { data: informs, isLoading, total, pageSize, Pagination, getData, pageNum } = usePagination({ api: getInforms, pageSize: isPc ? 20 : 10 }); return ( {informs.map((item) => ( { if (!item.read) { await readInform(item._id); getData(pageNum); } }} > {item.title} {formatTimeToChatTime(item.time)} {item.content} {!item.read && ( )} ))} {!isLoading && informs.length === 0 && ( 暂无通知~ )} {total > pageSize && ( )} ); }; export default BillTable;