mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
fix: user页去除subnav
This commit is contained in:
parent
a3873d8322
commit
61464964df
@ -18,7 +18,13 @@ const MenuUser = (props) => (
|
||||
<Menu.Item style={{"background":"#32363a",color:"white"}} key="0">
|
||||
<Link style={{color:"white"}} to={`/user/profile/${props.uid}`} onClick={props.relieveLink}><Icon type="user"/>个人中心</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="1">
|
||||
{
|
||||
props.role === "admin"?<Menu.Item style={{"background":"#32363a",color:"white"}} key="1">
|
||||
<Link style={{color:"white"}} to={`/user/list`}><Icon type="solution" />用户管理</Link>
|
||||
</Menu.Item>:""
|
||||
}
|
||||
|
||||
<Menu.Item key="2">
|
||||
<a style={{color:"white"}} onClick={props.logout}><Icon type="logout" />退出</a>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
@ -40,6 +46,7 @@ const tipDoc = (<div className="title-container">
|
||||
MenuUser.propTypes={
|
||||
user: PropTypes.string,
|
||||
msg: PropTypes.string,
|
||||
role: PropTypes.string,
|
||||
uid: PropTypes.number,
|
||||
relieveLink: PropTypes.func,
|
||||
logout: PropTypes.func
|
||||
@ -106,6 +113,7 @@ const ToolUser = (props)=> {
|
||||
user={props.user}
|
||||
msg={props.msg}
|
||||
uid={props.uid}
|
||||
role={props.role}
|
||||
relieveLink={props.relieveLink}
|
||||
logout={props.logout}
|
||||
/>
|
||||
@ -125,6 +133,7 @@ const ToolUser = (props)=> {
|
||||
ToolUser.propTypes={
|
||||
user: PropTypes.string,
|
||||
msg: PropTypes.string,
|
||||
role: PropTypes.string,
|
||||
uid: PropTypes.number,
|
||||
relieveLink: PropTypes.func,
|
||||
logout: PropTypes.func,
|
||||
@ -141,6 +150,7 @@ ToolUser.propTypes={
|
||||
user: state.user.userName,
|
||||
uid: state.user.uid,
|
||||
msg: null,
|
||||
role: state.user.role,
|
||||
login:state.user.isLogin,
|
||||
studyTip: state.user.studyTip,
|
||||
study: state.user.study
|
||||
@ -163,6 +173,7 @@ export default class HeaderCom extends Component {
|
||||
user: PropTypes.string,
|
||||
msg: PropTypes.string,
|
||||
uid: PropTypes.number,
|
||||
role: PropTypes.string,
|
||||
login:PropTypes.bool,
|
||||
relieveLink:PropTypes.func,
|
||||
logoutActions:PropTypes.func,
|
||||
@ -220,7 +231,7 @@ export default class HeaderCom extends Component {
|
||||
|
||||
|
||||
render () {
|
||||
const { login, user, msg, uid, studyTip, study } = this.props;
|
||||
const { login, user, msg, uid, role, studyTip, study } = this.props;
|
||||
return (
|
||||
<Header className="header-box m-header">
|
||||
<div className="content g-row">
|
||||
@ -234,7 +245,7 @@ export default class HeaderCom extends Component {
|
||||
<div className="user-toolbar" style={{ position: 'relative', zIndex: this.props.studyTip > 0 ? 3 : 1}}>
|
||||
{login?
|
||||
<ToolUser
|
||||
{...{studyTip, study, user, msg, uid}}
|
||||
{...{studyTip, study, user, msg, uid, role}}
|
||||
relieveLink={ this.relieveLink }
|
||||
logout={ this.logout }
|
||||
/>
|
||||
|
@ -247,13 +247,13 @@ class MemberList extends Component {
|
||||
onCancel={this.handleCancel}
|
||||
>
|
||||
<Row gutter={6} className="modal-input">
|
||||
<Col span="5"><div className="label">用户名: </div></Col>
|
||||
<Col span="5"><div className="label usernamelabel">用户名: </div></Col>
|
||||
<Col span="15">
|
||||
<UsernameAutoComplete callbackState={this.onUserSelect} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={6} className="modal-input">
|
||||
<Col span="5"><div className="label">权限: </div></Col>
|
||||
<Col span="5"><div className="label usernameauth">权限: </div></Col>
|
||||
<Col span="15">
|
||||
<Select size="large" defaultValue="dev" className="select" onChange={this.changeNewMemberRole}>
|
||||
<Option value="owner">组长</Option>
|
||||
|
@ -49,4 +49,8 @@
|
||||
.m-user-name {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
}
|
||||
.usernamelabel,.usernameauth{
|
||||
line-height: 36px;
|
||||
}
|
||||
|
@ -102,7 +102,6 @@ class List extends Component {
|
||||
key: 'username',
|
||||
width: 180,
|
||||
render: (username, item)=>{
|
||||
console.log(item)
|
||||
return <Link to={"/user/profile/" + item._id} >{item.username}</Link>
|
||||
}
|
||||
}, {
|
||||
|
@ -6,7 +6,6 @@ import List from './List.js'
|
||||
import PropTypes from 'prop-types'
|
||||
import Profile from './Profile.js'
|
||||
import { Row } from 'antd';
|
||||
import Subnav from '../../components/Subnav/Subnav.js';
|
||||
@connect(state=>{
|
||||
return {
|
||||
curUid: state.user.uid,
|
||||
@ -29,22 +28,8 @@ class User extends Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
let navData = [{
|
||||
name: '用户资料',
|
||||
path: `/user/profile/${this.props.curUid}`
|
||||
}];
|
||||
if(this.props.role === "admin"){
|
||||
navData.push({
|
||||
name: '用户管理',
|
||||
path: '/user/list'
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Subnav
|
||||
default={'个人资料'}
|
||||
data={navData}/>
|
||||
<div className="g-doc">
|
||||
<Row className="user-box">
|
||||
<Route path={this.props.match.path + '/list'} component={List} />
|
||||
|
Loading…
Reference in New Issue
Block a user