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
e04c0207
Commit
e04c0207
authored
Sep 20, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'international-phone-number' into pre
# Conflicts: # src/App.js # src/components/passport/index.js
parents
5384eb98
cb2f3a7d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
17 deletions
+47
-17
src/App.js
+46
-16
src/common/HeaderBar/index.js
+1
-1
No files found.
src/App.js
View file @
e04c0207
...
@@ -37,6 +37,10 @@ class App extends Component {
...
@@ -37,6 +37,10 @@ class App extends Component {
...
this
.
props
.
location
...
this
.
props
.
location
}
}
records
=
[]
firstLoad
=
true
componentDidMount
()
{
componentDidMount
()
{
// 友盟统计
// 友盟统计
const
script
=
document
.
createElement
(
'script'
);
const
script
=
document
.
createElement
(
'script'
);
...
@@ -44,7 +48,7 @@ class App extends Component {
...
@@ -44,7 +48,7 @@ class App extends Component {
script
.
language
=
'JavaScript'
;
script
.
language
=
'JavaScript'
;
document
.
body
.
appendChild
(
script
);
document
.
body
.
appendChild
(
script
);
this
.
setNavigationRecord
(
this
.
props
.
location
)
this
.
setNavigationRecord
(
this
.
props
.
location
,
this
.
props
.
history
.
action
)
//平台信息
//平台信息
...
@@ -57,9 +61,10 @@ class App extends Component {
...
@@ -57,9 +61,10 @@ class App extends Component {
this
.
utm
()
this
.
utm
()
const
routeMatchRule
=
/binding-tel|forgot|set-password/
const
routeMatchRule
=
/binding-tel|forgot|set-password/
const
{
history
}
=
this
.
props
const
{
history
}
=
this
.
props
history
.
listen
((
location
)
=>
{
history
.
listen
((
location
,
action
)
=>
{
this
.
utm
()
this
.
utm
()
this
.
setNavigationRecord
(
location
)
this
.
firstLoad
=
false
this
.
setNavigationRecord
(
location
,
action
)
if
(
cookie
.
get
(
'uid'
)
&&
this
.
props
.
user
.
hasError
)
{
if
(
cookie
.
get
(
'uid'
)
&&
this
.
props
.
user
.
hasError
)
{
this
.
getUser
()
this
.
getUser
()
}
}
...
@@ -71,6 +76,7 @@ class App extends Component {
...
@@ -71,6 +76,7 @@ class App extends Component {
location
.
state
=
{
from
:
this
.
previousLocation
};
location
.
state
=
{
from
:
this
.
previousLocation
};
}
else
{
}
else
{
this
.
removeShareCodeCookie
()
this
.
removeShareCodeCookie
()
location
.
state
=
{...
location
.
state
,
...{
from
:
this
.
previousLocation
}};
}
}
})
})
...
@@ -81,17 +87,23 @@ class App extends Component {
...
@@ -81,17 +87,23 @@ class App extends Component {
cookie
.
remove
(
'share_code'
,
{
path
:
'/'
,
domain
:
'.julyedu.com'
})
cookie
.
remove
(
'share_code'
,
{
path
:
'/'
,
domain
:
'.julyedu.com'
})
}
}
setNavigationRecord
=
(
location
)
=>
{
setNavigationRecord
=
(
location
,
action
)
=>
{
let
{
location
:
_location
}
=
this
.
props
const
{
pathname
,
search
,
hash
}
=
location
let
{
state
:
_state
=
{}}
=
_location
let
isLastRecord
=
location
.
pathname
===
this
.
records
.
length
&&
this
.
records
[
this
.
records
.
length
-
1
].
pathname
let
{
state
=
{}}
=
location
switch
(
action
)
{
location
.
state
=
{
case
'POP'
:
...
state
,
...{
this
.
firstLoad
?
this
.
records
.
push
({
pathname
,
search
,
hash
})
:
this
.
records
.
pop
()
record
:
_state
.
record
?
break
[...
_state
.
record
,
{
pathname
:
location
.
pathname
,
search
:
location
.
search
,
hash
:
location
.
hash
}]
:
case
'REPLACE'
:
[{
pathname
:
location
.
pathname
,
search
:
''
,
hash
:
''
}]
this
.
records
[
this
.
records
.
length
-
1
]
=
{
pathname
,
search
,
hash
}
}
break
default
:
!
isLastRecord
&&
this
.
records
.
push
({
pathname
,
search
,
hash
})
}
}
location
.
state
&&
location
.
state
.
records
?
(
location
.
state
.
records
=
this
.
records
)
:
(
location
.
state
=
{
records
:
this
.
records
})
}
}
...
@@ -157,15 +169,33 @@ class App extends Component {
...
@@ -157,15 +169,33 @@ class App extends Component {
}
}
componentDidUpdate
()
{
componentDidUpdate
()
{
const
{
location
}
=
this
.
props
this
.
previousLocation
=
location
.
pathname
.
startsWith
(
'/passport'
)
?
this
.
setPreviousLocation
()
this
.
previousLocation
.
pathname
===
'/'
?
location
:
this
.
previousLocation
:
location
if
(
!
this
.
props
.
user
.
hasError
&&
getParam
(
'redirect'
))
{
if
(
!
this
.
props
.
user
.
hasError
&&
getParam
(
'redirect'
))
{
window
.
location
.
href
=
getParam
(
'redirect'
)
window
.
location
.
href
=
getParam
(
'redirect'
)
}
}
}
}
setPreviousLocation
=
()
=>
{
const
{
location
,
history
:
{
action
}}
=
this
.
props
if
(
location
.
pathname
.
startsWith
(
'/passport'
))
{
let
index
=
this
.
records
.
findIndex
(
item
=>
item
.
pathname
.
startsWith
(
'/passport'
))
this
.
previousLocation
=
index
>
0
?
this
.
records
[
index
-
1
]
:
this
.
records
.
length
?
this
.
records
[
this
.
records
.
length
-
1
]
:
null
}
else
{
if
(
action
===
'POP'
||
action
===
'REPLACE'
)
{
let
index
=
this
.
records
.
findIndex
(
item
=>
item
.
pathname
.
startsWith
(
'/passport'
))
this
.
previousLocation
=
index
>
0
?
this
.
records
[
index
-
1
]
:
this
.
records
[
this
.
records
.
length
-
1
]
}
else
{
this
.
previousLocation
=
location
}
}
}
transformUser
=
res
=>
{
transformUser
=
res
=>
{
let
payload
let
payload
...
...
src/common/HeaderBar/index.js
View file @
e04c0207
...
@@ -13,7 +13,7 @@ class HeaderBar extends Component {
...
@@ -13,7 +13,7 @@ class HeaderBar extends Component {
if
(
browser
.
isWeixin
&&
getParam
(
'code'
)
&&
getParam
(
'state'
)){
if
(
browser
.
isWeixin
&&
getParam
(
'code'
)
&&
getParam
(
'state'
)){
window
.
history
.
go
(
-
2
)
window
.
history
.
go
(
-
2
)
}
}
if
(
state
.
record
&&
state
.
record
.
length
>
1
){
if
(
state
.
record
s
&&
state
.
records
.
length
>
1
){
window
.
history
.
go
(
-
1
);
window
.
history
.
go
(
-
1
);
}
else
{
}
else
{
window
.
location
.
href
=
window
.
location
.
origin
window
.
location
.
href
=
window
.
location
.
origin
...
...
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