Commit 8f3ca978 by zhanghaozhe

login

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