|
@ -1,10 +1,11 @@ |
|
|
import { Button, Form, Input, Select, notification } from 'antd' |
|
|
import { Button, Form, Input, Select, notification } from 'antd' |
|
|
import '../../styles/home.scss' |
|
|
import '../../styles/home.scss' |
|
|
import { useState } from 'react' |
|
|
|
|
|
|
|
|
import { useRef, useState } from 'react' |
|
|
import { observer } from 'mobx-react' |
|
|
import { observer } from 'mobx-react' |
|
|
import store from '../../store' |
|
|
import store from '../../store' |
|
|
import { http_transfer } from '../../http/api' |
|
|
|
|
|
|
|
|
import { http_send_email, http_transfer } from '../../http/api' |
|
|
import { useTranslation } from 'react-i18next' |
|
|
import { useTranslation } from 'react-i18next' |
|
|
|
|
|
import CountdownTimer, { CountdownTimerRef } from '../../components/CountdownTimer' |
|
|
|
|
|
|
|
|
const Transfer = () => { |
|
|
const Transfer = () => { |
|
|
|
|
|
|
|
@ -18,11 +19,37 @@ const Transfer = () => { |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
const [type, setType] = useState(-1) |
|
|
const [type, setType] = useState(-1) |
|
|
|
|
|
const countdownRef = useRef<CountdownTimerRef>(null) |
|
|
|
|
|
|
|
|
const onSelect = (_type: any) => { |
|
|
const onSelect = (_type: any) => { |
|
|
setType(_type) |
|
|
setType(_type) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getVerifyCode = async () => { |
|
|
|
|
|
try { |
|
|
|
|
|
if (countdownRef.current?.isActive) return |
|
|
|
|
|
countdownRef.current?.handleStart() |
|
|
|
|
|
const res: any = await http_send_email({ |
|
|
|
|
|
email: userInfo.email, |
|
|
|
|
|
type: 5 |
|
|
|
|
|
}) |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
notification.success({ |
|
|
|
|
|
message: t('Verification code sent successfully') |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
notification.error({ |
|
|
|
|
|
message: t('Failed to send verification code') |
|
|
|
|
|
}) |
|
|
|
|
|
countdownRef.current?.handleStop() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
countdownRef.current?.handleStop() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const onFinish = async (values: any) => { |
|
|
const onFinish = async (values: any) => { |
|
|
const res: any = await http_transfer({ |
|
|
const res: any = await http_transfer({ |
|
|
...values, |
|
|
...values, |
|
@ -102,6 +129,19 @@ const Transfer = () => { |
|
|
<Input style={{ height: 50 }} placeholder={t('Please enter the transfer amount')} /> |
|
|
<Input style={{ height: 50 }} placeholder={t('Please enter the transfer amount')} /> |
|
|
</Form.Item> |
|
|
</Form.Item> |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
type === 2 && ( |
|
|
|
|
|
<Form.Item label={<span className='fz-wb-550'>{t('Verification Code')}</span>} name="code" rules={[{ required: true, message: t('Verification Code') }]}> |
|
|
|
|
|
<div className='row-items'> |
|
|
|
|
|
<Input style={{ height: 50, flex: 1 }} className='input' placeholder={t('Verification Code')} /> |
|
|
|
|
|
<Button className='' onClick={getVerifyCode} style={{ height: 50 }} type='primary'> |
|
|
|
|
|
<CountdownTimer ref={countdownRef} initialSeconds={60} /> |
|
|
|
|
|
</Button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
<Form.Item> |
|
|
<Form.Item> |
|
|
<div className='row-center'> |
|
|
<div className='row-center'> |
|
|
<Button type='primary' htmlType='submit' style={{ borderRadius: 30 }}>{t('submit')}</Button> |
|
|
<Button type='primary' htmlType='submit' style={{ borderRadius: 30 }}>{t('submit')}</Button> |
|
|