|
@@ -18,13 +18,18 @@ function passwodForm(props) {
|
18
|
18
|
function handleSubmit(e) {
|
19
|
19
|
e.preventDefault();
|
20
|
20
|
props.form.validateFieldsAndScroll((err, values) => {
|
|
21
|
+ // 两次密码比较
|
|
22
|
+ if (values.newPassword !== values.newPasswordToo) {
|
|
23
|
+ openNotificationWithIcon('error', '两次密码输入不一样,请重新输入')
|
|
24
|
+ return
|
|
25
|
+ }
|
21
|
26
|
if (!err) {
|
22
|
27
|
request({ ...apis.user.updatePassword, params: { ...values } }).then(() => {
|
23
|
28
|
openNotificationWithIcon('success', '操作成功!')
|
24
|
29
|
props.form.resetFields()
|
25
|
30
|
props.onSuccess()
|
26
|
31
|
}).catch(error => {
|
27
|
|
- openNotificationWithIcon('error', error)
|
|
32
|
+ // openNotificationWithIcon('error', error.message)
|
28
|
33
|
})
|
29
|
34
|
}
|
30
|
35
|
});
|
|
@@ -33,10 +38,32 @@ function passwodForm(props) {
|
33
|
38
|
const { getFieldDecorator } = props.form
|
34
|
39
|
return (
|
35
|
40
|
<>
|
36
|
|
- <Form layout="horizontal" onSubmit={(e) => handleSubmit(e)}>
|
37
|
|
- <Form.Item>
|
|
41
|
+ <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={(e) => handleSubmit(e)}>
|
|
42
|
+ <Form.Item label="请输入旧密码">
|
|
43
|
+ {getFieldDecorator('originalPassword', {
|
|
44
|
+ rules: [{ required: true, message: '请输入旧密码' }],
|
|
45
|
+ })(
|
|
46
|
+ <Input
|
|
47
|
+ prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
48
|
+ type="password"
|
|
49
|
+ placeholder="Password"
|
|
50
|
+ />,
|
|
51
|
+ )}
|
|
52
|
+ </Form.Item>
|
|
53
|
+ <Form.Item label="新密码">
|
38
|
54
|
{getFieldDecorator('newPassword', {
|
39
|
|
- rules: [{ required: true, message: 'Please input your Password!' }],
|
|
55
|
+ rules: [{ required: true, message: '请输入新密码' }],
|
|
56
|
+ })(
|
|
57
|
+ <Input
|
|
58
|
+ prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
59
|
+ type="password"
|
|
60
|
+ placeholder="Password"
|
|
61
|
+ />,
|
|
62
|
+ )}
|
|
63
|
+ </Form.Item>
|
|
64
|
+ <Form.Item label="确认密码">
|
|
65
|
+ {getFieldDecorator('newPasswordToo', {
|
|
66
|
+ rules: [{ required: true, message: '请确认新密码' }],
|
40
|
67
|
})(
|
41
|
68
|
<Input
|
42
|
69
|
prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />}
|