|
|
|
@ -18,7 +18,7 @@ import { generateComments, generateChildComments, _findById, handleContentBefore
|
|
|
|
|
const REPLY_PAGE_COUNT = 10
|
|
|
|
|
const $ = window.$;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
/*
|
|
|
|
|
相比较GraduateTopicReply 改动的地方
|
|
|
|
|
列表接口名 /graduation_tasks/${graduation_topic_id}/show_comment.json?parent_id=${parent.id}&limit=500
|
|
|
|
|
回复类型名 jour_type: 'GraduationTask',
|
|
|
|
@ -34,7 +34,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
componentDidMount(){
|
|
|
|
|
this.fetchReplies()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
_getUser() {
|
|
|
|
|
const { current_user } = this.props;
|
|
|
|
@ -58,7 +58,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
// m_parent_id
|
|
|
|
|
reply_id: memo.user_id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if (response.data.status === -1) {
|
|
|
|
|
console.error('服务端异常')
|
|
|
|
@ -66,18 +66,18 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
}
|
|
|
|
|
// this.props.showNotification('帖子发表成功')
|
|
|
|
|
|
|
|
|
|
if (response.data && response.data.id) {
|
|
|
|
|
if (response.data && response.data.id) {
|
|
|
|
|
const _id = response.data.id;
|
|
|
|
|
// md
|
|
|
|
|
editor.setValue && editor.setValue('')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const user = this._getUser();
|
|
|
|
|
this.setState({
|
|
|
|
|
comments: addNewComment(this.state.comments, _id, content, user, this.props.isSuperAdmin(), this),
|
|
|
|
|
total_count: this.state.total_count + 1
|
|
|
|
|
})
|
|
|
|
|
this.refs.editor.showEditor();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
@ -95,13 +95,13 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const url = `/users/reply_message.json`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { comments } = this.state;
|
|
|
|
|
const user = this._getUser();
|
|
|
|
|
const graduation_topic_id = this.props.memo.id
|
|
|
|
|
const commentIndex = this._findById(id, comments);
|
|
|
|
|
let comment = comments[commentIndex];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
commentContent = handleContentBeforeCreateSecondLevelComment(commentContent)
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
journals_for_message: {
|
|
|
|
@ -113,9 +113,9 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if (response.data.id) {
|
|
|
|
|
if (response.data.id) {
|
|
|
|
|
let newId = response.data.id;
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
@ -128,7 +128,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
memo: newMemo2
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
@ -142,7 +142,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
const { comments } = response.data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const memo = Object.assign({}, this.state.memo)
|
|
|
|
|
// memo.sum_replies_count = sum_replies_count;
|
|
|
|
@ -160,7 +160,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
this.fetchReplies()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fetchReplies = () => {
|
|
|
|
|
const graduation_topic_id = this.props.memo.id
|
|
|
|
|
const course_id = this.props.course_id
|
|
|
|
@ -170,7 +170,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
const { comments, messages_count } = response.data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
comments: generateComments(comments, this.transformReply),
|
|
|
|
|
// : this.state.comments.concat(comments),
|
|
|
|
@ -180,7 +180,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
transformReply = (reply, children = []) => {
|
|
|
|
|
const isAdmin = this.props.isAdmin()
|
|
|
|
|
const isSuperAdmin = this.props.isSuperAdmin()
|
|
|
|
@ -189,7 +189,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
isSuperAdmin: isSuperAdmin,
|
|
|
|
|
permission: true, //
|
|
|
|
|
children: children,
|
|
|
|
|
hidden: reply.hidden,
|
|
|
|
|
hidden: reply.hidden,
|
|
|
|
|
id: reply.id,
|
|
|
|
|
image_url: reply.author.image_url,
|
|
|
|
|
reward: null, //
|
|
|
|
@ -235,7 +235,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
<style>{`
|
|
|
|
|
|
|
|
|
|
`}</style>
|
|
|
|
|
<MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="请在此输入对本作品的评语,最大限制2000个字符"
|
|
|
|
|
<MemoDetailMDEditor {...this.props} ref="editor" memo={memo} usingMockInput={true} placeholder="请在此输入对本作品的评语,最大限制2000个字符"
|
|
|
|
|
height={160} showError={true}></MemoDetailMDEditor>
|
|
|
|
|
|
|
|
|
|
<div className="padding40 bor-bottom-greyE memoReplies commentsDelegateParent"
|
|
|
|
@ -251,7 +251,7 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
commentPraise={this.commentPraise}
|
|
|
|
|
rewardCode={this.rewardCode}
|
|
|
|
|
hiddenComment={this.hiddenComment}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
usingAntdModal={true}
|
|
|
|
|
isChildCommentPagination={true}
|
|
|
|
|
loadMoreChildComments={this.loadMoreChildComments}
|
|
|
|
@ -259,15 +259,15 @@ class GraduationTaskssettingReply extends Component{
|
|
|
|
|
showRewardButton={false}
|
|
|
|
|
onlySuperAdminCouldHide={true}
|
|
|
|
|
></Comments>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* { true ? :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* { true ? :
|
|
|
|
|
<div className="memoMore">
|
|
|
|
|
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
|
|
|
|
|
</div>} */}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{ total_count > REPLY_PAGE_COUNT &&
|
|
|
|
|
|
|
|
|
|
{ total_count > REPLY_PAGE_COUNT &&
|
|
|
|
|
<div className="memoMore">
|
|
|
|
|
<Pagination showQuickJumper onChange={this.onPaginationChange} current={pageCount} total={total_count} pageSize={10}/>
|
|
|
|
|
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
|
|
|
|
|