个人主页iscurrent

dev_cs_new
caishi 6 years ago
parent 58ac01b34d
commit c24f0987ee

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

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

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

Loading…
Cancel
Save