mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
fix: 修改project的显示
This commit is contained in:
parent
4d035a434b
commit
18442ed387
@ -20,7 +20,8 @@ import './GroupList.scss'
|
||||
@connect(
|
||||
state => ({
|
||||
groupList: state.group.groupList,
|
||||
currGroup: state.group.currGroup
|
||||
currGroup: state.group.currGroup,
|
||||
curUserRole: state.login.role
|
||||
}),
|
||||
{
|
||||
fetchGroupList,
|
||||
@ -38,7 +39,8 @@ export default class GroupList extends Component {
|
||||
setCurrGroup: PropTypes.func,
|
||||
setGroupList: PropTypes.func,
|
||||
match: PropTypes.object,
|
||||
history: PropTypes.object
|
||||
history: PropTypes.object,
|
||||
curUserRole: PropTypes.string
|
||||
}
|
||||
|
||||
state = {
|
||||
@ -190,17 +192,25 @@ export default class GroupList extends Component {
|
||||
|
||||
render () {
|
||||
const { currGroup } = this.props;
|
||||
const delmark = <Icon className="edit-group" type="edit" title="编辑分组" onClick={() => this.showModal(TYPE_EDIT)}/>
|
||||
const editmark = (<Popconfirm title={`你确定要删除分组 ${currGroup.group_name}?`} onConfirm={this.deleteGroup}>
|
||||
<Icon className="delete-group" type="delete" title="删除分组"/>
|
||||
</Popconfirm>)
|
||||
|
||||
|
||||
return (
|
||||
<div className="m-group">
|
||||
<div className="group-bar">
|
||||
<div className="curr-group">
|
||||
<div className="curr-group-name">
|
||||
<div className="text" title={currGroup.group_name}>{currGroup.group_name}</div>
|
||||
<Icon className="edit-group" type="edit" title="编辑分组" onClick={() => this.showModal(TYPE_EDIT)}/>
|
||||
<Popconfirm title={`你确定要删除分组 ${currGroup.group_name}?`} onConfirm={this.deleteGroup}>
|
||||
<Icon className="delete-group" type="delete" title="删除分组"/>
|
||||
</Popconfirm>
|
||||
{
|
||||
this.props.curUserRole === "admin"?(editmark):''
|
||||
}
|
||||
{
|
||||
this.props.curUserRole === "admin"?(delmark):''
|
||||
}
|
||||
|
||||
</div>
|
||||
<div className="curr-group-desc" title={currGroup.group_desc}>简介:{currGroup.group_desc}</div>
|
||||
</div>
|
||||
@ -208,7 +218,10 @@ export default class GroupList extends Component {
|
||||
<div className="search">
|
||||
<Search onChange={this.searchGroup} onSearch={(v) => this.searchGroup(null, v)}/>
|
||||
</div>
|
||||
<Button type="primary" onClick={this.showModal}>添加分组</Button>
|
||||
{
|
||||
this.props.curUserRole === "admin"?(<Button type="primary" onClick={this.showModal}>添加分组</Button>):''
|
||||
}
|
||||
|
||||
</div>
|
||||
<Menu
|
||||
className="group-list"
|
||||
|
@ -21,9 +21,11 @@ const initialState = {
|
||||
export default (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case GET_LOGIN_STATE: {
|
||||
console.log(action.payload.data);
|
||||
return {
|
||||
...state,
|
||||
isLogin: (action.payload.data.errcode == 0),
|
||||
role: action.payload.data.data ? action.payload.data.data.role:null,
|
||||
loginState: (action.payload.data.errcode == 0)?MEMBER_STATUS:GUEST_STATUS,
|
||||
userName: action.payload.data.data ? action.payload.data.data.username : null,
|
||||
uid: action.payload.data.data ? action.payload.data.data._id : null,
|
||||
|
@ -60,7 +60,7 @@ class baseController {
|
||||
|
||||
async getLoginStatus(ctx) {
|
||||
if (await this.checkLogin(ctx) === true) {
|
||||
let result = yapi.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time']);
|
||||
let result = yapi.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time','role']);
|
||||
result.server_ip = yapi.WEBCONFIG.server_ip;
|
||||
return ctx.body = yapi.commons.resReturn(result);
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ class userController extends baseController {
|
||||
|
||||
return ctx.body = yapi.commons.resReturn({
|
||||
username: result.username,
|
||||
role: result.role,
|
||||
uid: result._id,
|
||||
email: result.email,
|
||||
add_time: result.add_time,
|
||||
|
@ -170,7 +170,7 @@ var baseController = function () {
|
||||
break;
|
||||
}
|
||||
|
||||
result = _yapi2.default.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time']);
|
||||
result = _yapi2.default.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time', 'role']);
|
||||
|
||||
result.server_ip = _yapi2.default.WEBCONFIG.server_ip;
|
||||
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(result));
|
||||
|
@ -146,6 +146,7 @@ var userController = function (_baseController) {
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn({
|
||||
username: result.username,
|
||||
role: result.role,
|
||||
uid: result._id,
|
||||
email: result.email,
|
||||
add_time: result.add_time,
|
||||
|
Loading…
Reference in New Issue
Block a user