Commit 3f2fbd4f authored by Bill's avatar Bill

fix: 修改修改密码bug

parent 583ed58f
...@@ -29,6 +29,6 @@ ...@@ -29,6 +29,6 @@
} }
} }
.captchaBtn { // .captchaBtn {
width: 102px; // width: 102px;
} // }
\ No newline at end of file
...@@ -82,7 +82,7 @@ const EditDataComponent = (props) => { ...@@ -82,7 +82,7 @@ const EditDataComponent = (props) => {
const postData = ( const postData = (
props.type == 'phone' props.type == 'phone'
? { ? {
countryCode: form.getFieldValue('country'), countryCode: `+${form.getFieldValue('country')}`,
phone: form.getFieldValue('newPhone') phone: form.getFieldValue('newPhone')
} }
: { email: form.getFieldValue('email') } : { email: form.getFieldValue('email') }
...@@ -206,7 +206,7 @@ const EditDataComponent = (props) => { ...@@ -206,7 +206,7 @@ const EditDataComponent = (props) => {
: <> : <>
<Form.Item label="新的手机号码"> <Form.Item label="新的手机号码">
<Row gutter={10}> <Row gutter={10}>
<Col span={4}> <Col span={6}>
<Form.Item <Form.Item
name="country" name="country"
noStyle noStyle
......
.btn {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
height: 32px;
border: 1px solid #d9d9d9;
width: 100%;
margin-right: 0px;
cursor: pointer;
}
.disabled {
background-color: #f5f5f5;
}
import React, { useState, useEffect, useRef, useCallback } from 'react'; import React, { useState, useEffect, useRef, useCallback } from 'react';
import { Button } from 'antd'; import { Button } from 'antd';
import styles from './index.less';
import cx from 'classnames';
const GetCaptchaCode = (props) => { const GetCaptchaCode = (props) => {
const { disable = false } = props; const { disable = false } = props;
...@@ -28,23 +30,28 @@ const GetCaptchaCode = (props) => { ...@@ -28,23 +30,28 @@ const GetCaptchaCode = (props) => {
} }
}, [time]) }, [time])
const isDisabled = disable || time > 0
const handleClick = useCallback(() => { const handleClick = useCallback(() => {
if (isDisabled) {
return;
}
const hasFn = !!props.getCode; const hasFn = !!props.getCode;
if(hasFn) { if(hasFn) {
props.getCode() props.getCode()
setTime(59) setTime(59)
} }
}, []) }, [isDisabled])
return ( return (
<Button disabled={disable || !!time} onClick={handleClick} style={{width: '100%'}}> <div onClick={handleClick} className={cx(styles.btn, {[styles.disabled]: isDisabled})} style={{width: '100%'}}>
{ {
time time
? `${time} s` ? `${time} s`
: '获取验证码' : '获取验证码'
} }
</Button> </div>
) )
} }
export default GetCaptchaCode export default GetCaptchaCode
\ No newline at end of file
...@@ -113,9 +113,7 @@ const EmailVerifyPanel = (props) => { ...@@ -113,9 +113,7 @@ const EmailVerifyPanel = (props) => {
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={6}> <Col span={6}>
<div style={{width: '102px'}}> <GetCaptchaCode getCode={getCode} />
<GetCaptchaCode getCode={getCode} />
</div>
</Col> </Col>
</Row> </Row>
</Form.Item> </Form.Item>
......
...@@ -115,9 +115,7 @@ const PhoneVerifyPanel: React.FC<IProps> = (props) => { ...@@ -115,9 +115,7 @@ const PhoneVerifyPanel: React.FC<IProps> = (props) => {
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={6}> <Col span={6}>
<div style={{width: '102px'}}> <GetCaptchaCode getCode={getCode} />
<GetCaptchaCode getCode={getCode} />
</div>
</Col> </Col>
</Row> </Row>
</Form.Item> </Form.Item>
...@@ -128,7 +126,7 @@ const PhoneVerifyPanel: React.FC<IProps> = (props) => { ...@@ -128,7 +126,7 @@ const PhoneVerifyPanel: React.FC<IProps> = (props) => {
: null : null
} }
{ {
visible !visible
? <> ? <>
<EditDataComponent type={pageType} form={form} /> <EditDataComponent type={pageType} form={form} />
<Form.Item {...tailLayout}> <Form.Item {...tailLayout}>
......
...@@ -28,7 +28,7 @@ const AccountSetting = () => { ...@@ -28,7 +28,7 @@ const AccountSetting = () => {
return ( return (
<Col xxl={12} xl={12} lg={24} md={24} sm={24} xs={24} key={item}> <Col xxl={12} xl={12} lg={24} md={24} sm={24} xs={24} key={item}>
<TypeVerify <TypeVerify
type={item} type={item as 'phone'}
phone={account.phone} phone={account.phone}
email={account.email} email={account.email}
paycode={account.hasPayPassword} paycode={account.hasPayPassword}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment