import React, { Component } from "react"; import { Spin, Pagination } from "antd"; import intl from "react-intl-universal"; import Comment from "../../Comment"; import CommentBox from "../CommentBox"; import "./index.css"; class CommentList extends Component { constructor(props) { super(props); this.state = {}; } componentWillMount() { this.props.app.sGetComment({ page: this.props.app.page }); } renderPagination() { const { list, total, page, pageType, limit, isNoMoreComment, sGetComment, onPageChange, onGetMoreBtnClick } = this.props.app; if (pageType === "slice") { // 截断多余评论,通过点击查看更多跳转 return (
查看更多
); } else if (pageType === "more") { if (!isNoMoreComment && list.length !== total) { return (
{ sGetComment({ page: page + 1 }); onPageChange(page + 1); }} > {intl.get("comment.moreComment")}
); } else { return null; } } else if (pageType === "pagination") { return (
{ sGetComment({ page: p }); onPageChange(p); }} />
); } } render() { const { list, total, loading } = this.props.app; const spinning = Boolean( loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor ); return (
{/*
共 {total} 条评论
*/}
{intl.get("comment.totalComment", { total })}
{list.map(item => ( ))} {this.renderPagination()}
); } } CommentList.propTypes = {}; export default Comment(CommentList);