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