|
|
|
@ -4,13 +4,15 @@
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Date: 2019-12-17 17:34:00
|
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
|
* @LastEditTime : 2019-12-24 11:30:14
|
|
|
|
|
* @LastEditTime : 2019-12-24 18:08:07
|
|
|
|
|
*/
|
|
|
|
|
import './index.scss';
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import CommentItem from './CommentItem';
|
|
|
|
|
import { Empty } from 'antd';
|
|
|
|
|
function CommentList (props) {
|
|
|
|
|
const {
|
|
|
|
|
isAdmin,
|
|
|
|
|
commentLists, // 评论列表
|
|
|
|
|
submitChildComment,
|
|
|
|
|
submitDeleteComment,
|
|
|
|
@ -21,18 +23,27 @@ function CommentList (props) {
|
|
|
|
|
const {comments = []} = commentLists;
|
|
|
|
|
|
|
|
|
|
const renderLi = () => {
|
|
|
|
|
return comments.map((item, index) => {
|
|
|
|
|
if (comments.length > 0) {
|
|
|
|
|
return comments.map((item, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<CommentItem
|
|
|
|
|
isAdmin={isAdmin}
|
|
|
|
|
key={`item_${index}`}
|
|
|
|
|
submitChildComment={submitChildComment}
|
|
|
|
|
submitDeleteComment={submitDeleteComment}
|
|
|
|
|
comment={item}
|
|
|
|
|
likeComment={likeComment}
|
|
|
|
|
showOrHideComment={showOrHideComment}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
return (
|
|
|
|
|
<CommentItem
|
|
|
|
|
key={`item_${index}`}
|
|
|
|
|
submitChildComment={submitChildComment}
|
|
|
|
|
submitDeleteComment={submitDeleteComment}
|
|
|
|
|
comment={item}
|
|
|
|
|
likeComment={likeComment}
|
|
|
|
|
showOrHideComment={showOrHideComment}
|
|
|
|
|
/>
|
|
|
|
|
<div className="empty_comment">
|
|
|
|
|
<Empty />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|