关注 实训

dev_hjm^2
hjm 6 years ago
parent 25036be1e0
commit fef63f7786

@ -5,6 +5,9 @@
.discuss-tab {
height: 90px;
}
.discuss-tab ._forum_tab a.navItem {
line-height: 2;
}
.discuss-tab ._forum_tab a.navItem:hover {
color: #4CACFF !important;
border-bottom: none !important;

@ -444,7 +444,7 @@ class MemoDetail extends Component {
showSnackbar(response.data.message)
return;
}
if (response.data.status === 1) {
if (response.data.status === 0) {
if (!childCommentId) {
comment.hidden = !comment.hidden;
@ -677,7 +677,13 @@ class MemoDetail extends Component {
memo.isDetailPage = true;
// TODO 图片上传地址
return (
<div className="edu-back-white" id="forum_index_list"> {/* fl with100 */}
<div className="edu-back-white memoDetail" id="forum_index_list"> {/* fl with100 */}
<style>{`
.memoDetail .commentsbtn {
margin-top: 6px;
}
`}</style>
<RewardDialog goldRewardDialogOpen={goldRewardDialogOpen}
setRewardDialogVisible={this.setRewardDialogVisible}
rewardCode={this.rewardCodeMemo}
@ -693,7 +699,7 @@ class MemoDetail extends Component {
<i className="iconfont icon-gift mr5"></i>{memo.reward}
</span> }
{ _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'}}>
<div className="edu-position-hidebox" style={{position: 'absolute', right: '12px',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 &&
@ -713,13 +719,20 @@ class MemoDetail extends Component {
</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" >
|| _current_user.user_id === author_info.user_id) ? '': 'no_mr'} `} to="/forums"
style={{ marginRight: '10px'}}
>
返回
</Link>
</div>
<div className="color-grey-9 clearfix">
<span className="fl">{moment(memo.time).fromNow()} 发布</span>
<div className="fr">
<div className="fr detailIcons">
<style>{`
.detailIcons i{
vertical-align: sub;
}
`}</style>
{ _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>

@ -29,7 +29,7 @@ class PostItem extends Component {
<img alt="用户头像" className="bor-radius-all mt3" height="50" src={getImageUrl(`images/`+memo.image_url)} width="50" />
</a>
<div className="fl pr" style={{flex: 1}}>
<p className="font-16 clearfix" >
<p className="font-16 clearfix" style={{ lineHeight: 2 }}>
{/* target="_blank" */}
<a href={`/forums/${memo.id}`} target="_blank" title={memo.subject}
className="clearfix task-hide item_name fl" style={{maxWidth: '750px'}} >
@ -55,7 +55,7 @@ class PostItem extends Component {
{/*<span className="fl language-cir-orange mr10 mt3">C++</span>*/}
<p className="font-12 fr mr8 color-grey-6">
<p className="font-12 fr mr8 color-grey-6" style={{ marginTop: '4px' }}>
{/* data-tip-down="回复数" <i className="fa fa-comments-o mr5"></i>{memo.replies_count}
<i className="fa fa-thumbs-o-up mr5"></i>{memo.praise_count}*/}
{memo.replies_count ?

@ -33,7 +33,7 @@ class RecommendShixun extends Component {
</a>
<div className="ml10 flex1">
<a href={`/shixuns/${_shixun.identifier}/challenges`} target="_blank" data-tip-down={_shixun.name}
className="color-grey-6 task-hide mb12 recomment-name" style={{maxWidth:'147px'}}>
className="color-grey-6 task-hide mb10 recomment-name" style={{maxWidth:'147px'}}>
{_shixun.name}
</a>
<p className="color-grey-9">{_shixun.myshixuns_count} 人学习</p>
@ -50,7 +50,7 @@ class RecommendShixun extends Component {
// 参考 TPMShixunDiscuss.js 推荐实训, 页面路径http://localhost:3007/shixuns/uznmbg54/shixun_discuss
return (
<div className="padding10">
<p className="mb20 font-16 clearfix">推荐实训</p>
<p className="mb20 font-16 clearfix" style={{ lineHeight: 2 }}>推荐实训</p>
<div className="recommend-list">
{this.showRecommandShixun()}
</div>

@ -21,21 +21,46 @@ class UserSection extends Component {
const { author_info } = this.props
/*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/
const focusUrl = `/api/v1/users/${author_info.user_id}/${this.props.author_info.watched ? 'unwatch' : 'watch'}?object_id=${author_info.user_id}&object_type=user`
axios.get(focusUrl,{
})
.then((response) => {
const status = response.data.status;
console.log(status);
if(status == 1){
const new_author_info = Object.assign({}, this.props.author_info)
new_author_info.watched = !new_author_info.watched
this.props.initForumState({author_info: new_author_info})
}
}).catch((error) => {
console.log(error)
})
// const focusUrl = `/api/v1/users/${author_info.user_id}/${this.props.author_info.watched ? 'unwatch' : 'watch'}?object_id=${author_info.user_id}&object_type=user`
// axios.get(focusUrl,{
// })
// .then((response) => {
// const status = response.data.status;
// console.log(status);
// if(status == 1){
// const new_author_info = Object.assign({}, this.props.author_info)
// new_author_info.watched = !new_author_info.watched
// this.props.initForumState({author_info: new_author_info})
// }
// }).catch((error) => {
// console.log(error)
// })
let url=`/users/${author_info.user_id}/watch.json`;
// 取消关注
if(author_info.watched){
axios.delete(url).then((result)=>{
if(result){
const new_author_info = Object.assign({}, this.props.author_info)
new_author_info.watched = !new_author_info.watched
this.props.initForumState({author_info: new_author_info})
}
}).catch((error)=>{
console.log(error)
})
}else{
// 关注
axios.post(url).then((result)=>{
if(result){
const new_author_info = Object.assign({}, this.props.author_info)
new_author_info.watched = !new_author_info.watched
this.props.initForumState({author_info: new_author_info})
}
}).catch((error)=>{
console.log(error);
})
}
}

@ -11,7 +11,7 @@
height:48px;
width: 48px;
float: left;
margin-top: 7px;
margin-top: 4px;
}
.shixunReply{
max-width: 604px;

@ -83,7 +83,7 @@ class MemoShixun extends Component {
}
const stringifid = queryString.stringify(paramsObject);
const url = `/discusses.json?${stringifid}` // /${challenge.identifier}/star
const url = `/discusses/forum_discusses.json?${stringifid}` // /${challenge.identifier}/star
// 获取memo list
this.setState({

@ -39,7 +39,7 @@ class ShiXunPostItem extends Component
width="48px" height="48px" className="radius"/>
</a>
<div className="flex1 ml10 pr20">
<div className="clearfix">
<div className="clearfix" style={{ height: '32px' }}>
<p className="shixunReply task-hide font-16 fl">
<Link to={`${memo.tpm_url}`} title={memo.subject} target="_blank">{memo.subject}</Link>
</p>

Loading…
Cancel
Save