|
@@ -2,6 +2,9 @@ import React, { Component } from 'react';
|
|
|
import { connect } from 'umi';
|
|
|
import { Checkbox, Form, Select, Input, Button } from 'antd';
|
|
|
import { queryDepList } from '@/Project/services/user';
|
|
|
+import styles from './index.less';
|
|
|
+import { UserOutlined, LockOutlined } from '@ant-design/icons';
|
|
|
+
|
|
|
const { Option } = Select;
|
|
|
|
|
|
class LoginPage extends Component {
|
|
@@ -15,8 +18,7 @@ class LoginPage extends Component {
|
|
|
super(props);
|
|
|
this.formRef = React.createRef();
|
|
|
}
|
|
|
- componentDidMount = () => {
|
|
|
- };
|
|
|
+ componentDidMount = () => {};
|
|
|
onHandleChange = async (name) => {
|
|
|
var res = await queryDepList(name);
|
|
|
this.setState({
|
|
@@ -40,61 +42,74 @@ class LoginPage extends Component {
|
|
|
type,
|
|
|
},
|
|
|
callback: () => {
|
|
|
- this.props.params.gotoA()
|
|
|
- }
|
|
|
+ this.props.params.gotoA();
|
|
|
+ },
|
|
|
});
|
|
|
};
|
|
|
|
|
|
render() {
|
|
|
const { depList, hasName } = this.state;
|
|
|
- const { submitting, form } = this.props;
|
|
|
+ const { submitting } = this.props;
|
|
|
return (
|
|
|
- <div style={{ margin: '200px auto', width: '40%' }}>
|
|
|
- <Form
|
|
|
- name="basic"
|
|
|
- labelCol={{ span: 8 }}
|
|
|
- wrapperCol={{ span: 16 }}
|
|
|
- onFinish={this.handleSubmit}
|
|
|
- autoComplete="new-password"
|
|
|
- ref={this.formRef}
|
|
|
- >
|
|
|
- <Form.Item
|
|
|
- label="用户名"
|
|
|
- name="username"
|
|
|
- autoComplete="off"
|
|
|
- rules={[{ required: true, message: '请输入用户名' }]}
|
|
|
+ <div className={styles.main}>
|
|
|
+ <div className={styles.content}>
|
|
|
+ <Form
|
|
|
+ name="basic"
|
|
|
+ className={styles.inp_box}
|
|
|
+ labelCol={{ span: 0 }}
|
|
|
+ wrapperCol={{ span: 24 }}
|
|
|
+ onFinish={this.handleSubmit}
|
|
|
+ autoComplete="new-password"
|
|
|
+ ref={this.formRef}
|
|
|
>
|
|
|
- <Input
|
|
|
- autoComplete="new-password"
|
|
|
- onBlur={(e) => this.onHandleChange(e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- {hasName && (
|
|
|
<Form.Item
|
|
|
- label="部门"
|
|
|
- name="DepId"
|
|
|
+ label=""
|
|
|
+ name="username"
|
|
|
+ autoComplete="off"
|
|
|
rules={[{ required: true, message: '请输入用户名' }]}
|
|
|
>
|
|
|
- <Select placeholder="请选择部门">
|
|
|
- {depList.map((item) => (
|
|
|
- <Option value={item.ID + ''} key={item.ID}>
|
|
|
- {item.Name}
|
|
|
- </Option>
|
|
|
- ))}
|
|
|
- </Select>
|
|
|
+ <Input
|
|
|
+ prefix={<UserOutlined className={styles.prefixIcon} />}
|
|
|
+ className={styles.inp}
|
|
|
+ size="large"
|
|
|
+ autoComplete="off"
|
|
|
+ placeholder="请输入用户名"
|
|
|
+ onBlur={(e) => this.onHandleChange(e.target.value)}
|
|
|
+ />
|
|
|
</Form.Item>
|
|
|
- )}
|
|
|
+ {hasName && (
|
|
|
+ <Form.Item
|
|
|
+ label=""
|
|
|
+ name="DepId"
|
|
|
+ rules={[{ required: true, message: '请输入用户名' }]}
|
|
|
+ >
|
|
|
+ <Select placeholder="请选择部门" size="large">
|
|
|
+ {depList.map((item) => (
|
|
|
+ <Option value={item.ID + ''} key={item.ID}>
|
|
|
+ {item.Name}
|
|
|
+ </Option>
|
|
|
+ ))}
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+ )}
|
|
|
|
|
|
- <Form.Item
|
|
|
- label="密码"
|
|
|
- // 不使用password,防止浏览器自动填充表单
|
|
|
- name="password2"
|
|
|
- rules={[{ required: true, message: '请输入密码' }]}
|
|
|
- >
|
|
|
- <Input.Password autoComplete="new-password" />
|
|
|
- </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label=""
|
|
|
+ // 不使用password,防止浏览器自动填充表单
|
|
|
+ name="password2"
|
|
|
+ className={styles.inp}
|
|
|
+ rules={[{ required: true, message: '请输入密码' }]}
|
|
|
+ >
|
|
|
+ <Input.Password
|
|
|
+ prefix={<LockOutlined className={styles.prefixIcon} />}
|
|
|
+ className={styles.inp}
|
|
|
+ size="large"
|
|
|
+ placeholder="请输入密码"
|
|
|
+ autoComplete="new-password"
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
|
|
|
- {/* <Form.Item
|
|
|
+ {/* <Form.Item
|
|
|
name="remember"
|
|
|
valuePropName="checked"
|
|
|
wrapperCol={{ offset: 8, span: 16 }}
|
|
@@ -102,12 +117,19 @@ class LoginPage extends Component {
|
|
|
<Checkbox>自动登录</Checkbox>
|
|
|
</Form.Item> */}
|
|
|
|
|
|
- <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
|
|
|
- <Button loading={submitting} type="primary" htmlType="submit">
|
|
|
- 登录
|
|
|
- </Button>
|
|
|
- </Form.Item>
|
|
|
- </Form>
|
|
|
+ <Form.Item>
|
|
|
+ <Button
|
|
|
+ size="large"
|
|
|
+ style={{ width: '100%', marginTop: 24 }}
|
|
|
+ loading={submitting}
|
|
|
+ type="primary"
|
|
|
+ htmlType="submit"
|
|
|
+ >
|
|
|
+ 登录
|
|
|
+ </Button>
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
}
|