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