优化错误处理逻辑,增加用户不存在时的自动登出功能。更新阅读页内容解析,支持TipTap HTML格式,提升用户体验。

This commit is contained in:
Alex-larget
2026-03-10 14:32:20 +08:00
parent 3e22e54f75
commit e23eba5d3e
3 changed files with 109 additions and 30 deletions

View File

@@ -352,6 +352,11 @@ App({
// 业务失败success === falsesoul-api 用 message 或 error 返回原因
if (data && data.success === false) {
const msg = this._getApiErrorMsg(data, '操作失败')
// 登录态不一致:本地有 token/userInfo但后端查不到该用户
// 典型原因:切换环境(baseUrl)、换库/清库、用户被删除、token 与用户不匹配
if (msg && (msg.includes('用户不存在') || msg.toLowerCase().includes('user not found'))) {
this.logout()
}
showError(msg)
reject(new Error(msg))
return