import React, { useEffect, useCallback, useMemo, useState } from 'react' import styles from './index.module.scss' import { useDispatch, useSelector } from 'react-redux' import { Clue_APIgetClueList, getTopinfo } from '@/store/action/clue' import { RootState } from '@/store' import store from '@/store' import { ClueItem } from '@/types/api/clue' import { baseURL } from '@/utils/http' import classNames from 'classnames' import { Pagination } from 'antd' import ImageLazy from '@/components/ImageLazy' type LeftProps = { classN?: string } function Left(props: LeftProps) { const dispatch = useDispatch() const [topInfo, setTopInfo] = useState() const [pagination, setPagination] = useState({ current: 1, pageSize: 20 }) const [isFound, setIsFound] = useState(false) const getListFu = useCallback( (pageNum: number, pageSize: number) => { dispatch( Clue_APIgetClueList({ pageNum: pageNum, pageSize: pageSize, ...(isFound ? { status: 2 } : {}) }) ) }, [dispatch, isFound] ) const getTopinfoFu = useCallback(async () => { const res = await dispatch(getTopinfo() as any) console.log('res', JSON.parse(res.rtf)) setTopInfo(JSON.parse(res.rtf)) }, [dispatch]) const { list: listAll, total } = useSelector((state: RootState) => state.Clue.tableInfo) useEffect(() => { getTopinfoFu() }, [getTopinfoFu]) // 状态:0:待确认 | 1:跟进中 | 2:已找到 | 3:未找到 | 4:作废 useEffect(() => { getListFu(pagination.current, pagination.pageSize) }, [getListFu, pagination]) // 预览视频 const lookFileFu = useCallback((file: string) => { store.dispatch({ type: 'layout/lookDom', payload: { src: file, type: 'video' } }) }, []) return (
安葬烈士
{topInfo?.[0].pcs}
有名烈士
{topInfo?.[1].pcs}
无名烈士
{topInfo?.[2].pcs}
寻亲中
{topInfo?.[3].pcs}
已找到
{topInfo?.[4].pcs}
{ setIsFound(true) setPagination({ current: 1, pageSize: 20 }) }} > 寻亲案例
{ setIsFound(false) setPagination({ current: 1, pageSize: 20 }) }} > 线索更新
{listAll?.map((item: ClueItem) => { return (
{item.type}
{item.status}
烈士:{item.martyrName}
{item.city + item.region + item.address}
{item.remark &&
{item.remark}
} {item.result &&
{item.result}
} {(item.img || item.video) && (
<> {item.img?.map((item: any, index: number) => { return ( ) })} {item.video?.map((item: any, index: number) => { return (
)}
更新时间:{item.updateTime}
) })} { setPagination({ current: page, pageSize: size }) getListFu(page, size) }} />
) } const MemoLeft = React.memo(Left) export default MemoLeft