Commit 8f3ca978 by zhanghaozhe

login

parent 7e96afe2
......@@ -15,6 +15,7 @@ import account from './account.png'
import qq from './qq.png'
import sina from './sina.png'
import wechat from './wechat.png'
import { getParam } from "@/utils";
class Passport extends Component {
......@@ -59,8 +60,6 @@ class Passport extends Component {
componentDidUpdate() {
this.routeWhenUserLoggedIn()
// console.log(this.props.location);
}
......@@ -72,8 +71,8 @@ class Passport extends Component {
history.push('/')
} else {
const { from } = location.state || {from: {pathname: '/', search: ''}};
history.replace(from);
// history.go(-1)
const redirectURI = getParam('redirect')
redirectURI ? (window.location.href = redirectURI) : history.replace(from);
}
}
}
......
......@@ -12,7 +12,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import { isEmpty } from 'lodash'
import { Toast } from 'antd-mobile';
import { validateTel } from "@/utils";
import { validateTel, getParam } from "@/utils";
import { HeaderBar } from "@/common";
......@@ -27,13 +27,17 @@ class Login extends Component {
const item = loginWays.find(item => item.text === method)
let {from} = location.state || {from: {pathname: '/', search: '', hash: ''}};
console.log(location);
console.log(from);
let from = location.state && location.state.from || {
from: {
pathname: '/',
search: window.location.search,
hash: ''
}
};
const redirectURI = window.location.origin + from.pathname + from.search + from.hash;
switch (method) {
case '账号登录':
history.push('/passport/account-login', location.state)
history.push({pathname: '/passport/account-login', search: window.location.search}, location.state)
break;
case '微信':
window.location.assign(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=${encodeURIComponent(redirectURI)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`)
......
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