fix: friendly Chinese error messages on login/register pages
Map backend English error details to user-facing Chinese text on all 3 frontends (uni-app, user-frontend, admin-frontend). Previously raw English like 'Invalid credentials' was shown directly to users.
This commit is contained in:
@@ -90,7 +90,8 @@ async function submit() {
|
||||
localStorage.setItem('admin_user', JSON.stringify(res.user || {}))
|
||||
ElMessage.success('登录成功')
|
||||
} catch (e) {
|
||||
error.value = e?.detail || '登录失败'
|
||||
const map = { 'Invalid credentials': '用户名或密码错误' }
|
||||
error.value = map[e?.detail] || e?.detail || '登录失败'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ async function submit() {
|
||||
const redirect = route.query.redirect || '/dashboard'
|
||||
router.push(redirect)
|
||||
} catch (e) {
|
||||
error.value = e?.detail || '登录失败'
|
||||
const map = { 'Invalid credentials': '用户名或密码错误' }
|
||||
error.value = map[e?.detail] || e?.detail || '登录失败'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user