feat: 添加一键登出全部按钮
This commit is contained in:
@@ -34,6 +34,13 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-popconfirm title="确定要登出所有虚拟用户吗?" @confirm="handleLogoutAll">
|
||||
<template #reference>
|
||||
<el-button size="small" type="info" :loading="logoutAllLoading">
|
||||
<el-icon><SwitchButton /></el-icon> 一键登出全部
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-tooltip content="从目标平台同步所有已登录用户的昵称/真实姓名/性别/头像" placement="top">
|
||||
<el-button size="small" type="info" :loading="syncLoading" @click="handleSyncAll">
|
||||
<el-icon><Refresh /></el-icon> 同步用户信息
|
||||
@@ -495,6 +502,7 @@ async function handleExport() {
|
||||
}
|
||||
|
||||
const loginAllLoading = ref(false)
|
||||
const logoutAllLoading = ref(false)
|
||||
|
||||
const syncLoading = ref(false)
|
||||
const avatarUploading = ref(false)
|
||||
@@ -521,6 +529,19 @@ async function handleAvatarUpload(file) {
|
||||
return false // 阻止 el-upload 默认上传
|
||||
}
|
||||
|
||||
async function handleLogoutAll() {
|
||||
logoutAllLoading.value = true
|
||||
try {
|
||||
const res = await request.post('/users/logout-all')
|
||||
ElMessage.success(res.message || '已登出所有用户')
|
||||
loadUsers()
|
||||
} catch(e) {
|
||||
ElMessage.error('登出失败:' + (e.message || '未知错误'))
|
||||
} finally {
|
||||
logoutAllLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSyncAll() {
|
||||
syncLoading.value = true
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user