Commit 8dc770b7 by zhanghaozhe

进入课程详情页返回首页

parent e55f224e
...@@ -63,7 +63,7 @@ class App extends Component { ...@@ -63,7 +63,7 @@ class App extends Component {
if (cookie.get('uid') && this.props.user.hasError) { if (cookie.get('uid') && this.props.user.hasError) {
this.getUser() this.getUser()
} }
if(location.pathname==='/passport'){ if (location.pathname === '/passport') {
window.localStorage.setItem('binding_redirect', JSON.stringify(this.previousLocation)) window.localStorage.setItem('binding_redirect', JSON.stringify(this.previousLocation))
} }
const {pathname, state} = location const {pathname, state} = location
...@@ -101,10 +101,15 @@ class App extends Component { ...@@ -101,10 +101,15 @@ class App extends Component {
setNavigationRecord = (location, action) => { setNavigationRecord = (location, action) => {
const {pathname, search, hash} = location const {pathname, search, hash} = location
let isLastRecord = location.pathname === (this.records.length && this.records[this.records.length - 1].pathname) let isLastRecord = location.pathname === (this.records.length && this.records[this.records.length - 1].pathname)
let needHistoryMutation = location.pathname !== this.previousLocation.pathname
switch (action) { switch (action) {
case 'POP': case 'POP':
if (needHistoryMutation) {
this.firstLoad ? this.records.push({pathname, search, hash}) : this.records.pop() this.firstLoad ? this.records.push({pathname, search, hash}) : this.records.pop()
} else {
this.records[this.records.length - 1] = location
}
break break
case 'REPLACE': case 'REPLACE':
this.records.length > 1 && (this.records[this.records.length - 1] = {pathname, search, hash}) this.records.length > 1 && (this.records[this.records.length - 1] = {pathname, search, hash})
...@@ -159,7 +164,7 @@ class App extends Component { ...@@ -159,7 +164,7 @@ class App extends Component {
//针对2019双旦活动特殊处理,活动结束后删掉 //针对2019双旦活动特殊处理,活动结束后删掉
//treasure_code=3538333139312c31&origin=2&aa=bb&code=0211aiYB1VVOL60rmWWB1367YB11aiY7&state=STATE //treasure_code=3538333139312c31&origin=2&aa=bb&code=0211aiYB1VVOL60rmWWB1367YB11aiY7&state=STATE
if(getParam('treasure_code') == '3538333139312c31' && code == '0211aiYB1VVOL60rmWWB1367YB11aiY7'){ if (getParam('treasure_code') == '3538333139312c31' && code == '0211aiYB1VVOL60rmWWB1367YB11aiY7') {
return return
} }
......
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