fix(login): 修复登录错误处理并统一后端异常抛出

- 前端登录失败时添加错误处理标识检查,避免重复显示错误消息
- 后端服务层统一使用BusinessException替代RuntimeException
- 用户注册时用户名、邮箱、密码验证失败统一抛出业务异常
- 用户登录时用户名密码错误、账号禁用情况统一抛出业务异常
- 用户查询、更新、删除操作时用户不存在情况统一抛出业务异常
- 密码修改时旧密码错误、密码不一致情况统一抛出业务异常
This commit is contained in:
ikmkj
2026-03-11 00:05:46 +08:00
parent efccff567a
commit b29cc352cc
2 changed files with 21 additions and 18 deletions

View File

@@ -81,7 +81,9 @@ const handleLogin = () => {
}
} catch (error) {
console.error('登录失败:', error)
ElMessage.error(error.message || '登录失败,请检查用户名和密码')
if (!error.__handled) {
ElMessage.error(error.message || '登录失败,请检查用户名和密码')
}
} finally {
loading.value = false
}