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
8d6d862a
Commit
8d6d862a
authored
Jun 15, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.julyedu.com:baiguangyao/mr-julyedu
parents
bb58baaf
fb665f8d
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
143 additions
and
58 deletions
+143
-58
src/common/ClearableInput/index.js
+2
-2
src/components/passport/accountLogin/index.js
+9
-0
src/components/passport/common/Input/index.js
+4
-0
src/components/passport/common/veriCodeInput/index.js
+20
-5
src/components/passport/forgotPassword/forgot-password.scss
+2
-0
src/components/passport/forgotPassword/index.js
+24
-11
src/components/passport/passport.scss
+0
-2
src/components/passport/setPassword/index.js
+63
-30
src/components/passport/setPassword/set-password.scss
+19
-8
No files found.
src/common/ClearableInput/index.js
View file @
8d6d862a
...
@@ -12,7 +12,7 @@ class ClearableInput extends Component {
...
@@ -12,7 +12,7 @@ class ClearableInput extends Component {
inputClass
,
inputClass
,
type
=
'text'
,
type
=
'text'
,
icon
,
icon
,
set
Values
,
set
FieldValue
,
...
rest
...
rest
}
=
this
.
props
}
=
this
.
props
let
clearIconStyle
=
{
let
clearIconStyle
=
{
...
@@ -31,7 +31,7 @@ class ClearableInput extends Component {
...
@@ -31,7 +31,7 @@ class ClearableInput extends Component {
<
i
<
i
className
=
{
'iconfont icondanseshixintubiao-3 clear'
}
className
=
{
'iconfont icondanseshixintubiao-3 clear'
}
onClick
=
{()
=>
{
onClick
=
{()
=>
{
set
Values
({[
name
]:
''
}
)
set
FieldValue
(
name
,
''
)
}}
}}
style
=
{
clearIconStyle
}
style
=
{
clearIconStyle
}
/
>
/
>
...
...
src/components/passport/accountLogin/index.js
View file @
8d6d862a
...
@@ -12,9 +12,15 @@ import Header from "../common/Header";
...
@@ -12,9 +12,15 @@ import Header from "../common/Header";
import
Input
from
'../common/Input'
import
Input
from
'../common/Input'
import
LoginButton
from
'../common/LoginButton'
import
LoginButton
from
'../common/LoginButton'
import
PasswordInput
from
'../common/passwordInput'
import
PasswordInput
from
'../common/passwordInput'
import
{
Toast
}
from
"antd-mobile"
;
class
AccountLogin
extends
PureComponent
{
class
AccountLogin
extends
PureComponent
{
componentDidMount
()
{
console
.
log
(
this
.
props
.
values
);
}
render
()
{
render
()
{
const
{
const
{
errors
,
errors
,
...
@@ -69,9 +75,12 @@ const formikConfig = {
...
@@ -69,9 +75,12 @@ const formikConfig = {
props
.
accountLogin
({
props
.
accountLogin
({
username
,
password
username
,
password
}).
then
(
res
=>
{
}).
then
(
res
=>
{
console
.
log
(
res
);
if
(
!
res
.
hasError
)
{
if
(
!
res
.
hasError
)
{
let
{
from
}
=
props
.
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
let
{
from
}
=
props
.
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
history
.
push
(
from
.
pathname
)
history
.
push
(
from
.
pathname
)
}
else
{
Toast
.
info
(
res
.
msg
,
2
,
null
,
false
)
}
}
})
})
}
}
...
...
src/components/passport/common/Input/index.js
View file @
8d6d862a
...
@@ -6,12 +6,16 @@ function Input({
...
@@ -6,12 +6,16 @@ function Input({
icon
,
icon
,
wrapperClass
,
wrapperClass
,
children
,
children
,
value
,
name
,
...
rest
...
rest
})
{
})
{
return
(
return
(
<
div
className
=
{
classnames
(
'input-wrapper'
,
wrapperClass
)}
>
<
div
className
=
{
classnames
(
'input-wrapper'
,
wrapperClass
)}
>
<
input
<
input
className
=
'input'
className
=
'input'
name
=
{
name
}
value
=
{
value
}
{...
rest
}
{...
rest
}
/
>
/
>
{
icon
}
{
icon
}
...
...
src/components/passport/common/veriCodeInput/index.js
View file @
8d6d862a
...
@@ -21,7 +21,6 @@ class VeriCodeInput extends Component {
...
@@ -21,7 +21,6 @@ class VeriCodeInput extends Component {
countDown
=
()
=>
{
countDown
=
()
=>
{
let
{
count
}
=
this
.
state
let
{
count
}
=
this
.
state
if
(
!
this
.
state
.
isFirst
)
{
if
(
!
this
.
state
.
isFirst
)
{
Toast
.
info
(
'请重新进行滑块验证'
,
2
,
null
,
false
)
Toast
.
info
(
'请重新进行滑块验证'
,
2
,
null
,
false
)
this
.
props
.
instance
.
refresh
()
this
.
props
.
instance
.
refresh
()
...
@@ -57,7 +56,6 @@ class VeriCodeInput extends Component {
...
@@ -57,7 +56,6 @@ class VeriCodeInput extends Component {
sendCode
=
()
=>
{
sendCode
=
()
=>
{
if
(
!
this
.
validate
())
return
if
(
!
this
.
validate
())
return
console
.
log
(
this
.
getType
())
this
.
getType
()
===
'email'
?
this
.
sendEmail
()
:
this
.
sendSMS
();
this
.
getType
()
===
'email'
?
this
.
sendEmail
()
:
this
.
sendSMS
();
return
true
;
return
true
;
}
}
...
@@ -82,6 +80,10 @@ class VeriCodeInput extends Component {
...
@@ -82,6 +80,10 @@ class VeriCodeInput extends Component {
sendSMS
=
()
=>
{
sendSMS
=
()
=>
{
const
{
action
,
tel
,
challenge
}
=
this
.
props
const
{
action
,
tel
,
challenge
}
=
this
.
props
if
(
!
tel
)
{
Toast
.
info
(
'请输入手机号或邮箱地址'
)
return
}
http
.
post
(
`
${
api
[
'passport-api'
]}
/quick_sms`
,
{
http
.
post
(
`
${
api
[
'passport-api'
]}
/quick_sms`
,
{
phone_num
:
tel
,
phone_num
:
tel
,
action
:
action
||
'login'
,
action
:
action
||
'login'
,
...
@@ -103,16 +105,29 @@ class VeriCodeInput extends Component {
...
@@ -103,16 +105,29 @@ class VeriCodeInput extends Component {
const
{
tel
,
challenge
,
account
}
=
this
.
props
const
{
tel
,
challenge
,
account
}
=
this
.
props
let
hasTel
=
has
(
this
.
props
,
'tel'
)
let
hasTel
=
has
(
this
.
props
,
'tel'
)
let
content
let
content
if
(
hasTel
)
{
if
(
hasTel
)
{
if
(
!
tel
)
{
content
=
'手机号码不能为空'
content
=
'手机号码不能为空'
}
if
(
validateTel
(
tel
))
{
content
=
'请输入正确格式的手机号码'
}
}
else
{
}
else
{
if
(
!
account
)
{
content
=
'手机号或电子邮件不能为空'
content
=
'手机号或电子邮件不能为空'
}
}
if
((
hasTel
&&
!
tel
)
||
(
!
hasTel
&&
!
account
))
{
if
(
!
validateTel
(
account
)
&&
!
validateEmail
(
account
))
{
content
=
'请输入正确格式的手机号或电子邮件'
}
}
if
(
content
)
{
Toast
.
info
(
content
,
2
,
null
,
false
)
Toast
.
info
(
content
,
2
,
null
,
false
)
return
false
return
false
}
}
if
(
!
challenge
)
{
if
(
!
challenge
)
{
Toast
.
info
(
'请进行滑块验证'
,
2
,
null
,
false
)
Toast
.
info
(
'请进行滑块验证'
,
2
,
null
,
false
)
return
false
return
false
...
@@ -121,10 +136,10 @@ class VeriCodeInput extends Component {
...
@@ -121,10 +136,10 @@ class VeriCodeInput extends Component {
}
}
render
()
{
render
()
{
let
{
type
=
'number'
,
className
,
...
rest
}
=
this
.
props
let
{
className
,
...
rest
}
=
this
.
props
return
(
return
(
<
Input
<
Input
type
=
{
type
}
type
=
{
'number'
}
wrapperClass
=
{
className
}
wrapperClass
=
{
className
}
{...
rest
}
{...
rest
}
>
>
...
...
src/components/passport/forgotPassword/forgot-password.scss
View file @
8d6d862a
...
@@ -22,4 +22,5 @@
...
@@ -22,4 +22,5 @@
margin-bottom
:
21px
;
margin-bottom
:
21px
;
}
}
}
}
\ No newline at end of file
src/components/passport/forgotPassword/index.js
View file @
8d6d862a
...
@@ -7,7 +7,7 @@ import { connect } from 'react-redux';
...
@@ -7,7 +7,7 @@ import { connect } from 'react-redux';
import
{
compose
}
from
'redux'
;
import
{
compose
}
from
'redux'
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
HeaderBar
,
Captcha
,
ClearableInput
}
from
"@/common"
;
import
{
HeaderBar
,
Captcha
,
ClearableInput
}
from
"@/common"
;
import
{
validateTel
,
validateEmail
}
from
"@/utils"
;
import
{
validateTel
,
validateEmail
,
http
,
api
}
from
"@/utils"
;
import
{
quickLogin
}
from
'@/store/userAction'
;
import
{
quickLogin
}
from
'@/store/userAction'
;
import
{
isEmpty
}
from
"lodash"
;
import
{
isEmpty
}
from
"lodash"
;
...
@@ -52,10 +52,10 @@ class ForgotPassword extends Component {
...
@@ -52,10 +52,10 @@ class ForgotPassword extends Component {
return
(
return
(
<
ClearableInput
<
ClearableInput
{...
field
}
{...
field
}
setValues
=
{
form
.
setValues
}
type
=
{
'tel'
}
type
=
{
'tel'
}
placeholder
=
{
'请输入注册时的邮箱账号或手机号'
}
placeholder
=
{
'请输入注册时的邮箱账号或手机号'
}
wrapperClass
=
{
'tel-input'
}
wrapperClass
=
{
'tel-input'
}
setFieldValue
=
{
form
.
setFieldValue
}
icon
=
{
<
i
className
=
{
'iconfont iconshouji'
}
icon
=
{
<
i
className
=
{
'iconfont iconshouji'
}
style
=
{{
fontSize
:
'22px'
,
left
:
'11px'
}}
style
=
{{
fontSize
:
'22px'
,
left
:
'11px'
}}
/>
}
/>
}
...
@@ -107,17 +107,30 @@ const formikConfig = {
...
@@ -107,17 +107,30 @@ const formikConfig = {
return
errors
return
errors
},
},
handleSubmit
(
values
,
{
props
})
{
handleSubmit
(
values
,
{
props
})
{
console
.
log
(
props
)
props
.
quickLogin
({
phone_num
:
values
.
account
,
let
account
,
address
phone_code
:
values
.
veriCode
}).
then
(
res
=>
{
if
(
validateEmail
(
values
.
account
))
{
if
(
res
.
hasError
)
{
account
=
'email'
Toast
.
info
(
res
.
msg
);
address
=
'check_email_code'
sessionStorage
.
setItem
(
'r_type'
,
'email'
)
sessionStorage
.
setItem
(
'email'
,
values
.
account
)
}
else
{
}
else
{
let
state
=
props
.
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
account
=
'phone_num'
address
=
'check_phone_code'
sessionStorage
.
setItem
(
'r_type'
,
'phone'
)
sessionStorage
.
setItem
(
'tel'
,
values
.
account
)
}
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
)
}
}
})
})
},
},
...
...
src/components/passport/passport.scss
View file @
8d6d862a
.passport
{
.passport
{
height
:
100%
;
height
:
100%
;
display
:
flex
;
}
}
\ No newline at end of file
src/components/passport/setPassword/index.js
View file @
8d6d862a
...
@@ -5,29 +5,19 @@ import PasswordInput from '../common/passwordInput'
...
@@ -5,29 +5,19 @@ import PasswordInput from '../common/passwordInput'
import
Button
from
'../common/Button'
import
Button
from
'../common/Button'
import
classnames
from
'classnames'
import
classnames
from
'classnames'
import
{
compose
}
from
'redux'
import
{
compose
}
from
'redux'
import
{
HeaderBar
}
from
"@/common"
;
class
SetPassword
extends
Component
{
import
{
http
,
api
}
from
"@/utils"
;
import
{
Toast
}
from
"antd-mobile"
;
constructor
(
props
)
{
import
{
encrypt
}
from
"@/components/passport/encryption"
;
super
(
props
);
import
{
Link
}
from
"react-router-dom"
;
this
.
state
=
{
password
:
''
,
agree
:
true
};
}
handleChange
=
(
val
)
=>
{
class
SetPassword
extends
Component
{
this
.
setState
({
password
:
val
});
}
toggleAgree
=
()
=>
{
this
.
setState
({
agree
:
!
this
.
state
.
agree
});
}
render
()
{
render
()
{
return
(
return
(
<>
<
HeaderBar
arrow
=
{
true
}
title
=
{
'设置密码'
}
/
>
<
div
className
=
{
'set-password'
}
>
<
div
className
=
{
'set-password'
}
>
<
p
className
=
'title'
>
密码需要包含
6
-
16
位字母及数字
<
/p
>
<
p
className
=
'title'
>
密码需要包含
6
-
16
位字母及数字
<
/p
>
<
Form
>
<
Form
>
...
@@ -36,6 +26,7 @@ class SetPassword extends Component {
...
@@ -36,6 +26,7 @@ class SetPassword extends Component {
render
=
{({
field
})
=>
{
render
=
{({
field
})
=>
{
return
(
return
(
<
PasswordInput
<
PasswordInput
autoComplete
=
{
'on'
}
placeholder
=
{
'设置密码'
}
placeholder
=
{
'设置密码'
}
onChange
=
{
this
.
handleChange
}
onChange
=
{
this
.
handleChange
}
{...
field
}
{...
field
}
...
@@ -44,26 +35,68 @@ class SetPassword extends Component {
...
@@ -44,26 +35,68 @@ class SetPassword extends Component {
}}
}}
/
>
/
>
<
Button
className
=
{
'btn-active'
}
>
完成
<
/Button
>
<
Button
className
=
{
'btn-active'
}
>
完成
<
/Button
>
<
/Form
>
<
label
htmlFor
=
"agreement"
className
=
'user-agreement'
>
<
p
className
=
'user-agreement'
>
<
Field
type
=
'checkbox'
<
i
className
=
{
classnames
({
name
=
'agreement'
'iconfont iconiconfront-3'
:
this
.
state
.
agree
,
id
=
'agreement'
disagree
:
!
this
.
state
.
agree
className
=
{
classnames
([
})}
onClick
=
{
this
.
toggleAgree
}
/
>
this
.
props
.
values
.
agreement
?
'iconfont iconiconfront-3'
:
'disagree'
])}
/
>
同意
<
span
>
《七月在线用户使用协议》
<
/span
>
同意
<
span
>
《七月在线用户使用协议》
<
/span
>
<
/p
>
<
/label
>
<
p
className
=
'skip'
>
跳过
<
/p
>
<
/Form
>
<
div
className
=
"skip"
>
<
Link
replace
to
=
'/passport/account-login'
>
跳过
<
/Link
>
<
/div
>
<
/div
>
<
/div
>
<
/
>
);
);
}
}
}
}
const
formikConfig
=
{
const
formikConfig
=
{
mapValuesToProps
:
()
=>
({
mapPropsToValues
()
{
password
:
''
return
{
}),
password
:
''
,
handleSubmit
:
(
values
)
=>
{
agreement
:
true
}
},
handleSubmit
:
(
values
,
{
props
})
=>
{
let
key
=
sessionStorage
.
getItem
(
'r_type'
)
===
'email'
?
'email'
:
'tel'
let
encrypted
=
encrypt
(
values
.
password
)
http
.
post
(
`
${
api
[
'passport-api'
]}
/up_pass
${
key
===
'tel'
&&
'_by_phone'
||
''
}
`
,
{
[
key
]:
sessionStorage
.
getItem
(
key
),
pass
:
encrypted
,
re_pass
:
encrypted
})
.
then
(
res
=>
{
if
(
res
.
data
.
errno
==
0
)
{
Toast
.
info
(
'密码设置成功'
)
setTimeout
(
function
()
{
props
.
history
.
replace
(
'/passport'
)
},
1000
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
,
null
,
false
)
}
})
},
validateOnChange
:
false
,
validate
:
(
values
)
=>
{
let
errors
=
{}
const
re
=
/^
(?![
0-9
]
+$
)(?![
a-zA-Z
]
+$
)[
0-9A-Za-z
]{6,16}
$/
;
if
(
!
re
.
test
(
values
.
password
))
{
errors
.
password
=
'密码需要包含6-16位字母及数字'
Toast
.
info
(
errors
.
password
,
2
,
null
,
false
)
}
if
(
!
values
.
agreement
)
{
errors
.
agreement
=
'您须同意《七月在线用户使用协议》'
Toast
.
info
(
errors
.
agreement
,
2
,
null
,
false
)
}
return
errors
}
}
}
}
...
...
src/components/passport/setPassword/set-password.scss
View file @
8d6d862a
...
@@ -17,7 +17,15 @@
...
@@ -17,7 +17,15 @@
.user-agreement
{
.user-agreement
{
line-height
:
30px
;
line-height
:
30px
;
i
{
span
{
vertical-align
:
middle
;
color
:
$active
;
}
input
{
-webkit-appearance
:
none
;
border
:
none
;
outline
:
0
;
margin-right
:
3px
;
margin-right
:
3px
;
font-size
:
21px
;
font-size
:
21px
;
vertical-align
:
middle
;
vertical-align
:
middle
;
...
@@ -33,19 +41,14 @@
...
@@ -33,19 +41,14 @@
&
:
:
before
{
&
:
:
before
{
content
:
''
;
content
:
''
;
display
:
inline-block
;
display
:
inline-block
;
width
:
1
9
px
;
width
:
1
7
px
;
height
:
1
9
px
;
height
:
1
7
px
;
border
:
1px
solid
$border_ccc
;
border
:
1px
solid
$border_ccc
;
border-radius
:
50%
;
border-radius
:
50%
;
}
}
}
}
}
}
span
{
vertical-align
:
middle
;
color
:
$active
;
}
}
}
.skip
{
.skip
{
...
@@ -54,4 +57,11 @@
...
@@ -54,4 +57,11 @@
color
:
$color_999
;
color
:
$color_999
;
text-align
:
center
;
text-align
:
center
;
}
}
.input-wrapper
{
input
{
padding-left
:
17px
;
}
}
}
}
\ No newline at end of file
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