fix(passport): 优化登录确认成功后的页面跳转逻辑

- 延长登录确认成功提示的显示时间至2000毫秒
- 跳转到用户页面前先隐藏toast,避免影响跳转体验
- 增加switchTab成功和失败的日志打印
- 失败时提示用户手动返回页面
- 调整跳转延迟时间为1800毫秒,提升交互流畅度
This commit is contained in:
2026-04-11 18:07:32 +08:00
parent e180d06780
commit 8bc7f76d93
2 changed files with 14 additions and 3 deletions

View File

View File

@@ -166,10 +166,21 @@ const QRConfirmPage: React.FC = () => {
});
if (res.data.success || res.data.status === 'confirmed') {
Taro.showToast({ title: '登录确认成功', icon: 'success', duration: 1500 });
Taro.showToast({ title: '登录确认成功', icon: 'success', duration: 2000 });
setTimeout(() => {
Taro.switchTab({ url: '/pages/user/user' });
}, 1500);
// 先隐藏 toast避免影响页面跳转
Taro.hideToast();
Taro.switchTab({
url: '/pages/user/user',
success: () => {
console.log('switchTab to /pages/user/user success');
},
fail: (err) => {
console.error('switchTab fail:', err);
Taro.showToast({ title: '页面跳转失败,请手动返回', icon: 'none' });
}
});
}, 1800);
} else {
Taro.showToast({ title: res.data.message || '登录确认失败', icon: 'none' });
}