Commit 5b6a3eca by zhanghaozhe

没有上级页面点击返回到首页

parent 004471bc
......@@ -43,7 +43,9 @@ class App extends Component {
script.src = 'https://s22.cnzz.com/z_stat.php?id=1265696973&web_id=1265696973';
script.language = 'JavaScript';
document.body.appendChild(script);
this.setNavigationRecord(this.props.location)
//平台信息
cookie.set('plat', '5', {domain: '.julyedu.com'})
......@@ -56,8 +58,9 @@ class App extends Component {
const routeMatchRule = /binding-tel|forgot|set-password/
const {history} = this.props
history.listen(location => {
if(cookie.get('uid') && this.props.user.hasError){
history.listen((location, action) => {
this.setNavigationRecord(location)
if (cookie.get('uid') && this.props.user.hasError) {
this.getUser()
}
const {pathname} = location
......@@ -70,9 +73,19 @@ class App extends Component {
})
}
setNavigationRecord = (location) => {
let {location: _location} = this.props
let {state: _state = {}} = _location
let {state = {}} = location
location.state = {
...state, ...{
record: _state.record ?
[..._state.record, {pathname: location.pathname}] :
[{pathname: location.pathname}]
}
}
}
getUser = () => {
......
......@@ -9,10 +9,15 @@ class HeaderBar extends Component {
}
goBack = () => {
const {state} = this.props.location
if(browser.isWeixin && getParam('code') && getParam('state')){
window.history.go(-2)
}
window.history.go(-1);
if(state.record && state.record.length > 1){
window.history.go(-1);
}else{
window.location.href = window.location.origin
}
}
toLink = () => {
......
.search-result {
padding-top: 44px;
/*&.fixed-header{
padding-top: 44px;
.search-head{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 10;
}
}
&.static-header{
padding-top: 0;
.search-head{
position: static;
}
}*/
.search-head{
position: absolute;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment