Commit a11fded1 by zhanghaozhe

wx return

parent d866e55f
......@@ -45,14 +45,14 @@ class App extends Component {
sessionStorage.setItem('enter_url', window.location.href)
}
this.props.startFetchUser()
http.get(`${API.home}/m/user_info`).then(res => {
this.props.setCurrentUser(this.transformUser(res))
})
this.getUser()
const routeMatchRule = /binding-tel|forgot|set-password/
const {history} = this.props
history.listen(location => {
if(cookie.get('uid') && this.props.user.hasError){
this.getUser()
}
const {pathname} = location
if (pathname.startsWith('/passport')) {
if (routeMatchRule.test(pathname)) {
......@@ -63,6 +63,17 @@ class App extends Component {
})
}
getUser = () => {
this.props.startFetchUser()
http.get(`${API.home}/m/user_info`).then(res => {
this.props.setCurrentUser(this.transformUser(res))
})
//微信
let code = getParam('code')
......@@ -90,8 +101,6 @@ class App extends Component {
}
}
componentDidUpdate() {
......@@ -169,7 +178,7 @@ class App extends Component {
export default compose(
connect(
null,
state => ({user: state.user}),
{setCurrentUser, startFetchUser}
),
withRouter
......
import React, {Component} from 'react'
import './index.scss';
import {withRouter} from 'react-router-dom'
import {browser,getParam} from "@/utils";
class HeaderBar extends Component {
constructor(props) {
......@@ -8,6 +9,9 @@ class HeaderBar extends Component {
}
goBack = () => {
if(browser.isWeixin && getParam('code') && getParam('state')){
window.history.go(-2)
}
window.history.go(-1);
}
......
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