diff --git a/README/README-mock.md b/README/README-mock.md index 7f15804f..18d2b790 100644 --- a/README/README-mock.md +++ b/README/README-mock.md @@ -24,7 +24,7 @@ 取到上面的链接在浏览器中请求就可以得到如下结果。 -图片名称 +图片名称 diff --git a/client/containers/ProjectGroups/GroupList/GroupList.scss b/client/containers/ProjectGroups/GroupList/GroupList.scss index f4756b8f..576d2d90 100644 --- a/client/containers/ProjectGroups/GroupList/GroupList.scss +++ b/client/containers/ProjectGroups/GroupList/GroupList.scss @@ -14,7 +14,9 @@ white-space:nowrap; text-overflow:ellipsis; max-width: 150px; + vertical-align: bottom; } + color: #fff; font-size: 24px; } diff --git a/client/containers/User/LeftMenu.js b/client/containers/User/LeftMenu.js index bea84f33..37b9df58 100644 --- a/client/containers/User/LeftMenu.js +++ b/client/containers/User/LeftMenu.js @@ -11,7 +11,8 @@ const Option = AutoComplete.Option; console.log(state); return { curUid: state.login.uid + '', - curUserName: state.login.userName + curUserName: state.login.userName, + curUserRole: state.login.role } } ) @@ -28,7 +29,8 @@ class LeftMenu extends Component { static propTypes = { curUid: PropTypes.string, - curUserName: PropTypes.string + curUserName: PropTypes.string, + curUserRole: PropTypes.string } //延迟搜索 @@ -66,12 +68,14 @@ class LeftMenu extends Component { const menus = [{ title: '个人资料', path: `/user/profile/${this.props.curUid}` - }, { - title: '用户管理', - path: '/user/list' } ] - + if(this.props.curUserRole === 'admin'){ + menus.push({ + title: '用户管理', + path: '/user/list' + }) + } let content = menus.map((menu) => { return ( diff --git a/client/containers/User/List.js b/client/containers/User/List.js index 15567696..727a6662 100755 --- a/client/containers/User/List.js +++ b/client/containers/User/List.js @@ -2,6 +2,8 @@ import React, { Component } from 'react' import { formatTime } from '../../common.js' import { Link } from 'react-router-dom' //import PropTypes from 'prop-types' +import { connect } from 'react-redux' +import PropTypes from 'prop-types' import { Table, Popconfirm, @@ -10,7 +12,13 @@ import { import axios from 'axios'; const limit = 10; - +@connect( + state => { + return { + curUserRole: state.login.role + } + } +) class List extends Component { constructor(props) { @@ -21,7 +29,9 @@ class List extends Component { current: 1 } } - + static propTypes = { + curUserRole: PropTypes.string + } changePage =(current)=>{ this.setState({ current: current @@ -73,8 +83,11 @@ class List extends Component { } render() { - const role = 'admin' - const data = this.state.data; + const role = this.props.curUserRole; + let data = []; + if(role === 'admin'){ + data = this.state.data; + } let columns = [{ title: 'UID', dataIndex: '_id', diff --git a/static/doc/mock.html b/static/doc/mock.html index c640e723..65b42b7c 100644 --- a/static/doc/mock.html +++ b/static/doc/mock.html @@ -82,7 +82,7 @@

图片名称

取到上面的链接在浏览器中请求就可以得到如下结果。

-

图片名称

+

图片名称

2.1 Mock语法规范 #

参考自:Mock.js 官网