import React, { useEffect, useState } from 'react'; import './style.less'; import { Input, List, Spin } from 'antd'; import { formatTime } from './utils'; import { history } from 'umi'; import { getClassroomList } from './Home/service'; const { Search } = Input; const ClassroomList: React.FC<{}> = () => { //project data const [classroomList, setClassroomList] = useState([]); //loading const [loading, setLoading] = useState(false); //page const [page, setPage] = useState(1); //get project const getClassroomData = (value: string) => { setLoading(true); getClassroomList({ param: value }).then(res => { if (res?.code == 200) { setClassroomList(res?.data); setPage(1); } }).finally(() => { setLoading(false); }) } //onclick const clickTitle = (data: any) => { history.push({ pathname: "/highQualityOperation/detail", state: { detail: data } }); } //to home const toHome = () => { history.push("/highQualityOperation/home"); } //to previous page const toPreviousPage = () => { setPage((page) => page - 1); } //to next page const toNextPage = () => { setPage((page) => page + 1); } useEffect(() => { getClassroomData(''); }, []) return (
toHome()}>返回首页 {page > 1 && toPreviousPage()}>上一页} {classroomList.length != 0 && page < Math.ceil(classroomList.length / 10) && toNextPage()}>下一页}
运营提升小课堂
{ setPage(page); }, current: page, showTotal: (total) => `共 ${total} 条`, pageSize: 10, }} dataSource={classroomList} renderItem={item => (

clickTitle(item)}>{item.title}

{formatTime(item.createTime, 'YYYY-MM-DD')}
)} />
) } export default ClassroomList;