| | |
| | | <el-dropdown @command="handleCommand"> |
| | | <span class="user-info"> |
| | | <el-icon><User /></el-icon> |
| | | <span>管理员</span> |
| | | <span>{{ currentUserName }}</span> |
| | | <el-tag size="small" style="margin-left: 8px">{{ currentUserRole }}</el-tag> |
| | | <el-icon><ArrowDown /></el-icon> |
| | | </span> |
| | | <template #dropdown> |
| | |
| | | import { computed } from 'vue' |
| | | import { useRoute, useRouter } from 'vue-router' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { getCurrentUserDisplayName, getCurrentUserRoleText, clearAuth } from '@/utils/auth' |
| | | |
| | | const route = useRoute() |
| | | const router = useRouter() |
| | | |
| | | // 当前用户信息 |
| | | const currentUserName = computed(() => getCurrentUserDisplayName()) |
| | | const currentUserRole = computed(() => getCurrentUserRoleText()) |
| | | |
| | | // 菜单项 |
| | | const menuItems = [ |
| | |
| | | type: 'warning' |
| | | }) |
| | | |
| | | localStorage.removeItem('token') |
| | | clearAuth() |
| | | ElMessage.success('退出登录成功') |
| | | router.push('/login') |
| | | } catch { |