个人主页iscurrent

dev_cs_new
caishi 6 years ago
parent 58ac01b34d
commit c24f0987ee

@ -51,7 +51,7 @@ class Infos extends Component{
super(props);
this.state={
data:undefined,
is_current:true,
is_current:undefined,
is_edit:false,
sign:undefined,
type:0,
@ -93,6 +93,7 @@ class Infos extends Component{
}
//获取个人主页信息
getInfo = (user_login) =>{
let url =`/users/${user_login}/homepage_info.json`;
@ -219,18 +220,25 @@ class Infos extends Component{
render(){
let {
data ,
is_current,
is_edit,
sign,
type,
followed,
id,
login,
isRenders,
moduleName,
next_gold
}=this.state;
let isCurrent = true;
let currentLogin;
if(this.props.current_user && this.props.current_user.login != this.props.match.params.username){
isCurrent=false;
currentLogin = this.props.current_user.login;
}
const _commonProps = {
is_current: isCurrent,
login: currentLogin
}
return(
<div className="newMain">
{this.state.updata===undefined?"":<UpgradeModals
@ -242,6 +250,7 @@ class Infos extends Component{
<InfosBanner
{...this.props}
{...this.state}
{..._commonProps}
signFor={this.signFor}
followPerson={this.followPerson}
></InfosBanner>
@ -255,7 +264,7 @@ class Infos extends Component{
{/* http://localhost:3007/courses/1309/homework/9300/setting */}
<Route exact path="/users/:username/package"
render={
(props) => (<InfosPackage {...this.props} {...props} {...this.state} />)
(props) => (<InfosPackage {...this.props} {...props} {...this.state} {..._commonProps}/>)
}
></Route>
@ -263,42 +272,42 @@ class Infos extends Component{
{/* http://localhost:3007/courses/1309/homework/9300/setting */}
<Route exact path="/users/:username/courses"
render={
(props) => (<InfosCourse {...this.props} {...props} {...this.state} />)
(props) => (<InfosCourse {...this.props} {...props} {...this.state} {..._commonProps}/>)
}
></Route>
{/* 实训 */}
<Route exact path="/users/:username/shixuns"
render={
(props) => (<InfosShixun {...this.props} {...props} {...this.state} />)
(props) => (<InfosShixun {...this.props} {...props} {...this.state} {..._commonProps}/>)
}
></Route>
{/* 实训课程 */}
<Route exact path="/users/:username/paths"
render={
(props) => (<InfosPath {...this.props} {...props} {...this.state} />)
(props) => (<InfosPath {...this.props} {...props} {...this.state} {..._commonProps}/>)
}
></Route>
{/* 项目 */}
<Route exact path="/users/:username/projects"
render={
(props) => (<InfosProject {...this.props} {...props} {...this.state} />)
(props) => (<InfosProject {...this.props} {...props} {...this.state} {..._commonProps}/>)
}
></Route>
{/* 项目 */}
<Route exact path="/users/:username/videoes"
render={
(props) => (<InfosVideo {...this.props} {...props} {...this.state} />)
(props) => (<InfosVideo {...this.props} {...props} {...this.state} {..._commonProps}/>)
}
></Route>
<Route exact path="/users/:username"
render={
(props) => (<InfosCourse {...this.props} {...props} {...this.state} />)
(props) => (<InfosCourse {...this.props} {...props} {...this.state} {..._commonProps}/>)
}
></Route>

@ -17,18 +17,15 @@ class InfosBanner extends Component{
render(){
let {
data ,
is_current,
is_edit,
sign,
type,
followed,
id,
login,
moduleName,
next_gold
moduleName
}=this.props;
let is_current=this.props.is_current;
let {username}= this.props.match.params;
console.log("is_current");
console.log(is_current);
let {pathname}=this.props.location;
moduleName=pathname.split("/")[3];
return(
@ -40,7 +37,8 @@ class InfosBanner extends Component{
<p className="clearfix mt20">
<span className="username task-hide" style={{"maxWidth":'370px'}}>{data && data.name}</span>
{
data && is_current == false && data.identity =="学生" ? "" : <span className="userpost">{data && data.identity}</span>
data && is_current == false && data.identity =="学生" ? "" :
<span className="userpost"><label>{data && data.identity}</label></span>
}
</p>
<p className="mt20">

@ -152,15 +152,18 @@
}
.userpost{
padding:0px 10px;
height: 20px;
line-height:18px;
border:1px solid #fff;
border-radius: 2px;
color:#fff!important;
display: inline;
margin-top: 7px;
margin-top: 6px;
float:left;
}
.userpost label{
display:block;
height: 18px;
line-height:18px;
}
.user-colorgrey-B8{color:#B8B8B8}
.user-colorgrey-green{color:#7ED321}
.user_yellow_btn {
@ -195,7 +198,7 @@
height: 54px;
line-height: 54px;
background: #fff;
box-shadow:0px 5px 12px 3px #e6e6e6;
box-shadow:0px 9px 16px -1px #e6e6e6;
border-radius:7px;
padding:0px 10px;
}

Loading…
Cancel
Save