Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-platform
Commits
7ce0b7cc
Commit
7ce0b7cc
authored
Oct 13, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:新增短信验证码接口
parent
e5a4b529
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
4 deletions
+33
-4
Phone.tsx
src/components/NiceForm/components/Phone.tsx
+19
-3
register.tsx
src/pages/user/register.tsx
+14
-1
No files found.
src/components/NiceForm/components/Phone.tsx
View file @
7ce0b7cc
import
React
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
Row
,
Input
,
Col
,
Button
}
from
'antd'
;
import
{
Row
,
Input
,
Col
,
Button
}
from
'antd'
;
import
useCountDown
from
'@/utils/hooks'
;
import
useCountDown
from
'@/utils/hooks'
;
import
{
PublicApi
}
from
'@/services/api'
;
const
Phone
=
(
props
)
=>
{
const
Phone
=
(
props
)
=>
{
const
{
text
,
isActive
,
start
}
=
useCountDown
({
const
{
text
,
isActive
,
start
}
=
useCountDown
({
...
@@ -12,7 +13,22 @@ const Phone = (props) => {
...
@@ -12,7 +13,22 @@ const Phone = (props) => {
delay
:
1
*
1000
delay
:
1
*
1000
})
})
const
{
value
}
=
props
const
{
value
,
form
}
=
props
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
handleClickSms
=
()
=>
{
form
.
validate
(
'phone'
).
then
(
result
=>
{
// 暂时写死, 需优化该组件
setLoading
(
true
)
PublicApi
.
postMemberRegisterSms
({
countryCode
:
'+86'
,
phone
:
form
.
getFieldValue
(
'phone'
)
}).
finally
(()
=>
{
start
()
setLoading
(
false
)
})
})
}
return
(
return
(
<
Row
style=
{
{
width
:
'100%'
}
}
>
<
Row
style=
{
{
width
:
'100%'
}
}
>
<
Col
flex=
{
1
}
>
<
Col
flex=
{
1
}
>
...
@@ -23,7 +39,7 @@ const Phone = (props) => {
...
@@ -23,7 +39,7 @@ const Phone = (props) => {
/>
/>
</
Col
>
</
Col
>
<
Col
style=
{
{
marginLeft
:
8
}
}
>
<
Col
style=
{
{
marginLeft
:
8
}
}
>
<
Button
disabled=
{
isActive
}
style=
{
{
minWidth
:
110
,
marginLeft
:
8
}
}
size=
'large'
onClick=
{
start
}
>
{
text
}
</
Button
>
<
Button
disabled=
{
isActive
}
style=
{
{
minWidth
:
110
,
marginLeft
:
8
}
}
loading=
{
loading
}
size=
'large'
onClick=
{
handleClickSms
}
>
{
text
}
</
Button
>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
)
)
...
...
src/pages/user/register.tsx
View file @
7ce0b7cc
...
@@ -178,6 +178,18 @@ const UserRegistry = () => {
...
@@ -178,6 +178,18 @@ const UserRegistry = () => {
delay
:
1
*
1000
delay
:
1
*
1000
})
})
const
handleSendSMS
=
()
=>
{
actions
.
validate
(
'phone'
).
then
(
result
=>
{
console
.
log
(
result
)
})
// actions.getFieldState('phone', state => {
// console.
// if (state.valid) {
// start()
// }
// })
}
const
handleActionBtn
=
()
=>
{
const
handleActionBtn
=
()
=>
{
// 校验后触发跳转
// 校验后触发跳转
actions
.
submit
(
data
=>
{
actions
.
submit
(
data
=>
{
...
@@ -260,7 +272,7 @@ const UserRegistry = () => {
...
@@ -260,7 +272,7 @@ const UserRegistry = () => {
expressionScope=
{
{
expressionScope=
{
{
current
:
false
,
current
:
false
,
phoneBefore
:
<
div
className=
{
'formBefore'
}
>
+86
</
div
>,
phoneBefore
:
<
div
className=
{
'formBefore'
}
>
+86
</
div
>,
smsCodeAfter
:
<
Button
disabled=
{
isActive
}
style=
{
{
minWidth
:
110
,
marginLeft
:
8
}
}
size=
'large'
onClick=
{
start
}
>
{
text
}
</
Button
>,
smsCodeAfter
:
<
Button
disabled=
{
isActive
}
style=
{
{
minWidth
:
110
,
marginLeft
:
8
}
}
size=
'large'
onClick=
{
handleSendSMS
}
>
{
text
}
</
Button
>,
checkBoxChildren
:
<
span
style=
{
{
fontSize
:
12
}
}
>
阅读并同意
<
span
className=
'commonPickColor'
>
checkBoxChildren
:
<
span
style=
{
{
fontSize
:
12
}
}
>
阅读并同意
<
span
className=
'commonPickColor'
>
{
{
agreementList
&&
agreementList
.
map
(
item
=>
(<
a
key=
{
`aggreem_${item.id}`
}
href=
{
`/user/agreement?id=${item.id}`
}
target=
"_blank"
>
《
{
item
.
title
}
》
</
a
>))
agreementList
&&
agreementList
.
map
(
item
=>
(<
a
key=
{
`aggreem_${item.id}`
}
href=
{
`/user/agreement?id=${item.id}`
}
target=
"_blank"
>
《
{
item
.
title
}
》
</
a
>))
...
@@ -269,6 +281,7 @@ const UserRegistry = () => {
...
@@ -269,6 +281,7 @@ const UserRegistry = () => {
</
span
>,
</
span
>,
memberTypeTitle
:
<
span
className=
{
'commonPanelTitle'
}
>
请选择您的身份
</
span
>,
memberTypeTitle
:
<
span
className=
{
'commonPanelTitle'
}
>
请选择您的身份
</
span
>,
businessTypeTitle
:
<
span
className=
{
'commonPanelTitle'
}
>
请选择您要开展的业务
</
span
>,
businessTypeTitle
:
<
span
className=
{
'commonPanelTitle'
}
>
请选择您要开展的业务
</
span
>,
memberChooseList
:
[]
}
}
}
}
/>
/>
<
div
className=
{
cx
(
'registerForm'
,
'global-block-center'
)
}
>
<
div
className=
{
cx
(
'registerForm'
,
'global-block-center'
)
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment