Commit 4da7d06e by zhanghaozhe

bug

parent 93d8d984
......@@ -42,7 +42,7 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
}
// Tools like Cloud9 rely on this.
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 80;
const HOST = process.env.HOST || '0.0.0.0';
if (process.env.HOST) {
......
......@@ -54,7 +54,7 @@ class App extends Component {
jsCookie.set('role', role, expires)
jsCookie.set('uid', uid, expires)
jsCookie.set('token', token, expires)
this.props.receiveUser(user)
this.props.setCurrentUser(user)
}
} else {
Toast.info(data.msg)
......
......@@ -8,8 +8,8 @@ import AccountLogin from './accountLogin'
import ForgotPassword from './forgotPassword'
import SetPassword from './setPassword'
import BindingTel from './bindingTel'
import {connect} from "react-redux";
import {compose} from "redux";
import { connect } from "react-redux";
import { compose } from "redux";
import account from './account.png'
import qq from './qq.png'
......@@ -48,6 +48,25 @@ class Passport extends Component {
}
}
componentDidMount() {
this.routeWhenUserLoggedIn()
}
componentDidUpdate() {
this.routeWhenUserLoggedIn()
}
routeWhenUserLoggedIn = () => {
let {history} = this.props
if (Object.values(this.props.user.data).filter(item => !!item).length) {
history.action === 'POP' && history.go(-1)
}
}
render() {
let {match, location} = this.props
return (
......
......@@ -17,13 +17,17 @@ function Loading(props) {
return
}
if (!isLoading) {
return
}
if (!user.isFetching) {
if (user.hasError) {
history.push('/passport', {from: location})
history.replace('/passport', {from: location})
setLoadingState(false)
} else {
if (Object.values(user.data).every(item => !!item).length !== 0) {
history.push(location.pathname)
history.replace(location.pathname)
setLoadingState(false)
}
}
......@@ -32,7 +36,9 @@ function Loading(props) {
return (
<div className={'loading-route'}>
<LoadingComponent isLoading={isLoading}/>
<LoadingComponent isLoading={isLoading}>
<div></div>
</LoadingComponent>
</div>
);
}
......
......@@ -12,7 +12,7 @@ module.exports = function (app) {
pathRewrite: {
[`^${config[item]['development']}`]: ''
},
cookieDomainRewrite: 'localhost',
// cookieDomainRewrite: 'localhost',
...config[item]['proxy']
}
))
......
......@@ -33,7 +33,8 @@ const storeUser = (res, dispatch) => {
} else {
payload = {
hasError: true,
msg: data.msg
msg: data.msg,
data: {}
}
}
dispatch(setCurrentUser(payload))
......
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