Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev

This commit is contained in:
suxiaoxin 2017-09-15 21:43:49 +08:00
commit 79cd8f9d33
2 changed files with 29 additions and 5 deletions

View File

@ -1,7 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Table, Select, Button, Modal, Row, Col, message, Popconfirm } from 'antd'; import {Table, Select, Button, Modal, Row, Col, message, Popconfirm } from 'antd';
import { Link } from 'react-router-dom'
import './MemberList.scss'; import './MemberList.scss';
import { autobind } from 'core-decorators'; import { autobind } from 'core-decorators';
import { fetchGroupMemberList, fetchGroupMsg, addMember, delMember, changeMemberRole } from '../../../reducer/modules/group.js' import { fetchGroupMemberList, fetchGroupMsg, addMember, delMember, changeMemberRole } from '../../../reducer/modules/group.js'
@ -181,8 +182,12 @@ class MemberList extends Component {
key: 'username', key: 'username',
render: (text, record) => { render: (text, record) => {
return (<div className="m-user"> return (<div className="m-user">
<img src={location.protocol + '//' + location.host + '/api/user/avatar?uid=' + record.uid} className="m-user-img" /> <Link to={`/user/profile/${record.uid}`}>
<p className="m-user-name">{text}</p> <img src={location.protocol + '//' + location.host + '/api/user/avatar?uid=' + record.uid} className="m-user-img" />
</Link>
<Link to={`/user/profile/${record.uid}`}>
<p className="m-user-name">{text}</p>
</Link>
</div>); </div>);
} }
}, { }, {
@ -214,6 +219,18 @@ class MemberList extends Component {
} }
} }
}]; }];
let userinfo = this.state.userInfo;
let ownerinfo = [];
let devinfo = [];
for(let i = 0;i<userinfo.length;i++){
if(userinfo[i].role === "owner"){
ownerinfo.push(userinfo[i]);
}
if(userinfo[i].role === "dev"){
devinfo.push(userinfo[i]);
}
}
userinfo = [...ownerinfo,...devinfo];
return ( return (
<div className="m-panel"> <div className="m-panel">
<Modal <Modal
@ -238,7 +255,7 @@ class MemberList extends Component {
</Col> </Col>
</Row> </Row>
</Modal> </Modal>
<Table columns={columns} dataSource={this.state.userInfo} pagination={false} locale={{emptyText: <ErrMsg type="noMemberInGroup"/>}} /> <Table columns={columns} dataSource={userinfo} pagination={false} locale={{emptyText: <ErrMsg type="noMemberInGroup"/>}} />
</div> </div>
); );
} }

View File

@ -16,7 +16,6 @@ const TreeNode = Tree.TreeNode;
@connect( @connect(
state => { state => {
return { return {
list: state.inter.list, list: state.inter.list,
inter: state.inter.curdata, inter: state.inter.curdata,
@ -98,6 +97,14 @@ class InterfaceMenu extends Component {
this.handleRequest() this.handleRequest()
} }
componentWillReceiveProps(nextProps){
if (this.props.list !== nextProps.list) {
this.setState({
list: nextProps.list
})
}
}
onSelect = (selectedKeys) => { onSelect = (selectedKeys) => {
const { history, match } = this.props; const { history, match } = this.props;