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
4e1e48c5
Commit
4e1e48c5
authored
Jul 21, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'no-trace-validation'
parents
ed41fee7
05f04b42
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
46 deletions
+18
-46
src/App.js
+18
-22
src/components/activity/2020-717/invitation/index.js
+0
-3
src/store/no-trace-validation/reducer.js
+0
-21
No files found.
src/App.js
View file @
4e1e48c5
import
React
,
{
Component
}
from
'react'
import
React
,
{
Component
}
from
'react'
import
Routes
from
'./router'
import
cookie
from
'js-cookie'
import
{
connect
}
from
'react-redux'
import
{
setCurrentUser
,
startFetchUser
,
endFetchUser
}
from
'@/store/userAction'
import
{
connect
}
from
'react-redux'
import
{
setCurrentUser
,
startFetchUser
,
endFetchUser
}
from
'@/store/userAction'
import
{
updateCaptchaState
,
closeCaptchaModal
,
showCaptchaModal
,
validationPassed
,
startFetchValidationState
,
endFetchValidationState
,
}
from
'@/store/no-trace-validation/reducer'
import
{
initialState
}
from
'@/store/userReducer'
import
{
withRouter
}
from
'react-router-dom'
import
{
compose
}
from
'redux'
import
{
getParam
,
http
,
browser
,
loadScript
,
getTimestamp
}
from
'@/utils'
import
{
Toast
}
from
'antd-mobile'
import
{
addDays
}
from
'date-fns'
import
{
initialState
}
from
'@/store/userReducer'
import
{
withRouter
}
from
'react-router-dom'
import
{
compose
}
from
'redux'
import
{
getParam
,
http
,
browser
,
loadScript
,
getTimestamp
}
from
'@/utils'
import
{
Toast
}
from
'antd-mobile'
import
{
addDays
}
from
'date-fns'
import
stringify
from
'json-stringify-safe'
//拦截ajax请求,返回mock数据
...
...
@@ -118,18 +116,21 @@ class App extends Component {
componentDidUpdate
(
prevProps
,
prevState
)
{
this
.
setPreviousLocation
()
if
(
!
this
.
props
.
user
.
hasError
&&
getParam
(
'redirect'
))
{
const
{
user
,
noTraceValidation
:
{
isShowCaptcha
}}
=
this
.
props
if
(
!
user
.
hasError
&&
getParam
(
'redirect'
))
{
window
.
location
.
href
=
decodeURIComponent
(
getParam
(
'redirect'
))
}
const
{
noTraceValidation
:
{
isShowCaptcha
}}
=
this
.
props
if
(
prevProps
.
noTraceValidation
.
isShowCaptcha
!==
isShowCaptcha
&&
isShowCaptcha
)
{
typeof
nvcReset
===
'function'
&&
nvcReset
()
typeof
getNC
===
'function'
&&
getNC
().
then
(()
=>
{
_nvc_nc
.
reset
()
})
}
if
(
prevProps
.
user
.
isFetching
!==
user
.
isFetching
&&
!
user
.
isFetching
)
{
document
.
body
.
style
.
pointerEvents
=
'auto'
}
}
// 获取宝箱阶段
...
...
@@ -208,6 +209,7 @@ class App extends Component {
}
getUser
=
()
=>
{
document
.
body
.
style
.
pointerEvents
=
'none'
//获取用户信息
this
.
props
.
startFetchUser
()
...
...
@@ -215,7 +217,6 @@ class App extends Component {
let
code
=
getParam
(
'code'
)
let
oid
=
getParam
(
'oid'
)
if
(
code
&&
!
oid
)
{
this
.
props
.
startFetchValidationState
()
http
.
get
(
`
${
API
[
'passport-api'
]}
/m/wx_loginInfo/code/
${
code
}
?redirect=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
)
.
then
(
res
=>
{
let
data
=
res
.
data
...
...
@@ -224,7 +225,6 @@ class App extends Component {
this
.
props
.
updateCaptchaState
({
isNeedValidation
:
true
,
})
this
.
props
.
startFetchValidationState
()
this
.
setState
({
mkey
:
data
.
data
.
mkey
,
});
...
...
@@ -232,7 +232,7 @@ class App extends Component {
}
else
{
this
.
props
.
updateCaptchaState
({
isNeedValidation
:
false
,
isFetching
:
false
isFetching
:
false
,
})
if
(
data
.
data
[
'is_bind_mobile'
])
{
window
.
location
.
assign
(
data
.
data
.
url
)
...
...
@@ -243,7 +243,7 @@ class App extends Component {
}
else
{
this
.
props
.
updateCaptchaState
({
isNeedValidation
:
false
,
isFetching
:
false
isFetching
:
false
,
})
Toast
.
info
(
data
.
msg
)
this
.
props
.
setCurrentUser
(
initialState
)
...
...
@@ -319,7 +319,6 @@ class App extends Component {
this
.
handleLoginResponse
(
data
)
}
else
if
(
errno
===
5002
)
{
this
.
props
.
showCaptchaModal
()
this
.
props
.
endFetchValidationState
()
typeof
nvcReset
===
'function'
&&
nvcReset
()
typeof
getNC
===
'function'
&&
getNC
().
then
(()
=>
{
_nvc_nc
.
reset
()
...
...
@@ -328,7 +327,6 @@ class App extends Component {
Toast
.
info
(
msg
)
}
this
.
props
.
endFetchUser
()
this
.
props
.
endFetchValidationState
()
})
}
...
...
@@ -470,8 +468,6 @@ export default compose(
showCaptchaModal
,
validationPassed
,
endFetchUser
,
startFetchValidationState
,
endFetchValidationState
,
}),
withRouter
,
)(
App
)
src/components/activity/2020-717/invitation/index.js
View file @
4e1e48c5
...
...
@@ -96,9 +96,6 @@ class Invitation extends Component {
joinTeam
=
data
=>
{
const
{
user
,
history
,
noTraceValidation
,
showCaptchaModal
}
=
this
.
props
if
(
noTraceValidation
.
isFetching
)
{
return
}
if
(
noTraceValidation
.
isNeedValidation
)
{
!
noTraceValidation
.
isShowCaptcha
&&
showCaptchaModal
()
return
...
...
src/store/no-trace-validation/reducer.js
View file @
4e1e48c5
...
...
@@ -27,20 +27,9 @@ export const validationPassed = () => {
}
}
const
START_FETCHING
=
'START_FETCHING'
export
const
startFetchValidationState
=
()
=>
({
type
:
START_FETCHING
,
})
const
END_FETCHING
=
'END_FETCHING'
export
const
endFetchValidationState
=
()
=>
({
type
:
END_FETCHING
,
})
const
initialState
=
{
isShowCaptcha
:
false
,
isNeedValidation
:
false
,
isFetching
:
false
,
}
export
default
function
noTraceValidation
(
state
=
initialState
,
action
)
{
...
...
@@ -60,22 +49,12 @@ export default function noTraceValidation(state = initialState, action) {
...
state
,
...{
isShowCaptcha
:
false
},
}
case
START_FETCHING
:
return
{
...
state
,
isFetching
:
true
,
}
case
VALIDATION_PASSED
:
return
{
isNeedValidation
:
false
,
isShowCaptcha
:
false
,
isFetching
:
false
,
}
case
END_FETCHING
:
return
{
...
state
,
isFetching
:
false
,
}
default
:
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