feat: show login error message; add request timeout & network guard; silence NavigationDuplicated
CI/CD Deploy (Web) / 构建前端镜像并部署 (push) Successful in 29s

This commit is contained in:
张家训
2026-09-03 18:35:40 +08:00
parent 867647d2cd
commit 7d071218c2
4 changed files with 40 additions and 19 deletions
+10 -2
View File
@@ -47,7 +47,8 @@
'getUserInfo'
]),
handleSubmit({username, password}) {
var ip = returnCitySN["cip"]
// returnCitySN 由 index.html 引用的第三方脚本定义,可能加载失败,需兜底
var ip = (typeof returnCitySN !== 'undefined' && returnCitySN) ? returnCitySN["cip"] : ''
this.$refs.loginForm.loading = true
this.handleLogin({username, password, ip}).then(res => {
setTimeout(() => {
@@ -56,7 +57,14 @@
name: this.$config.homeName
})
}, 400)
}).catch(err => {
// 登录失败 / 后端不可用 / 请求超时统一在此提示,并复位按钮 loading
this.$refs.loginForm.loading = false
let msg = (err && err.message) ? err.message : ''
if (!msg || msg.indexOf('Network Error') > -1 || msg.indexOf('timeout') > -1 || msg.indexOf('ECONNABORTED') > -1) {
msg = '网络异常或服务不可用,请稍后重试'
}
this.$Message.error(msg)
})
}
}