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
d6020b62
Commit
d6020b62
authored
Jun 15, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
忘记密码验证
parent
ed40ea49
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
18 deletions
+45
-18
src/common/ClearableInput/index.js
+2
-2
src/components/passport/common/Input/index.js
+4
-0
src/components/passport/common/veriCodeInput/index.js
+20
-5
src/components/passport/forgotPassword/index.js
+19
-11
No files found.
src/common/ClearableInput/index.js
View file @
d6020b62
...
...
@@ -12,7 +12,7 @@ class ClearableInput extends Component {
inputClass
,
type
=
'text'
,
icon
,
set
Values
,
set
FieldValue
,
...
rest
}
=
this
.
props
let
clearIconStyle
=
{
...
...
@@ -31,7 +31,7 @@ class ClearableInput extends Component {
<
i
className
=
{
'iconfont icondanseshixintubiao-3 clear'
}
onClick
=
{()
=>
{
set
Values
({[
name
]:
''
}
)
set
FieldValue
(
name
,
''
)
}}
style
=
{
clearIconStyle
}
/
>
...
...
src/components/passport/common/Input/index.js
View file @
d6020b62
...
...
@@ -6,12 +6,16 @@ function Input({
icon
,
wrapperClass
,
children
,
value
,
name
,
...
rest
})
{
return
(
<
div
className
=
{
classnames
(
'input-wrapper'
,
wrapperClass
)}
>
<
input
className
=
'input'
name
=
{
name
}
value
=
{
value
}
{...
rest
}
/
>
{
icon
}
...
...
src/components/passport/common/veriCodeInput/index.js
View file @
d6020b62
...
...
@@ -21,7 +21,6 @@ class VeriCodeInput extends Component {
countDown
=
()
=>
{
let
{
count
}
=
this
.
state
if
(
!
this
.
state
.
isFirst
)
{
Toast
.
info
(
'请重新进行滑块验证'
,
2
,
null
,
false
)
this
.
props
.
instance
.
refresh
()
...
...
@@ -57,7 +56,6 @@ class VeriCodeInput extends Component {
sendCode
=
()
=>
{
if
(
!
this
.
validate
())
return
console
.
log
(
this
.
getType
())
this
.
getType
()
===
'email'
?
this
.
sendEmail
()
:
this
.
sendSMS
();
return
true
;
}
...
...
@@ -82,6 +80,10 @@ class VeriCodeInput extends Component {
sendSMS
=
()
=>
{
const
{
action
,
tel
,
challenge
}
=
this
.
props
if
(
!
tel
)
{
Toast
.
info
(
'请输入手机号或邮箱地址'
)
return
}
http
.
post
(
`
${
api
[
'passport-api'
]}
/quick_sms`
,
{
phone_num
:
tel
,
action
:
action
||
'login'
,
...
...
@@ -103,16 +105,29 @@ class VeriCodeInput extends Component {
const
{
tel
,
challenge
,
account
}
=
this
.
props
let
hasTel
=
has
(
this
.
props
,
'tel'
)
let
content
if
(
hasTel
)
{
if
(
!
tel
)
{
content
=
'手机号码不能为空'
}
if
(
validateTel
(
tel
))
{
content
=
'请输入正确格式的手机号码'
}
}
else
{
if
(
!
account
)
{
content
=
'手机号或电子邮件不能为空'
}
if
((
hasTel
&&
!
tel
)
||
(
!
hasTel
&&
!
account
))
{
if
(
!
validateTel
(
account
)
&&
!
validateEmail
(
account
))
{
content
=
'请输入正确格式的手机号或电子邮件'
}
}
if
(
content
)
{
Toast
.
info
(
content
,
2
,
null
,
false
)
return
false
}
if
(
!
challenge
)
{
Toast
.
info
(
'请进行滑块验证'
,
2
,
null
,
false
)
return
false
...
...
@@ -121,10 +136,10 @@ class VeriCodeInput extends Component {
}
render
()
{
let
{
type
=
'number'
,
className
,
...
rest
}
=
this
.
props
let
{
className
,
...
rest
}
=
this
.
props
return
(
<
Input
type
=
{
type
}
type
=
{
'number'
}
wrapperClass
=
{
className
}
{...
rest
}
>
...
...
src/components/passport/forgotPassword/index.js
View file @
d6020b62
...
...
@@ -7,7 +7,7 @@ import { connect } from 'react-redux';
import
{
compose
}
from
'redux'
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
HeaderBar
,
Captcha
,
ClearableInput
}
from
"@/common"
;
import
{
validateTel
,
validateEmail
}
from
"@/utils"
;
import
{
validateTel
,
validateEmail
,
http
,
api
}
from
"@/utils"
;
import
{
quickLogin
}
from
'@/store/userAction'
;
import
{
isEmpty
}
from
"lodash"
;
...
...
@@ -52,10 +52,10 @@ class ForgotPassword extends Component {
return
(
<
ClearableInput
{...
field
}
setValues
=
{
form
.
setValues
}
type
=
{
'tel'
}
placeholder
=
{
'请输入注册时的邮箱账号或手机号'
}
wrapperClass
=
{
'tel-input'
}
setFieldValue
=
{
form
.
setFieldValue
}
icon
=
{
<
i
className
=
{
'iconfont iconshouji'
}
style
=
{{
fontSize
:
'22px'
,
left
:
'11px'
}}
/>
}
...
...
@@ -107,17 +107,25 @@ const formikConfig = {
return
errors
},
handleSubmit
(
values
,
{
props
})
{
console
.
log
(
props
)
props
.
quickLogin
({
phone_num
:
values
.
account
,
phone_code
:
values
.
veriCode
}).
then
(
res
=>
{
if
(
res
.
hasError
)
{
Toast
.
info
(
res
.
msg
);
let
account
,
address
if
(
validateEmail
(
values
.
account
))
{
account
=
'email'
address
=
'check_email_code'
}
else
{
let
state
=
props
.
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
account
=
'phone_num'
address
=
'check_phone_code'
}
props
.
history
.
replace
(
state
.
from
)
http
.
post
(
`
${
api
[
'passport-api'
]}
/
${
address
}
`
,
{
[
account
]:
values
.
account
,
code
:
values
.
veriCode
}).
then
(
res
=>
{
if
(
res
.
data
.
errno
==
0
){
props
.
history
.
push
(
'/passport/set-password'
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
)
}
})
},
...
...
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