|
|
|
@ -54,12 +54,12 @@ class MemoDetail extends Component {
|
|
|
|
|
|
|
|
|
|
const { match } = this.props
|
|
|
|
|
|
|
|
|
|
const memoUrl = `/api/v1/memos/${match.params.memoId}`;
|
|
|
|
|
const memoUrl = `/memos/${match.params.memoId}.json`;
|
|
|
|
|
this.setState({
|
|
|
|
|
memoLoading: true
|
|
|
|
|
})
|
|
|
|
|
axios.get(memoUrl,{
|
|
|
|
|
withCredentials: true,
|
|
|
|
|
// withCredentials: true,
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
const memo = response.data.memo
|
|
|
|
@ -91,9 +91,9 @@ class MemoDetail extends Component {
|
|
|
|
|
})
|
|
|
|
|
delete response.data.memo_replies;
|
|
|
|
|
this.props.initForumState(response.data)
|
|
|
|
|
const user = response.data.current_user;
|
|
|
|
|
user.tidding_count = response.data.tidding_count;
|
|
|
|
|
this.props.initCommonState(user)
|
|
|
|
|
// const user = response.data.current_user;
|
|
|
|
|
// user.tidding_count = response.data.tidding_count;
|
|
|
|
|
// this.props.initCommonState(user)
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
memoLoading: false
|
|
|
|
@ -119,7 +119,7 @@ class MemoDetail extends Component {
|
|
|
|
|
const deleteUrl = `/api/v1/memos/${memo.id}`;
|
|
|
|
|
// 获取memo list
|
|
|
|
|
axios.delete(deleteUrl, {
|
|
|
|
|
withCredentials: true,
|
|
|
|
|
// withCredentials: true,
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
const status = response.data.status
|
|
|
|
@ -587,7 +587,7 @@ class MemoDetail extends Component {
|
|
|
|
|
const set_top_or_down_Url = `/api/v1/memos/${memo.id}/set-top-or-down?${paramsUrl}`;
|
|
|
|
|
// 获取memo list
|
|
|
|
|
axios.get(set_top_or_down_Url, {
|
|
|
|
|
withCredentials: true,
|
|
|
|
|
// withCredentials: true,
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
const status = response.data.status
|
|
|
|
@ -619,7 +619,7 @@ class MemoDetail extends Component {
|
|
|
|
|
score: _reward,
|
|
|
|
|
user_id: author_info.user_id
|
|
|
|
|
}, {
|
|
|
|
|
withCredentials: true,
|
|
|
|
|
// withCredentials: true,
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
const { code } = response.data;
|
|
|
|
@ -659,10 +659,14 @@ class MemoDetail extends Component {
|
|
|
|
|
const { memo, recommend_shixun, current_user,author_info } = this.props;
|
|
|
|
|
const { comments, hasMoreComments, goldRewardDialogOpen } = this.state;
|
|
|
|
|
|
|
|
|
|
if (this.state.memoLoading) {
|
|
|
|
|
if (!memo || this.state.memoLoading) {
|
|
|
|
|
return <div className="edu-back-white" id="forum_index_list"></div>
|
|
|
|
|
}
|
|
|
|
|
current_user.user_url = `/users/${current_user.login}`;
|
|
|
|
|
let _current_user = {}
|
|
|
|
|
if (current_user) {
|
|
|
|
|
_current_user = current_user
|
|
|
|
|
}
|
|
|
|
|
(_current_user.user_url = `/users/${_current_user.login}`);
|
|
|
|
|
memo.isDetailPage = true;
|
|
|
|
|
// TODO 图片上传地址
|
|
|
|
|
return (
|
|
|
|
@ -681,11 +685,11 @@ class MemoDetail extends Component {
|
|
|
|
|
data-tip-down={`获得平台奖励金币:${memo.reward}`} >
|
|
|
|
|
<i className="iconfont icon-gift mr5"></i>{memo.reward}
|
|
|
|
|
</span> }
|
|
|
|
|
{ current_user && (current_user.admin === true || current_user.user_id === author_info.user_id) &&
|
|
|
|
|
{ _current_user && (_current_user.admin === true || _current_user.user_id === author_info.user_id) &&
|
|
|
|
|
<div className="edu-position-hidebox" style={{position: 'absolute', right: '18px',top:'4px'}}>
|
|
|
|
|
<a href="javascript:void(0);"><i className="fa fa-bars font-16"></i></a>
|
|
|
|
|
<ul className="edu-position-hide undis">
|
|
|
|
|
{ current_user.admin === true &&
|
|
|
|
|
{ _current_user.admin === true &&
|
|
|
|
|
( memo.sticky === true ?
|
|
|
|
|
<li><a href="javascript:void(0);" onClick={() => this.setTop(memo)}>取消置顶</a></li>
|
|
|
|
|
:
|
|
|
|
@ -701,15 +705,15 @@ class MemoDetail extends Component {
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
<Link className={`task-hide fr return_btn color-grey-6 mt2 ${ current_user && (current_user.admin === true
|
|
|
|
|
|| current_user.user_id === author_info.user_id) ? '': 'no_mr'} `} to="/forums" >
|
|
|
|
|
<Link className={`task-hide fr return_btn color-grey-6 mt2 ${ _current_user && (_current_user.admin === true
|
|
|
|
|
|| _current_user.user_id === author_info.user_id) ? '': 'no_mr'} `} to="/forums" >
|
|
|
|
|
返回
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="color-grey-9 clearfix">
|
|
|
|
|
<span className="fl">{moment(memo.time).fromNow()} 发布</span>
|
|
|
|
|
<div className="fr">
|
|
|
|
|
{ current_user.admin && <Tooltip title={ "帖子奖励" }>
|
|
|
|
|
{ _current_user.admin && <Tooltip title={ "帖子奖励" }>
|
|
|
|
|
<span className="noteDetailNum rightline cdefault" style={{padding: '0 4px', cursor: 'pointer'}}>
|
|
|
|
|
<i className="iconfont icon-jiangli mr5" onClick={this.showRewardDialog}></i>
|
|
|
|
|
</span>
|
|
|
|
@ -770,7 +774,7 @@ class MemoDetail extends Component {
|
|
|
|
|
<span className="count">{memo.replies_count}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Comments comments={comments} user={current_user}
|
|
|
|
|
<Comments comments={comments} user={_current_user}
|
|
|
|
|
replyComment={this.replyComment}
|
|
|
|
|
deleteComment={this.deleteComment}
|
|
|
|
|
commentPraise={this.commentPraise}
|
|
|
|
|