fix(member): 修复退出登录后可返回旧页面的问题

1.  退出登录和注销流程兜底分支都改用reLaunch跳转登录页,清空页面栈防止返回旧会员页
2.  新增完整的单元测试覆盖logout和getCancelStatus的异常分支、调用顺序和跳转模式
This commit is contained in:
2026-07-23 15:17:08 +08:00
parent b9cb6bf75b
commit acbac773db
2 changed files with 172 additions and 2 deletions

View File

@@ -17,7 +17,8 @@ export default {
success: (res) => {
if (res.confirm) {
this.clearLoginState();
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
// 使用 reLaunch 清空页面栈,避免通过标题栏/导航栏返回到会员中心等历史页面
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {}, 'reLaunch');
}
}
});
@@ -51,7 +52,8 @@ export default {
}
} else if (res.code == -1) {
this.clearLoginState();
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
// 使用 reLaunch 清空页面栈,避免通过标题栏/导航栏返回到注销流程的历史页面
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {}, 'reLaunch');
}
}
});