dev_new_shixunsrepository
杨树明 5 years ago
parent 856bdab85d
commit 5f120bcf87

@ -682,6 +682,7 @@ class TopicDetail extends Component {
</div> </div>
{!isCourseEnd && <MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么" {!isCourseEnd && <MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么"
{...this.props}
height={160} showError={true} buttonText={'发表'} className={comments && comments.length && 'borderBottom'}></MemoDetailMDEditor>} height={160} showError={true} buttonText={'发表'} className={comments && comments.length && 'borderBottom'}></MemoDetailMDEditor>}
{/* onClick={ this.createNewComment } {/* onClick={ this.createNewComment }

@ -252,6 +252,7 @@ class CommonReply extends Component{
<MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么" <MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么"
height={160} showError={true} imageExpand={true} height={160} showError={true} imageExpand={true}
replyComment={this.replyComment} replyComment={this.replyComment}
{...this.props}
commentsLength={comments ? comments.length : 0} commentsLength={comments ? comments.length : 0}
></MemoDetailMDEditor> ></MemoDetailMDEditor>
{/* bor-bottom-greyE */} {/* bor-bottom-greyE */}

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

@ -226,7 +226,7 @@ class GraduateTopicReply extends Component{
return( return(
<React.Fragment> <React.Fragment>
<MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么" <MemoDetailMDEditor {...this.props} ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么"
height={160} showError={true}></MemoDetailMDEditor> height={160} showError={true}></MemoDetailMDEditor>
<div className="padding40 bor-bottom-greyE memoReplies commentsDelegateParent" <div className="padding40 bor-bottom-greyE memoReplies commentsDelegateParent"

@ -816,9 +816,9 @@ class MemoDetail extends Component {
} }
</div> </div>
{ window.__useKindEditor === true ? { window.__useKindEditor === true ?
<MemoDetailKEEditor ref="editor" memo={memo}></MemoDetailKEEditor> <MemoDetailKEEditor ref="editor" memo={memo} {...this.props}></MemoDetailKEEditor>
: :
<MemoDetailMDEditor ref="editor" memo={memo}></MemoDetailMDEditor> <MemoDetailMDEditor ref="editor" memo={memo} {...this.props}></MemoDetailMDEditor>
} }
{/* onClick={ this.createNewComment } */} {/* onClick={ this.createNewComment } */}

Loading…
Cancel
Save