temp
This commit is contained in:
@@ -7,7 +7,7 @@ import App from './App';
|
||||
export default () => (
|
||||
<Router>
|
||||
<Switch>
|
||||
<Route exact path="/" render={() => <Redirect to="/app/dashboard/index" push />} />
|
||||
<Route exact path="/" render={() => <Redirect to="/app/home" push />} />
|
||||
<Route path="/app" component={App} />
|
||||
<Route path="/404" component={NotFound} />
|
||||
<Route path="/login" component={Login} />
|
||||
|
||||
@@ -9,10 +9,15 @@ type AddUserState = {
|
||||
isShow: boolean;
|
||||
};
|
||||
|
||||
class AddUser extends React.Component<{}, AddUserState> {
|
||||
type AddUserProps = {
|
||||
onSuccess: () => void;
|
||||
showAddUser?: () => void;
|
||||
};
|
||||
|
||||
class AddUser extends React.Component<AddUserProps, AddUserState> {
|
||||
private formRef = React.createRef<FormInstance>();
|
||||
|
||||
constructor(props: {}) {
|
||||
constructor(props: AddUserProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isShow: false,
|
||||
@@ -20,13 +25,19 @@ class AddUser extends React.Component<{}, AddUserState> {
|
||||
}
|
||||
|
||||
handleOk = () => {
|
||||
console.log(this.formRef.current?.submit());
|
||||
this.formRef.current?.submit();
|
||||
this.props.onSuccess();
|
||||
};
|
||||
|
||||
switchShow = () => {
|
||||
this.setState((state) => ({
|
||||
this.setState(
|
||||
(state) => ({
|
||||
isShow: !state.isShow,
|
||||
}));
|
||||
}),
|
||||
() => {
|
||||
this.props.showAddUser && this.props.showAddUser();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
handleFinish = (values: any) => {
|
||||
|
||||
@@ -23,36 +23,6 @@ class UserManage extends React.Component {
|
||||
onInputChange = (e: any) => {
|
||||
this.setState({ searchText: e.target.value });
|
||||
};
|
||||
onSearch = () => {
|
||||
// const { searchText } = this.state;
|
||||
// const reg = new RegExp(searchText, 'gi');
|
||||
// this.setState({
|
||||
// filterDropdownVisible: false,
|
||||
// filtered: !!searchText,
|
||||
// data: data
|
||||
// .map((record) => {
|
||||
// const match = record.name.match(reg);
|
||||
// if (!match) {
|
||||
// return null;
|
||||
// }
|
||||
// return {
|
||||
// ...record,
|
||||
// name: (
|
||||
// <span>
|
||||
// {record.name
|
||||
// .split(reg)
|
||||
// .map((text, i) =>
|
||||
// i > 0
|
||||
// ? [<span className="highlight">{match[0]}</span>, text]
|
||||
// : text
|
||||
// )}
|
||||
// </span>
|
||||
// ),
|
||||
// };
|
||||
// })
|
||||
// .filter((record) => !!record),
|
||||
// });
|
||||
};
|
||||
refreshUser = () => {
|
||||
trailwayListUsers().then((res) => {
|
||||
this.setState({
|
||||
@@ -60,6 +30,9 @@ class UserManage extends React.Component {
|
||||
});
|
||||
});
|
||||
};
|
||||
handleSwitchShow = () => {
|
||||
console.log('handleSwitchShow');
|
||||
};
|
||||
handleDel = (id: Number) => {
|
||||
trailwayDelUser(id);
|
||||
this.refreshUser();
|
||||
@@ -103,8 +76,10 @@ class UserManage extends React.Component {
|
||||
];
|
||||
return (
|
||||
<div>
|
||||
<Button type="primary">增加用户</Button>
|
||||
<AddUser></AddUser>
|
||||
<Button onClick={this.refreshUser} type="primary">
|
||||
增加用户
|
||||
</Button>
|
||||
<AddUser onSuccess={this.refreshUser}></AddUser>
|
||||
<Table columns={columns} dataSource={this.state.data} />
|
||||
<style>{`
|
||||
.custom-filter-dropdown {
|
||||
|
||||
@@ -13,7 +13,7 @@ const BreadcrumbCustom = (props: BreadcrumbCustomProps) => {
|
||||
return (
|
||||
<Breadcrumb style={{ margin: '12px 0' }}>
|
||||
<Breadcrumb.Item>
|
||||
<Link to={'/app/dashboard/index'}>首页</Link>
|
||||
<Link to={'/app/home'}>首页</Link>
|
||||
</Breadcrumb.Item>
|
||||
{breads?.map((bread, i) => (
|
||||
<Breadcrumb.Item key={i}>{bread}</Breadcrumb.Item>
|
||||
|
||||
Reference in New Issue
Block a user