2017-07-17 11:01:05 +08:00
|
|
|
import './index.scss'
|
|
|
|
import React, { Component } from 'react'
|
|
|
|
import { connect } from 'react-redux'
|
2017-07-24 10:59:17 +08:00
|
|
|
import { Route } from 'react-router-dom'
|
2017-08-10 21:20:23 +08:00
|
|
|
// import LeftMenu from './LeftMenu.js'
|
2017-07-17 11:01:05 +08:00
|
|
|
import List from './List.js'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import Profile from './Profile.js'
|
2017-08-10 21:20:23 +08:00
|
|
|
import { Row } from 'antd';
|
|
|
|
import Subnav from '../../components/Subnav/Subnav.js';
|
2017-08-11 12:19:31 +08:00
|
|
|
@connect(state=>{
|
|
|
|
return {
|
|
|
|
curUid: state.user.uid,
|
|
|
|
userType: state.user.type,
|
|
|
|
role: state.user.role
|
|
|
|
}
|
|
|
|
},{
|
|
|
|
|
|
|
|
})
|
2017-07-17 11:01:05 +08:00
|
|
|
class User extends Component {
|
|
|
|
static propTypes = {
|
2017-08-11 12:19:31 +08:00
|
|
|
match: PropTypes.object,
|
|
|
|
curUid: PropTypes.number,
|
|
|
|
userType: PropTypes.string,
|
|
|
|
role: PropTypes.string
|
2017-07-17 11:01:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props)
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
2017-08-11 12:19:31 +08:00
|
|
|
let navData = [{
|
2017-08-17 20:08:10 +08:00
|
|
|
name: '用户资料',
|
2017-08-11 12:19:31 +08:00
|
|
|
path: `/user/profile/${this.props.curUid}`
|
|
|
|
}];
|
|
|
|
if(this.props.role === "admin"){
|
|
|
|
navData.push({
|
2017-08-15 16:55:46 +08:00
|
|
|
name: '用户管理',
|
2017-08-11 12:19:31 +08:00
|
|
|
path: '/user/list'
|
|
|
|
})
|
|
|
|
}
|
2017-07-27 14:35:27 +08:00
|
|
|
|
2017-07-17 11:01:05 +08:00
|
|
|
return (
|
2017-08-10 21:20:23 +08:00
|
|
|
<div>
|
|
|
|
<Subnav
|
2017-08-11 12:19:31 +08:00
|
|
|
default={'个人资料'}
|
|
|
|
data={navData}/>
|
2017-08-10 21:20:23 +08:00
|
|
|
<div className="g-doc">
|
|
|
|
<Row gutter={16} className="user-box">
|
2017-07-27 14:35:27 +08:00
|
|
|
<Route path={this.props.match.path + '/list'} component={List} />
|
|
|
|
<Route path={this.props.match.path + '/profile/:uid'} component={Profile} />
|
2017-08-10 21:20:23 +08:00
|
|
|
</Row>
|
|
|
|
</div>
|
2017-07-17 11:01:05 +08:00
|
|
|
</div>
|
2017-07-27 14:35:27 +08:00
|
|
|
)
|
2017-07-17 11:01:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-27 14:35:27 +08:00
|
|
|
export default User
|