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
0018a825
Commit
0018a825
authored
Jul 21, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信登录无痕验证
parent
05f04b42
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
13 deletions
+45
-13
src/App.js
+14
-2
src/components/activity/2020-717/invitation/index.js
+10
-11
src/store/no-trace-validation/reducer.js
+21
-0
No files found.
src/App.js
View file @
0018a825
...
@@ -8,6 +8,8 @@ import {
...
@@ -8,6 +8,8 @@ import {
closeCaptchaModal
,
closeCaptchaModal
,
showCaptchaModal
,
showCaptchaModal
,
validationPassed
,
validationPassed
,
startFetchNoTrace
,
endFetchNoTrace
,
}
from
'@/store/no-trace-validation/reducer'
}
from
'@/store/no-trace-validation/reducer'
import
{
initialState
}
from
'@/store/userReducer'
import
{
initialState
}
from
'@/store/userReducer'
import
{
withRouter
}
from
'react-router-dom'
import
{
withRouter
}
from
'react-router-dom'
...
@@ -116,7 +118,7 @@ class App extends Component {
...
@@ -116,7 +118,7 @@ class App extends Component {
componentDidUpdate
(
prevProps
,
prevState
)
{
componentDidUpdate
(
prevProps
,
prevState
)
{
this
.
setPreviousLocation
()
this
.
setPreviousLocation
()
const
{
user
,
noTraceValidation
:
{
isShowCaptcha
}}
=
this
.
props
const
{
user
,
noTraceValidation
:
{
isShowCaptcha
,
isFetching
:
isNoTraceFetching
}}
=
this
.
props
if
(
!
user
.
hasError
&&
getParam
(
'redirect'
))
{
if
(
!
user
.
hasError
&&
getParam
(
'redirect'
))
{
window
.
location
.
href
=
decodeURIComponent
(
getParam
(
'redirect'
))
window
.
location
.
href
=
decodeURIComponent
(
getParam
(
'redirect'
))
}
}
...
@@ -128,7 +130,10 @@ class App extends Component {
...
@@ -128,7 +130,10 @@ class App extends Component {
})
})
}
}
if
(
prevProps
.
user
.
isFetching
!==
user
.
isFetching
&&
!
user
.
isFetching
)
{
if
(
!
user
.
isFetching
&&
!
isNoTraceFetching
)
{
document
.
body
.
style
.
pointerEvents
=
'auto'
document
.
body
.
style
.
pointerEvents
=
'auto'
}
}
}
}
...
@@ -210,6 +215,7 @@ class App extends Component {
...
@@ -210,6 +215,7 @@ class App extends Component {
getUser
=
()
=>
{
getUser
=
()
=>
{
document
.
body
.
style
.
pointerEvents
=
'none'
document
.
body
.
style
.
pointerEvents
=
'none'
this
.
props
.
startFetchNoTrace
()
//获取用户信息
//获取用户信息
this
.
props
.
startFetchUser
()
this
.
props
.
startFetchUser
()
...
@@ -230,6 +236,7 @@ class App extends Component {
...
@@ -230,6 +236,7 @@ class App extends Component {
});
});
this
.
setupNoTraceValidate
()
this
.
setupNoTraceValidate
()
}
else
{
}
else
{
this
.
props
.
endFetchNoTrace
()
this
.
props
.
updateCaptchaState
({
this
.
props
.
updateCaptchaState
({
isNeedValidation
:
false
,
isNeedValidation
:
false
,
isFetching
:
false
,
isFetching
:
false
,
...
@@ -241,6 +248,7 @@ class App extends Component {
...
@@ -241,6 +248,7 @@ class App extends Component {
}
}
}
}
}
else
{
}
else
{
this
.
props
.
endFetchNoTrace
()
this
.
props
.
updateCaptchaState
({
this
.
props
.
updateCaptchaState
({
isNeedValidation
:
false
,
isNeedValidation
:
false
,
isFetching
:
false
,
isFetching
:
false
,
...
@@ -252,6 +260,7 @@ class App extends Component {
...
@@ -252,6 +260,7 @@ class App extends Component {
}
else
{
}
else
{
if
(
this
.
props
.
location
.
pathname
!==
'/my'
)
{
if
(
this
.
props
.
location
.
pathname
!==
'/my'
)
{
http
.
get
(
`
${
API
.
home
}
/m/user_info_sample/0`
).
then
(
res
=>
{
http
.
get
(
`
${
API
.
home
}
/m/user_info_sample/0`
).
then
(
res
=>
{
this
.
props
.
endFetchNoTrace
()
this
.
props
.
setCurrentUser
(
this
.
transformUser
(
res
))
this
.
props
.
setCurrentUser
(
this
.
transformUser
(
res
))
})
})
}
}
...
@@ -327,6 +336,7 @@ class App extends Component {
...
@@ -327,6 +336,7 @@ class App extends Component {
Toast
.
info
(
msg
)
Toast
.
info
(
msg
)
}
}
this
.
props
.
endFetchUser
()
this
.
props
.
endFetchUser
()
this
.
props
.
endFetchNoTrace
()
})
})
}
}
...
@@ -468,6 +478,8 @@ export default compose(
...
@@ -468,6 +478,8 @@ export default compose(
showCaptchaModal
,
showCaptchaModal
,
validationPassed
,
validationPassed
,
endFetchUser
,
endFetchUser
,
startFetchNoTrace
,
endFetchNoTrace
,
}),
}),
withRouter
,
withRouter
,
)(
App
)
)(
App
)
src/components/activity/2020-717/invitation/index.js
View file @
0018a825
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
'./index.scss'
import
'./index.scss'
import
{
connect
}
from
"react-redux"
;
import
{
connect
}
from
"react-redux"
;
import
{
compose
}
from
"redux"
;
import
{
compose
}
from
"redux"
;
import
{
HeaderBar
}
from
"@common/index"
import
{
HeaderBar
}
from
"@common/index"
import
{
getParam
,
http
,
browser
,
wxShare
}
from
"@/utils"
import
{
getParam
,
http
,
browser
,
wxShare
}
from
"@/utils"
import
{
Toast
}
from
"antd-mobile"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
CopyToClipboard
}
from
"react-copy-to-clipboard"
;
import
{
CopyToClipboard
}
from
"react-copy-to-clipboard"
;
import
{
Link
}
from
'react-router-dom'
import
{
Link
}
from
'react-router-dom'
import
storage
from
'store2'
import
storage
from
'store2'
import
{
CaptchaAli
}
from
"@common/index"
import
{
CaptchaAli
}
from
"@common/index"
import
{
showCaptchaModal
}
from
"@/store/no-trace-validation/reducer"
;
import
{
showCaptchaModal
}
from
"@/store/no-trace-validation/reducer"
;
class
Invitation
extends
Component
{
class
Invitation
extends
Component
{
...
@@ -125,7 +125,6 @@ class Invitation extends Component {
...
@@ -125,7 +125,6 @@ class Invitation extends Component {
if
(
data
.
token
&&
data
.
sig
)
{
if
(
data
.
token
&&
data
.
sig
)
{
_data
=
{...
_data
,
...
data
}
_data
=
{...
_data
,
...
data
}
}
}
http
.
post
(
`
${
API
.
home
}
/activity/anniversary/joinTeam`
,
_data
)
http
.
post
(
`
${
API
.
home
}
/activity/anniversary/joinTeam`
,
_data
)
.
then
(
res
=>
{
.
then
(
res
=>
{
const
{
code
,
msg
}
=
res
.
data
const
{
code
,
msg
}
=
res
.
data
...
...
src/store/no-trace-validation/reducer.js
View file @
0018a825
...
@@ -27,9 +27,20 @@ export const validationPassed = () => {
...
@@ -27,9 +27,20 @@ export const validationPassed = () => {
}
}
}
}
const
START_FETCH
=
'START_FETCH'
export
const
startFetchNoTrace
=
()
=>
({
type
:
START_FETCH
,
})
const
END_FETCH
=
'END_FETCH'
export
const
endFetchNoTrace
=
()
=>
({
type
:
END_FETCH
,
})
const
initialState
=
{
const
initialState
=
{
isShowCaptcha
:
false
,
isShowCaptcha
:
false
,
isNeedValidation
:
false
,
isNeedValidation
:
false
,
isFetching
:
false
,
}
}
export
default
function
noTraceValidation
(
state
=
initialState
,
action
)
{
export
default
function
noTraceValidation
(
state
=
initialState
,
action
)
{
...
@@ -55,6 +66,16 @@ export default function noTraceValidation(state = initialState, action) {
...
@@ -55,6 +66,16 @@ export default function noTraceValidation(state = initialState, action) {
isShowCaptcha
:
false
,
isShowCaptcha
:
false
,
isFetching
:
false
,
isFetching
:
false
,
}
}
case
START_FETCH
:
return
{
...
state
,
isFetching
:
true
,
}
case
END_FETCH
:
return
{
...
state
,
isFetching
:
false
,
}
default
:
default
:
return
state
return
state
}
}
...
...
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