fix(frontend): 退出登录增加原生确认兜底,修复点击无响应

This commit is contained in:
2026-02-16 00:45:10 +08:00
parent 8c0403e0ff
commit 14b506e8a1
27 changed files with 84 additions and 64 deletions

View File

@@ -167,16 +167,26 @@ async function go(path) {
}
async function logout() {
let confirmed = false
try {
await ElMessageBox.confirm('确定退出登录吗?', '退出登录', {
confirmButtonText: '退出',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
confirmed = true
} catch (error) {
const reason = String(error || '').toLowerCase()
if (reason === 'cancel' || reason === 'close') return
try {
confirmed = window.confirm('确定退出登录吗?')
} catch {
confirmed = false
}
}
if (!confirmed) return
await userStore.logout()
window.location.href = '/login'
}