fix(frontend): 退出登录增加原生确认兜底,修复点击无响应
This commit is contained in:
@@ -137,16 +137,26 @@ function badgeFor(item) {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
try {
|
||||
await api.post('/logout')
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user