减少登录等待时间。

This commit is contained in:
root 2026-02-07 14:24:08 +08:00
parent 75c3380ff3
commit 5ed553b2a0
2 changed files with 10 additions and 6 deletions

View File

@ -265,7 +265,7 @@ class AppServer:
def _initialize_devices(self): def _initialize_devices(self):
""" """
初始化设备在用户登录成功后调用
""" """
try: try:
self.logger.info('开始初始化设备...') self.logger.info('开始初始化设备...')

View File

@ -426,7 +426,6 @@ const handleRegisterSubmit = async () => {
// //
const handleLogin = async () => { const handleLogin = async () => {
isLoading.value = true
// //
if (!form.value.account) { if (!form.value.account) {
showError('请输入登录账号!') showError('请输入登录账号!')
@ -439,7 +438,9 @@ const handleLogin = async () => {
return return
} }
// 访32 isLoading.value = true
// 访3退200/400/800ms 1.4s
let healthOk = false let healthOk = false
for (let attempt = 1; attempt <= 3; attempt++) { for (let attempt = 1; attempt <= 3; attempt++) {
try { try {
@ -451,9 +452,11 @@ const handleLogin = async () => {
// healthy // healthy
if (attempt === 3) { if (attempt === 3) {
showError('后台服务异常,请稍后重试!') showError('后台服务异常,请稍后重试!')
isLoading.value = false
return return
} }
await new Promise(resolve => setTimeout(resolve, 2000)) const delay = 200 * Math.pow(2, attempt - 1)
await new Promise(resolve => setTimeout(resolve, delay))
} }
} catch (error) { } catch (error) {
// //
@ -462,7 +465,8 @@ const handleLogin = async () => {
isLoading.value = false isLoading.value = false
return return
} }
await new Promise(resolve => setTimeout(resolve, 2000)) const delay = 200 * Math.pow(2, attempt - 1)
await new Promise(resolve => setTimeout(resolve, delay))
} }
} }
@ -1210,4 +1214,4 @@ const copyPassword = async () => {
background: transparent; background: transparent;
} }
</style> </style>