import useIndexDB from '@/Hook/useIndexDB'; import { Modal, Row, Pagination, Card, Input, Button, Space } from 'antd' import React, { useCallback, useEffect, useState } from 'react' import { useModel } from 'umi'; import style from './db.less' import filePng from '../../../public/file.png' /** * @param historyType //历史图文type 0: 智能互动消息历史 1:客服消息历史 */ type props = { visible: boolean, onCancel: () => void, onOK: (props: any, type?: number) => void, wx?: any, } const WxHistoryMpnews: React.FC = (props) => { const { visible, onCancel, onOK, } = props const [action, setAction] = useState(0) const [actionData, setActionData] = useState() let { state: { data, total } } = useModel('useOperating.useDB') const { query, del } = useIndexDB() //ok const pageSize = 10 // 每页请求多少数据 let ok = useCallback(() => { onOK(actionData) }, [actionData]) let pageSizeChange = useCallback((pageNum, pageSize) => { console.log(pageNum, pageSize) query({ start: pageNum, end: pageSize }) }, [query]) //选中图片 let handleClick = useCallback((data) => { setAction(data?.id) setActionData(data?.data) }, []) useEffect(() => { query() }, [query]) return 浏览器本地素材库不需要的数据请手动删除避免太多数据会很卡,存放上限跟个人浏览器浏览器性能相关!} onCancel={onCancel} onOk={ok} width={1000} > {/* */}
{ query({ str: value }) }} style={{ width: 300 }} />
{ [0, 1, 2].map((n) => { return
    { data.length > 0 && data?.map((item: any, index: number) => { if (index % 3 === n) { return
  • handleClick(item)}> { return
    {a?.title || a?.newsTitle} {/* */} {Object.keys(a)?.includes('newsPicUrl') ? : }
    }) } />
  • } return null }) }
}) }
} export default WxHistoryMpnews