mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-09 05:00:30 +08:00
fix: 修复user 为admin时 添加分组的显示问题
This commit is contained in:
parent
4650253d7b
commit
41d326af9c
@ -12,12 +12,13 @@ const TabPane = Tabs.TabPane;
|
||||
import { fetchNewsData } from '../../reducer/modules/news.js';
|
||||
import './Group.scss';
|
||||
@connect(
|
||||
|
||||
state => {
|
||||
return {
|
||||
curGroupId: state.group.currGroup._id,
|
||||
curUserRole: state.group.currGroup.role,
|
||||
curUserRole: state.group.role,
|
||||
curUserRoleInGroup: state.group.currGroup.role,
|
||||
currGroup: state.group.currGroup
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -32,7 +33,8 @@ export default class Group extends Component {
|
||||
fetchNewsData: PropTypes.func,
|
||||
curGroupId: PropTypes.number,
|
||||
curUserRole: PropTypes.string,
|
||||
currGroup: PropTypes.object
|
||||
currGroup: PropTypes.object,
|
||||
curUserRoleInGroup: PropTypes.string
|
||||
}
|
||||
onTabClick(key){
|
||||
if(key == 3){
|
||||
@ -51,7 +53,7 @@ export default class Group extends Component {
|
||||
<Tabs onTabClick={this.onTabClick.bind(this)} type="card" className="m-tab" style={{height: '100%'}}>
|
||||
<TabPane tab="项目列表" key="1"><ProjectList/></TabPane>
|
||||
{this.props.currGroup.type === 'public'?<TabPane tab="成员列表" key="2"><MemberList/></TabPane>:null}
|
||||
{["admin","owner","guest","dev"].indexOf(this.props.curUserRole)>-1?<TabPane tab="分组动态" key="3"><GroupLog/></TabPane>:""}
|
||||
{["admin","owner","guest","dev"].indexOf(this.props.curUserRoleInGroup)>-1 || this.props.curUserRole === "admin"?<TabPane tab="分组动态" key="3"><GroupLog/></TabPane>:""}
|
||||
</Tabs>
|
||||
</Content>
|
||||
</Layout>
|
||||
|
@ -15,7 +15,8 @@ import { fetchNewsData } from '../../../reducer/modules/news.js';
|
||||
import {
|
||||
fetchGroupList,
|
||||
setCurrGroup,
|
||||
setGroupList
|
||||
setGroupList,
|
||||
fetchGroupMsg
|
||||
} from '../../../reducer/modules/group.js'
|
||||
|
||||
import './GroupList.scss';
|
||||
@ -37,7 +38,8 @@ const tip = (<div className="title-container">
|
||||
fetchGroupList,
|
||||
setCurrGroup,
|
||||
setGroupList,
|
||||
fetchNewsData
|
||||
fetchNewsData,
|
||||
fetchGroupMsg
|
||||
}
|
||||
)
|
||||
@withRouter
|
||||
@ -54,7 +56,8 @@ export default class GroupList extends Component {
|
||||
curUserRole: PropTypes.string,
|
||||
studyTip: PropTypes.number,
|
||||
study: PropTypes.bool,
|
||||
fetchNewsData: PropTypes.func
|
||||
fetchNewsData: PropTypes.func,
|
||||
fetchGroupMsg: PropTypes.func
|
||||
}
|
||||
|
||||
state = {
|
||||
@ -134,7 +137,8 @@ export default class GroupList extends Component {
|
||||
});
|
||||
await this.props.fetchGroupList();
|
||||
this.setState({ groupList: this.props.groupList });
|
||||
this.props.setCurrGroup(res.data.data)
|
||||
this.props.setCurrGroup(res.data.data);
|
||||
this.props.fetchGroupMsg(this.props.currGroup._id);
|
||||
this.props.fetchNewsData(this.props.currGroup._id, "group", 1, 10)
|
||||
} else {
|
||||
message.error(res.data.errmsg)
|
||||
@ -153,7 +157,7 @@ export default class GroupList extends Component {
|
||||
});
|
||||
await this.props.fetchGroupList();
|
||||
this.setState({ groupList: this.props.groupList });
|
||||
this.props.setCurrGroup({ group_name, group_desc, _id: id });
|
||||
this.props.setCurrGroup({ group_name, group_desc, _id: id});
|
||||
this.props.fetchNewsData(this.props.currGroup._id, "group", 1, 10)
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class groupController extends baseController {
|
||||
try {
|
||||
let result = await groupInst.save(data);
|
||||
|
||||
result = yapi.commons.fieldSelect(result, ['_id', 'group_name', 'group_desc', 'uid', 'members']);
|
||||
result = yapi.commons.fieldSelect(result, ['_id', 'group_name', 'group_desc', 'uid', 'members','type']);
|
||||
let username = this.getUsername();
|
||||
yapi.commons.saveLog({
|
||||
content: `用户 "${username}" 新增了分组 "${params.group_name}"`,
|
||||
|
Loading…
Reference in New Issue
Block a user