This commit is contained in:
浅念
2026-01-13 15:10:33 +08:00
parent f768835f15
commit 56f09c263f
19 changed files with 3253 additions and 910 deletions
+18 -4
View File
@@ -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() {