dev_cs_new
杨树明 6 years ago
parent 409a2f31fb
commit 7d3da42c36

@ -1,62 +1,62 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames' import classNames from 'classnames'
import axios from 'axios' import axios from 'axios'
class UserSection extends Component { class UserSection extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
} }
} }
/*点击关注或者取消关注*/ /*点击关注或者取消关注*/
AboutFocus(){ AboutFocus(){
const { author_info } = this.props const { author_info } = this.props
/*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/ /*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` 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,{ axios.get(focusUrl,{
}) })
.then((response) => { .then((response) => {
const status = response.data.status; const status = response.data.status;
console.log(status); console.log(status);
if(status == 1){ if(status == 1){
const new_author_info = Object.assign({}, this.props.author_info) const new_author_info = Object.assign({}, this.props.author_info)
new_author_info.watched = !new_author_info.watched new_author_info.watched = !new_author_info.watched
this.props.initForumState({author_info: new_author_info}) this.props.initForumState({author_info: new_author_info})
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
} }
render() { render() {
const { match, history, author_info , current_user } = this.props const { match, history, author_info , current_user } = this.props
if (!author_info) { if (!author_info) {
return <div className="edu-back-white" id="forum_index_list"></div> return <div className="edu-back-white" id="forum_index_list"></div>
} }
return ( return (
<div className="edu-back-white padding40-20 edu-txt-center"> <div className="edu-back-white padding40-20 edu-txt-center">
<a href={`/users/${author_info.login}`} target="_blank"><img src={`/images/${author_info.image_url}`} width="90" height="90" className="radius mb5"/></a> <a href={`/users/${author_info.login}`} target="_blank"><img src={`/images/${author_info.image_url}`} width="90" height="90" className="radius mb5"/></a>
<p className="font-20 userPrivateName">{author_info.username}</p> <p className="font-20 userPrivateName">{author_info.username}</p>
<p className="color-grey-9 userPrivatePost">{author_info.identity}</p> <p className="color-grey-9 userPrivatePost">{author_info.identity}</p>
{ author_info.user_id !== current_user.user_id && { author_info.user_id !== current_user.user_id &&
<p className="clearfix mt30"> <p className="clearfix mt30">
<a href="javascript:void(0)" className="fl font-16 mr10 user_default_btn edu-blueback-btn" onClick={()=>{this.AboutFocus()}}>{ author_info.watched == true ? "取消关注" : "关注" }</a> <a href="javascript:void(0)" className="fl font-16 mr10 user_default_btn edu-blueback-btn" onClick={()=>{this.AboutFocus()}}>{ author_info.watched == true ? "取消关注" : "关注" }</a>
<a href={`/users/${current_user.login}/message_detail?user_id=${author_info.user_id}`} className="fr font-16 user_default_btn user_private_btn" target="_blank">私信</a> <a href={`/message/${current_user.login}/message_detail?target_ids=${author_info.user_id}`} className="fr font-16 user_default_btn user_private_btn" target="_blank">私信</a>
</p> } </p> }
</div> </div>
); );
} }
} }
export default UserSection; export default UserSection;

@ -18,7 +18,7 @@ class DownloadMessage extends Component {
setDownload=()=>{ setDownload=()=>{
this.modalCancel(); this.modalCancel();
window.open(`/users/${this.props.user.login}/message_detail?user_id=1`) window.open(`/message/${this.props.user.login}/message_detail?target_ids=1`)
} }
modalCancel = () => { modalCancel = () => {
this.setState({ this.setState({

@ -11,7 +11,7 @@ class DownloadMessageysl extends Component {
setDownload=()=>{ setDownload=()=>{
this.props.modalCancel(); this.props.modalCancel();
window.open(`/users/${this.props.user.login}/message_detail?user_id=1`) window.open(`/message/${this.props.user.login}/message_detail?target_ids=1`)
} }
render() { render() {

@ -293,8 +293,8 @@ class PackageIndexNEITaskDetails extends Component {
onMouseOver={this.setover} onMouseOver={this.setover}
onMouseOut={this.setout} onMouseOut={this.setout}
> >
{overtype===false?<a className="ContacttheTA fl" target="_blank" href={`/users/${data&&data.creator.login}/message_detail?user_id=${data&&data.creator.id}`}> <img alt="头像" class="mr5" src={require('./newsone.png')} />联系TA</a>: {overtype===false?<a className="ContacttheTA fl" target="_blank" href={`/message/${data&&data.creator.login}/message_detail?target_ids=${data&&data.creator.id}`}> <img alt="头像" class="mr5" src={require('./newsone.png')} />联系TA</a>:
<a className="ContacttheTAs fl" target="_blank" href={`/users/${data&&data.creator.login}/message_detail?user_id=${data&&data.creator.id}`}> <img alt="头像" className="mr5" <a className="ContacttheTAs fl" target="_blank" href={`/message/${data&&data.creator.login}/message_detail?target_ids=${data&&data.creator.id}`}> <img alt="头像" className="mr5"
src={require('./newstwo.png')}/>联系TA</a>} src={require('./newstwo.png')}/>联系TA</a>}
</div>} </div>}
</div> </div>
@ -407,7 +407,7 @@ class PackageIndexNEITaskDetails extends Component {
{item.status==="bidding_won"?<img src={gouxuan} className="yslgouxuanimg"/>:""} {item.status==="bidding_won"?<img src={gouxuan} className="yslgouxuanimg"/>:""}
<a href={`/users/${item.login}`}><img className="div1imgs" src={getImageUrl("images/"+item.image_url)}/></a> <a href={`/users/${item.login}`}><img className="div1imgs" src={getImageUrl("images/"+item.image_url)}/></a>
<div className="textall mt10" title={item.name}> <p className="ptext">{item.name}</p></div> <div className="textall mt10" title={item.name}> <p className="ptext">{item.name}</p></div>
{this.props.current_user&&this.props.current_user.login!=item.login?<a className="ContacttheTAs fl none" target="_blank" href={`/users/${item.login}/message_detail?user_id=${item.id}`}> {this.props.current_user&&this.props.current_user.login!=item.login?<a className="ContacttheTAs fl none" target="_blank" href={`/message/${item.login}/message_detail?target_ids=${item.id}`}>
<img alt="头像" className="mr5" src={require('./newstwo.png')}/>联系TA <img alt="头像" className="mr5" src={require('./newstwo.png')}/>联系TA
</a>:""} </a>:""}
</div> </div>

@ -357,7 +357,7 @@ class Infos extends Component{
: :
<div className="inline"> <div className="inline">
<a href="javascript:void(0);" onClick={this.followPerson} className="user_default_btn user_watch_btn user_private_btn fl mr20">{followed ? "取消关注":"关注"}</a> <a href="javascript:void(0);" onClick={this.followPerson} className="user_default_btn user_watch_btn user_private_btn fl mr20">{followed ? "取消关注":"关注"}</a>
<a href={`${this.props.Headertop && this.props.Headertop.old_url}/users/${login}/message_detail?user_id=${id}`} className="user_default_btn user_private_btn fl">私信</a> <a href={`${this.props.Headertop && this.props.Headertop.old_url}/message/${login}/message_detail?target_ids=${id}`} className="user_default_btn user_private_btn fl">私信</a>
</div> </div>
} }
</div> </div>

Loading…
Cancel
Save