Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
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
baiguangyao
mr-julyedu
Commits
ebb78528
Commit
ebb78528
authored
Sep 17, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绑定手机号
parent
5d467882
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
20 deletions
+16
-20
src/components/passport/bindingTel/binding-tel.scss
+0
-4
src/components/passport/bindingTel/index.js
+16
-16
No files found.
src/components/passport/bindingTel/binding-tel.scss
View file @
ebb78528
...
...
@@ -7,10 +7,6 @@
color
:
$color_666
;
}
.tel
{
margin-bottom
:
21px
;
}
.verification
{
margin-bottom
:
21px
;
}
...
...
src/components/passport/bindingTel/index.js
View file @
ebb78528
import
React
,
{
Component
}
from
'react'
;
import
'./binding-tel.scss'
import
{
withFormik
,
Field
,
Form
}
from
"formik"
;
import
{
validateTel
,
http
,
api
,
getParam
}
from
"@/utils"
;
import
{
http
,
getParam
}
from
"@/utils"
;
import
{
compose
}
from
"redux"
;
import
{
connect
}
from
"react-redux"
;
import
{
setCurrentUser
}
from
"@/store/userAction"
;
import
Captcha
from
'@/common/Captcha'
import
{
HeaderBar
}
from
'@/common'
import
{
HeaderBar
}
from
'@/common'
import
ClearableInput
from
'@common/ClearableInput'
// import ClearableInput from '@common/ClearableInput'
import
ClearableInput
from
'../common/clearableInputWithCountryCodes'
import
Button
from
'../common/Button'
import
VeriCodeInput
from
'../common/veriCodeInput'
import
{
Toast
}
from
"antd-mobile"
;
...
...
@@ -42,7 +43,8 @@ class BindingTel extends Component {
render
()
{
const
{
values
,
errors
errors
,
country
}
=
this
.
props
return
(
<>
...
...
@@ -59,9 +61,7 @@ class BindingTel extends Component {
setFieldValue
=
{
form
.
setFieldValue
}
placeholder
=
{
'请输入需要绑定的手机号'
}
wrapperClass
=
{
'tel'
}
icon
=
{
<
i
className
=
{
'iconfont iconshouji'
}
style
=
{{
fontSize
:
'22px'
,
left
:
'11px'
}}
/>
}
country
=
{
country
}
/
>
)
...
...
@@ -77,18 +77,21 @@ class BindingTel extends Component {
icon
=
{
<
i
className
=
{
'iconfont iconduanxin'
}
style
=
{{
fontSize
:
'20px'
,
left
:
'12px'
}}
/>
}
placeholder
=
{
'验证码'
}
account
=
{
values
.
tel
}
tel
=
{
values
.
tel
}
challenge
=
{
this
.
state
.
validate
}
instance
=
{
this
.
state
.
captchaInstance
}
action
=
{
'auth'
}
country
=
{
country
}
/
>
)
}}
/
>
<
Captcha
onVerify
=
{
this
.
onVerify
}
getInstance
=
{
this
.
getCaptchaInstance
}
/
>
<
Button
className
=
{
'complete-btn'
}
active
=
{
values
.
tel
&&
values
.
veriCode
&&
isEmpty
(
errors
)}
>
完成
<
/Button
>
<
Button
className
=
{
'complete-btn'
}
active
=
{
values
.
tel
&&
values
.
veriCode
&&
isEmpty
(
errors
)}
>
完成
<
/Button
>
<
/Form
>
<
/div
>
<
/
>
...
...
@@ -107,7 +110,7 @@ const formikConfig = {
validateOnChange
:
true
,
validate
(
values
)
{
let
errors
=
{}
if
(
!
validateTel
(
values
.
tel
))
{
if
(
!
/
\d
/
.
test
(
values
.
tel
))
{
errors
.
tel
=
'请输入正确的手机号'
}
if
(
!
values
.
veriCode
)
{
...
...
@@ -116,10 +119,12 @@ const formikConfig = {
return
errors
},
handleSubmit
(
values
,
{
props
})
{
alert
(
props
.
country
.
num
)
http
.
post
(
`
${
API
[
'passport-api'
]}
/bind_mobile`
,
{
phone_num
:
values
.
tel
,
phone_code
:
values
.
veriCode
,
mkey
:
getParam
(
'mkey'
),
area_code
:
props
.
country
.
num
,
plat
:
5
}).
then
(
res
=>
{
const
data
=
res
.
data
...
...
@@ -135,7 +140,7 @@ const formikConfig = {
msg
:
data
.
data
.
msg
})
props
.
history
.
replace
(
`/passport/set-password`
)
}
else
{
}
else
{
location
.
assign
(
data
.
data
[
'jump_url'
])
}
...
...
@@ -143,17 +148,12 @@ const formikConfig = {
}
else
{
Toast
.
info
(
data
.
msg
,
2
,
null
,
false
)
}
/*props.setCurrentUser({
hasError,
data
})*/
})
}
}
export
default
compose
(
connect
(
null
,
state
=>
({
country
:
state
.
country
})
,
{
setCurrentUser
}
),
withFormik
(
formikConfig
),
...
...
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