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
8d2d7413
Commit
8d2d7413
authored
Apr 21, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'login-binding' into dev
parents
c2713c0f
e4088969
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
12 deletions
+58
-12
src/App.js
+0
-6
src/common/Captcha/index.js
+0
-1
src/components/passport/accountLogin/index.js
+4
-0
src/components/passport/bindingTel/index.js
+52
-4
src/store/userAction.js
+2
-1
No files found.
src/App.js
View file @
8d2d7413
...
@@ -178,12 +178,6 @@ class App extends Component {
...
@@ -178,12 +178,6 @@ class App extends Component {
let
oid
=
getParam
(
'oid'
)
let
oid
=
getParam
(
'oid'
)
if
(
code
&&
!
oid
)
{
if
(
code
&&
!
oid
)
{
//针对2019双旦活动特殊处理,活动结束后删掉
//treasure_code=3538333139312c31&origin=2&aa=bb&code=0211aiYB1VVOL60rmWWB1367YB11aiY7&state=STATE
if
(
getParam
(
'treasure_code'
)
==
'3538333139312c31'
&&
code
==
'0211aiYB1VVOL60rmWWB1367YB11aiY7'
)
{
return
}
http
.
get
(
`
${
API
[
"passport-api"
]}
/m/wx_loginInfo/code/
${
code
}
?redirect=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
)
http
.
get
(
`
${
API
[
"passport-api"
]}
/m/wx_loginInfo/code/
${
code
}
?redirect=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
)
.
then
(
res
=>
{
.
then
(
res
=>
{
let
data
=
res
.
data
let
data
=
res
.
data
...
...
src/common/Captcha/index.js
View file @
8d2d7413
...
@@ -24,7 +24,6 @@ class Captcha extends Component {
...
@@ -24,7 +24,6 @@ class Captcha extends Component {
width
:
'auto'
,
width
:
'auto'
,
onReady
:
function
(
instance
)
{
onReady
:
function
(
instance
)
{
// 验证码一切准备就绪,此时可正常使用验证码的相关功能
// 验证码一切准备就绪,此时可正常使用验证码的相关功能
console
.
log
(
_this
);
_this
.
setState
({
_this
.
setState
({
isReady
:
true
isReady
:
true
});
});
...
...
src/components/passport/accountLogin/index.js
View file @
8d2d7413
...
@@ -77,6 +77,10 @@ const formikConfig = {
...
@@ -77,6 +77,10 @@ const formikConfig = {
username
,
password
,
redirect
:
from
&&
window
.
location
.
origin
+
from
.
pathname
+
from
.
search
+
from
.
hash
username
,
password
,
redirect
:
from
&&
window
.
location
.
origin
+
from
.
pathname
+
from
.
search
+
from
.
hash
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
hasError
)
{
if
(
res
.
hasError
)
{
if
(
res
.
code
===
4004
){
history
.
push
(
`/passport/binding-tel?username=
${
username
}
`
)
return
}
Toast
.
info
(
res
.
msg
,
2
,
null
,
false
)
Toast
.
info
(
res
.
msg
,
2
,
null
,
false
)
}
}
})
})
...
...
src/components/passport/bindingTel/index.js
View file @
8d2d7413
...
@@ -39,6 +39,9 @@ class BindingTel extends Component {
...
@@ -39,6 +39,9 @@ class BindingTel extends Component {
}
}
}
}
componentDidMount
()
{
console
.
log
(
this
.
props
.
location
.
state
)
}
render
()
{
render
()
{
const
{
const
{
...
@@ -119,17 +122,52 @@ const formikConfig = {
...
@@ -119,17 +122,52 @@ const formikConfig = {
return
errors
return
errors
},
},
handleSubmit
(
values
,
{
props
})
{
handleSubmit
(
values
,
{
props
})
{
http
.
post
(
`
${
API
[
'passport-api'
]}
/bind_mobile`
,
{
const
username
=
getParam
(
'username'
)
if
(
username
)
{
//老账号绑定手机号
http
.
post
(
`
${
API
[
"passport-api"
]}
/m/personal/bindMobile`
,
{
phone_num
:
values
.
tel
,
code
:
values
.
veriCode
,
type
:
1
,
area_code
:
'00'
+
props
.
country
.
num
,
user_name
:
username
}).
then
(
res
=>
{
const
{
data
,
errno
,
msg
}
=
res
.
data
if
(
errno
===
200
)
{
props
.
setCurrentUser
({
hasError
:
false
,
data
:
{
username
:
data
.
user_name
,
avatar
:
data
.
avatar_file
,
isVip
:
parseInt
(
data
.
vip
),
token
:
data
.
access_token
,
uid
:
data
.
uid
}
})
const
{
from
}
=
props
.
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
props
.
history
.
push
(
from
)
}
else
{
Toast
.
info
(
msg
,
2
,
null
,
false
)
}
})
}
else
{
const
uid
=
getParam
(
'uid'
)
const
params
=
{
phone_num
:
values
.
tel
,
phone_num
:
values
.
tel
,
phone_code
:
values
.
veriCode
,
phone_code
:
values
.
veriCode
,
mkey
:
getParam
(
'mkey'
),
mkey
:
getParam
(
'mkey'
),
area_code
:
'00'
+
props
.
country
.
num
,
area_code
:
'00'
+
props
.
country
.
num
,
plat
:
5
plat
:
5
,
}).
then
(
res
=>
{
type
:
uid
?
1
:
2
}
if
(
uid
)
{
params
.
uid
=
uid
}
http
.
post
(
`
${
API
[
'passport-api'
]}
/bind_mobile`
,
params
).
then
(
res
=>
{
const
data
=
res
.
data
const
data
=
res
.
data
if
(
data
.
errno
==
200
)
{
if
(
data
.
errno
==
200
)
{
if
(
data
.
data
[
'is_set_pwd'
])
{
const
{
history
}
=
props
const
{
history
}
=
props
if
(
data
.
data
[
'is_set_pwd'
])
{
history
.
replace
(
`/passport/set-password`
,
{
history
.
replace
(
`/passport/set-password`
,
{
user
:
{
user
:
{
hasError
:
false
,
hasError
:
false
,
...
@@ -141,8 +179,16 @@ const formikConfig = {
...
@@ -141,8 +179,16 @@ const formikConfig = {
}
}
})
})
}
else
{
}
else
{
if
(
uid
)
{
const
redirect
=
localStorage
.
getItem
(
'binding_redirect'
)
if
(
redirect
)
{
localStorage
.
removeItem
(
'binding_redirect'
)
history
.
replace
(
JSON
.
parse
(
redirect
))
}
else
{
location
.
assign
(
data
.
data
[
'jump_url'
])
location
.
assign
(
data
.
data
[
'jump_url'
])
}
}
}
}
}
else
{
}
else
{
...
@@ -150,6 +196,8 @@ const formikConfig = {
...
@@ -150,6 +196,8 @@ const formikConfig = {
}
}
})
})
}
}
}
}
}
export
default
compose
(
export
default
compose
(
connect
(
connect
(
...
...
src/store/userAction.js
View file @
8d2d7413
...
@@ -67,7 +67,8 @@ const storeUser = (res, dispatch) => {
...
@@ -67,7 +67,8 @@ const storeUser = (res, dispatch) => {
payload
=
{
payload
=
{
hasError
:
true
,
hasError
:
true
,
msg
:
data
.
msg
,
msg
:
data
.
msg
,
data
:
{}
data
:
{},
code
:
data
.
errno
}
}
}
}
dispatch
(
setCurrentUser
(
payload
))
dispatch
(
setCurrentUser
(
payload
))
...
...
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