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
f3e1141d
Commit
f3e1141d
authored
Nov 04, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Plain Diff
tupian
parents
33138c8e
336e4b58
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
36 deletions
+49
-36
src/App.js
+3
-0
src/components/activity/index.js
+1
-1
src/components/passport/bindingTel/index.js
+15
-14
src/components/passport/index.js
+5
-2
src/components/passport/setPassword/index.js
+24
-18
src/router/router-config.js
+1
-1
No files found.
src/App.js
View file @
f3e1141d
...
...
@@ -63,6 +63,9 @@ class App extends Component {
if
(
cookie
.
get
(
'uid'
)
&&
this
.
props
.
user
.
hasError
)
{
this
.
getUser
()
}
if
(
location
.
pathname
===
'/passport'
){
window
.
localStorage
.
setItem
(
'binding_redirect'
,
JSON
.
stringify
(
this
.
previousLocation
))
}
const
{
pathname
,
state
}
=
location
if
(
pathname
.
startsWith
(
'/passport'
))
{
location
.
state
=
{
...
...
src/components/activity/index.js
View file @
f3e1141d
...
...
@@ -26,7 +26,7 @@ class Activity extends Component {
getGift
=
()
=>
{
if
(
this
.
props
.
user
.
hasError
)
{
this
.
props
.
history
.
push
(
'/passport'
);
this
.
props
.
history
.
push
(
'/passport'
,
{
from
:
this
.
props
.
location
.
pathname
}
);
}
else
{
Toast
.
info
(
'领取成功,你可前往七月在线官网/APP进行查看'
,
2
);
localStorage
.
setItem
(
'lingqu'
,
1
);
...
...
src/components/passport/bindingTel/index.js
View file @
f3e1141d
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
import
'./binding-tel.scss'
import
{
withFormik
,
Field
,
Form
}
from
"formik"
;
import
{
http
,
getParam
}
from
"@/utils"
;
import
{
compose
}
from
"redux"
;
import
{
connect
}
from
"react-redux"
;
import
{
setCurrentUser
}
from
"@/store/userAction"
;
import
{
withFormik
,
Field
,
Form
}
from
"formik"
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'
...
...
@@ -13,8 +13,8 @@ import { HeaderBar } from '@/common'
import
ClearableInput
from
'../common/clearableInputWithCountryCodes'
import
Button
from
'../common/Button'
import
VeriCodeInput
from
'../common/veriCodeInput'
import
{
Toast
}
from
"antd-mobile"
;
import
{
isEmpty
}
from
"lodash"
;
import
{
Toast
}
from
"antd-mobile"
import
{
isEmpty
}
from
"lodash"
class
BindingTel
extends
Component
{
...
...
@@ -95,7 +95,7 @@ class BindingTel extends Component {
<
/Form
>
<
/div
>
<
/
>
);
)
}
}
...
...
@@ -123,22 +123,23 @@ const formikConfig = {
phone_num
:
values
.
tel
,
phone_code
:
values
.
veriCode
,
mkey
:
getParam
(
'mkey'
),
area_code
:
'00'
+
props
.
country
.
num
,
area_code
:
'00'
+
props
.
country
.
num
,
plat
:
5
}).
then
(
res
=>
{
const
data
=
res
.
data
if
(
data
.
errno
==
200
)
{
if
(
data
.
data
[
'is_set_pwd'
])
{
props
.
setCurrentUser
({
const
{
history
}
=
props
history
.
replace
(
`/passport/set-password`
,
{
user
:
{
hasError
:
false
,
data
:
{
uid
:
data
.
data
.
uid
},
msg
:
data
.
data
.
msg
,
stage
:
'binding'
}
})
props
.
history
.
replace
(
`/passport/set-password`
)
}
else
{
location
.
assign
(
data
.
data
[
'jump_url'
])
}
...
...
@@ -156,4 +157,4 @@ export default compose(
{
setCurrentUser
}
),
withFormik
(
formikConfig
),
)(
BindingTel
)
;
)(
BindingTel
)
src/components/passport/index.js
View file @
f3e1141d
...
...
@@ -23,6 +23,7 @@ class Passport extends Component {
redirectURL
=
'/'
count
=
1
blackList
=
new
Set
([
'/passport/binding-tel'
,
'/passport/set-password'
])
constructor
(
props
)
{
super
(
props
)
...
...
@@ -85,7 +86,7 @@ class Passport extends Component {
routeWhenUserLoggedIn
=
()
=>
{
let
{
hasError
}
=
this
.
props
.
user
if
(
!
hasError
)
{
if
(
!
hasError
&&
!
this
.
blackList
.
has
(
this
.
props
.
location
.
pathname
)
)
{
const
redirectURI
=
getParam
(
'redirect'
)
redirectURI
?
(
window
.
location
.
href
=
redirectURI
)
:
this
.
props
.
history
.
go
(
-
this
.
count
)
}
...
...
@@ -108,7 +109,9 @@ class Passport extends Component {
<
Route
path
=
{
match
.
url
+
'/account-login'
}
component
=
{
AccountLogin
}
/
>
<
Route
path
=
{
match
.
url
+
'/forgot-password'
}
component
=
{
ForgotPassword
}
/
>
<
Route
path
=
{
match
.
url
+
'/forgot-password-email'
}
component
=
{
ForgotPasswordEmail
}
/
>
<
Route
path
=
{
match
.
url
+
'/set-password'
}
component
=
{
SetPassword
}
/
>
<
Route
path
=
{
match
.
url
+
'/set-password'
}
render
=
{
props
=>
{
return
<
SetPassword
{...
props
}
count
=
{
this
.
count
}
/
>
}}
/
>
<
Route
path
=
{
match
.
url
+
'/binding-tel'
}
component
=
{
BindingTel
}
/
>
<
/Switch
>
<
/div
>
...
...
src/components/passport/setPassword/index.js
View file @
f3e1141d
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
import
'./set-password.scss'
import
{
withFormik
,
Form
,
Field
}
from
"formik"
;
import
{
withFormik
,
Form
,
Field
}
from
"formik"
import
PasswordInput
from
'../common/passwordInput'
import
Button
from
'../common/Button'
import
classnames
from
'classnames'
import
{
compose
}
from
'redux'
import
{
HeaderBar
}
from
"@/common"
;
import
{
http
,
api
}
from
"@/utils"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
encrypt
}
from
"@/components/passport/encryption"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
isEmpty
}
from
"lodash"
;
import
{
connect
}
from
"react-redux"
;
import
{
HeaderBar
}
from
"@/common"
import
{
http
}
from
"@/utils"
import
{
Toast
}
from
"antd-mobile"
import
{
encrypt
}
from
"@/components/passport/encryption"
import
{
Link
}
from
"react-router-dom"
import
{
isEmpty
}
from
"lodash"
import
{
connect
}
from
"react-redux"
import
{
setCurrentUser
}
from
'@/store/userAction'
class
SetPassword
extends
Component
{
render
()
{
...
...
@@ -56,7 +56,7 @@ class SetPassword extends Component {
<
/div
>
<
/div
>
<
/
>
);
)
}
}
...
...
@@ -71,7 +71,7 @@ const formikConfig = {
let
from
=
props
.
location
.
state
&&
props
.
location
.
state
.
from
||
{
pathname
:
'/'
}
if
(
from
.
pathname
.
includes
(
'forgot-password'
))
{
forgotPasswordReset
(
values
,
props
);
forgotPasswordReset
(
values
,
props
)
}
else
{
bindMobileSetPassword
(
values
,
props
)
}
...
...
@@ -80,7 +80,7 @@ const formikConfig = {
validateOnChange
:
false
,
validate
:
values
=>
{
let
errors
=
{}
const
re
=
/^
(?![
0-9
]
+$
)(?![
a-zA-Z
]
+$
)[
0-9A-Za-z
]{6,16}
$/
;
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
)
...
...
@@ -122,10 +122,17 @@ function bindMobileSetPassword(values, props) {
})
.
then
(
res
=>
{
if
(
res
.
data
.
errno
==
200
)
{
const
{
location
,
history
}
=
props
Toast
.
info
(
'密码设置成功'
)
let
from
=
props
.
location
.
state
&&
props
.
location
.
state
.
from
||
{
pathname
:
'/'
}
let
from
=
location
.
state
&&
location
.
state
.
from
||
{
pathname
:
'/'
}
let
local_redirect_url
=
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'binding_redirect'
))
setTimeout
(
function
()
{
props
.
history
.
replace
(
from
.
pathname
)
if
(
local_redirect_url
)
{
const
{
pathname
,
search
,
hash
}
=
local_redirect_url
history
.
replace
(
pathname
+
search
+
hash
)
}
else
{
history
.
replace
(
from
.
pathname
)
}
},
1000
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
,
null
,
false
)
...
...
@@ -136,7 +143,7 @@ function bindMobileSetPassword(values, props) {
export
default
compose
(
connect
(
state
=>
({
user
:
state
.
user
}),
null
{
setCurrentUser
}
),
withFormik
(
formikConfig
)
)(
SetPassword
);
\ No newline at end of file
)(
SetPassword
)
src/router/router-config.js
View file @
f3e1141d
...
...
@@ -207,7 +207,7 @@ export default [
},
// 定金-邀请好友助力
{
path
:
'/expand/index'
,
path
:
'/expand/index
activity
'
,
component
:
ExpandShare
},
{
...
...
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