fix: 修改样式及用户管理只在admin时展示

This commit is contained in:
qitmac000249 2017-08-01 14:08:51 +08:00
parent 8db1594712
commit 10f7a47aa2
5 changed files with 31 additions and 12 deletions

View File

@ -24,7 +24,7 @@
取到上面的链接在浏览器中请求就可以得到如下结果。
<img src="http://note.youdao.com/yws/api/personal/file/WEBf168cd41d3ad4b5b24d68787063220c7?method=download&shareKey=beb6896165ddd3568ebecbcc92195180" width = "800" style="margin:0px auto;display:block;" alt="图片名称" align=center />
<img src="http://note.youdao.com/yws/api/personal/file/WEB1d1f7dc7b83a8cd6f576953cf45e9719?method=download&shareKey=99b4af9baac527b969543dd0a909d2a1" width = "800" style="margin:0px auto;display:block;" alt="图片名称" align=center />

View File

@ -14,7 +14,9 @@
white-space:nowrap;
text-overflow:ellipsis;
max-width: 150px;
vertical-align: bottom;
}
color: #fff;
font-size: 24px;
}

View File

@ -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 (
<Menu.Item key={'#' + menu.path} >

View File

@ -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',

View File

@ -82,7 +82,7 @@
</blockquote>
<p><img src="http://note.youdao.com/yws/api/personal/file/WEB525ea3dadf1f274bbe12943341ba00cb?method=download&shareKey=95dbc9cf7a7646387c55dabf64cad888" width = "800" style="margin:0px auto;display:block;" alt="图片名称" align=center /></p>
<p>取到上面的链接在浏览器中请求就可以得到如下结果。</p>
<p><img src="http://note.youdao.com/yws/api/personal/file/WEBf168cd41d3ad4b5b24d68787063220c7?method=download&shareKey=beb6896165ddd3568ebecbcc92195180" width = "800" style="margin:0px auto;display:block;" alt="图片名称" align=center /></p>
<p><img src="http://note.youdao.com/yws/api/personal/file/WEB1d1f7dc7b83a8cd6f576953cf45e9719?method=download&shareKey=99b4af9baac527b969543dd0a909d2a1" width = "800" style="margin:0px auto;display:block;" alt="图片名称" align=center /></p>
<p><span id = "mock"></span></p>
<h3 class="subject" id="2.1_Mock语法规范">2.1 Mock语法规范 <a class="hashlink" href="#2.1_Mock语法规范">#</a></h3><blockquote>
<p>参考自:<a href="http://mockjs.com/">Mock.js 官网</a></p>