Commit 39c074c4 by zhanghaozhe

微博登录绑定手机号

parent 27c875f8
......@@ -63,6 +63,9 @@ class App extends Component {
if (cookie.get('uid') && this.props.user.hasError) {
this.getUser()
}
if(location.pathname==='/passport'){
window.localStorage.setItem('binding_redirect', JSON.stringify(this.previousLocation))
}
const {pathname, state} = location
if (pathname.startsWith('/passport')) {
location.state = {
......
......@@ -127,9 +127,10 @@ const formikConfig = {
plat: 5
}).then(res => {
const data = res.data
if (data.errno == 200) {
if (data.errno == 200) {
if (data.data['is_set_pwd']) {
props.history.replace(`/passport/set-password`, {
const {history} = props
history.replace(`/passport/set-password`, {
user: {
hasError: false,
data: {
......
......@@ -122,10 +122,17 @@ function bindMobileSetPassword(values, props) {
})
.then(res => {
if (res.data.errno == 200) {
const {location, history} = props
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 () {
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)
} else {
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