修改
This commit is contained in:
@@ -44,6 +44,15 @@
|
||||
this.startDots()
|
||||
// #ifdef H5
|
||||
this._code = options.code || ''
|
||||
// 支持从回调参数里带 redirect(有些场景会拼到回调地址上)
|
||||
const redirect = options.redirect || options.r || ''
|
||||
if (redirect) {
|
||||
try {
|
||||
uni.setStorageSync('post_login_redirect', decodeURIComponent(redirect))
|
||||
} catch (e) {
|
||||
uni.setStorageSync('post_login_redirect', redirect)
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
if (!this._code) {
|
||||
@@ -94,19 +103,24 @@
|
||||
uni.setStorageSync('token', token)
|
||||
|
||||
this.title = '登录成功'
|
||||
this.desc = '正在进入首页'
|
||||
this.desc = '正在进入页面'
|
||||
|
||||
this.goHomeSmooth()
|
||||
this.goRedirectSmooth()
|
||||
} catch (err) {
|
||||
console.error('[feishu callback] error:', err)
|
||||
this.fail(err?.message || '登录失败')
|
||||
}
|
||||
},
|
||||
goHomeSmooth() {
|
||||
getRedirectTarget() {
|
||||
return uni.getStorageSync('post_login_redirect') || '/pages/index/index'
|
||||
},
|
||||
goRedirectSmooth() {
|
||||
const elapsed = Date.now() - this._startedAt
|
||||
const wait = Math.max(0, this.minStayMs - elapsed)
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/index/index' })
|
||||
const target = this.getRedirectTarget()
|
||||
uni.removeStorageSync('post_login_redirect')
|
||||
uni.reLaunch({ url: target })
|
||||
}, wait)
|
||||
},
|
||||
retry() {
|
||||
|
||||
Reference in New Issue
Block a user