|
@@ -20,7 +20,7 @@ import {
|
|
useChangePassword,
|
|
useChangePassword,
|
|
} from '../../hooks/user';
|
|
} from '../../hooks/user';
|
|
const { Panel } = Collapse;
|
|
const { Panel } = Collapse;
|
|
-const { Search } = Input;
|
|
|
|
|
|
+import SendCode from '../../compontens/button/sendcode';
|
|
|
|
|
|
const layout = {
|
|
const layout = {
|
|
labelCol: { span: 3, xl: 4 },
|
|
labelCol: { span: 3, xl: 4 },
|
|
@@ -32,10 +32,7 @@ const setUp: React.FC = (props) => {
|
|
state: changeEmailState,
|
|
state: changeEmailState,
|
|
request: requestChangeEmail,
|
|
request: requestChangeEmail,
|
|
} = useChangeEmail();
|
|
} = useChangeEmail();
|
|
- const {
|
|
|
|
- state: changePassWordState,
|
|
|
|
- request: requtesChangePassWord,
|
|
|
|
- } = useChangePassword();
|
|
|
|
|
|
+ const { request: requtesChangePassWord } = useChangePassword();
|
|
const {
|
|
const {
|
|
state: sendCodeState,
|
|
state: sendCodeState,
|
|
request: requestPhoneCode,
|
|
request: requestPhoneCode,
|
|
@@ -77,15 +74,22 @@ const setUp: React.FC = (props) => {
|
|
/**
|
|
/**
|
|
* @description 发送验证码
|
|
* @description 发送验证码
|
|
*/
|
|
*/
|
|
- const handleSendCode = (phone: string) => {
|
|
|
|
- requestPhoneCode({ phone })
|
|
|
|
- .then(() => {})
|
|
|
|
- .catch((error) => {
|
|
|
|
- notification.error({
|
|
|
|
- message: '验证码发送错误',
|
|
|
|
- description: error.message,
|
|
|
|
- });
|
|
|
|
|
|
+ const handleSendCode = () => {
|
|
|
|
+ return new Promise<void>((resolve, reject) => {
|
|
|
|
+ phoneForm.validateFields(['phone']).then((data) => {
|
|
|
|
+ requestPhoneCode({ phone: data.phone })
|
|
|
|
+ .then(() => {
|
|
|
|
+ resolve();
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ reject(error.message);
|
|
|
|
+ notification.error({
|
|
|
|
+ message: '验证码发送错误',
|
|
|
|
+ description: error.message,
|
|
|
|
+ });
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
+ });
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* @description 修改手机号码
|
|
* @description 修改手机号码
|
|
@@ -196,15 +200,14 @@ const setUp: React.FC = (props) => {
|
|
},
|
|
},
|
|
]}
|
|
]}
|
|
children={
|
|
children={
|
|
- <Search
|
|
|
|
- loading={sendCodeState.loading}
|
|
|
|
- placeholder='验证码'
|
|
|
|
- enterButton='获取验证码'
|
|
|
|
- onSearch={() => {
|
|
|
|
- phoneForm.validateFields(['phone']).then((data) => {
|
|
|
|
- handleSendCode(data.phone);
|
|
|
|
- });
|
|
|
|
- }}></Search>
|
|
|
|
|
|
+ <Row gutter={0} justify='space-between'>
|
|
|
|
+ <Col span={16}>
|
|
|
|
+ <Input placeholder='请输入验证码'></Input>
|
|
|
|
+ </Col>
|
|
|
|
+ <Col span={8}>
|
|
|
|
+ <SendCode handleSend={handleSendCode}></SendCode>
|
|
|
|
+ </Col>
|
|
|
|
+ </Row>
|
|
}></Form.Item>
|
|
}></Form.Item>
|
|
<Row align='middle'>
|
|
<Row align='middle'>
|
|
<Col offset={3}>
|
|
<Col offset={3}>
|