|
|
|
@ -99,9 +99,7 @@ |
|
|
|
this.customId = option.customId |
|
|
|
} |
|
|
|
if (uni.getStorageSync('hiver_token')) { |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/index/index' |
|
|
|
}) |
|
|
|
this.goAfterLogin(false) |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -127,7 +125,7 @@ |
|
|
|
that.loginLoading = false |
|
|
|
if (res.code == 200) { |
|
|
|
that.saveLoginResult(res.result) |
|
|
|
if (!res.result.user || res.result.user.mobile == null || res.result.user.mobile === '') { |
|
|
|
if (!res.result || !res.result.user || res.result.user.mobile == null || res.result.user.mobile === '') { |
|
|
|
that.needPhoneAuth = true |
|
|
|
that.tui.toast('绑定手机号,解锁完整半径') |
|
|
|
} else { |
|
|
|
@ -219,18 +217,42 @@ |
|
|
|
enterHome() { |
|
|
|
this.tui.toast('登录成功', 2000, true) |
|
|
|
setTimeout(() => { |
|
|
|
const pendingPath = this.redirectKey ? uni.getStorageSync(this.redirectKey) : '' |
|
|
|
if (pendingPath) { |
|
|
|
this.goAfterLogin(true) |
|
|
|
}, 200) |
|
|
|
}, |
|
|
|
goAfterLogin(clearRedirect) { |
|
|
|
const pendingPath = this.redirectKey ? uni.getStorageSync(this.redirectKey) : '' |
|
|
|
const targetUrl = pendingPath || '/pages/index/index' |
|
|
|
const done = () => { |
|
|
|
if (clearRedirect && pendingPath) { |
|
|
|
uni.removeStorageSync(this.redirectKey) |
|
|
|
uni.redirectTo({ |
|
|
|
url: pendingPath |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
const fallbackHome = () => { |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/index/index' |
|
|
|
url: '/pages/index/index', |
|
|
|
success: done, |
|
|
|
fail: () => { |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/index/index', |
|
|
|
success: done |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, 200) |
|
|
|
} |
|
|
|
if (targetUrl.indexOf('/pages/index/index') === 0 || targetUrl.indexOf('pages/index/index') === 0) { |
|
|
|
uni.reLaunch({ |
|
|
|
url: targetUrl, |
|
|
|
success: done, |
|
|
|
fail: fallbackHome |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
uni.redirectTo({ |
|
|
|
url: targetUrl, |
|
|
|
success: done, |
|
|
|
fail: fallbackHome |
|
|
|
}) |
|
|
|
}, |
|
|
|
protocol(num) { |
|
|
|
uni.navigateTo({ |
|
|
|
|