Commit 39c074c4 by zhanghaozhe

微博登录绑定手机号

parent 27c875f8
...@@ -63,6 +63,9 @@ class App extends Component { ...@@ -63,6 +63,9 @@ 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'){
window.localStorage.setItem('binding_redirect', JSON.stringify(this.previousLocation))
}
const {pathname, state} = location const {pathname, state} = location
if (pathname.startsWith('/passport')) { if (pathname.startsWith('/passport')) {
location.state = { location.state = {
......
...@@ -127,9 +127,10 @@ const formikConfig = { ...@@ -127,9 +127,10 @@ const formikConfig = {
plat: 5 plat: 5
}).then(res => { }).then(res => {
const data = res.data const data = res.data
if (data.errno == 200) { if (data.errno == 200) {
if (data.data['is_set_pwd']) { if (data.data['is_set_pwd']) {
props.history.replace(`/passport/set-password`, { const {history} = props
history.replace(`/passport/set-password`, {
user: { user: {
hasError: false, hasError: false,
data: { data: {
......
...@@ -122,10 +122,17 @@ function bindMobileSetPassword(values, props) { ...@@ -122,10 +122,17 @@ function bindMobileSetPassword(values, props) {
}) })
.then(res => { .then(res => {
if (res.data.errno == 200) { if (res.data.errno == 200) {
const {location, history} = props
Toast.info('密码设置成功') Toast.info('密码设置成功')
let from = props.location.state && props.location.state.from || {pathname: '/'} let from = location.state && location.state.from || {pathname: '/'}
let local_redirect_url = JSON.parse(window.localStorage.getItem('binding_redirect'))
setTimeout(function () { setTimeout(function () {
props.history.replace(from.pathname) if (local_redirect_url) {
const {pathname, search, hash} = local_redirect_url
history.replace(pathname + search + hash)
} else {
history.replace(from.pathname)
}
}, 1000) }, 1000)
} else { } else {
Toast.info(res.data.msg, 2, null, false) Toast.info(res.data.msg, 2, null, false)
......
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