| | |
| | | import { computed } from 'vue' |
| | | import { useRouter } from 'vue-router' |
| | | import { House, Calendar, User, Document, UserFilled, Files, TrendCharts, Picture, Location, Avatar, ArrowDown } from '@element-plus/icons-vue' |
| | | import { clearAuth, getCurrentUserDisplayName } from '@/utils/auth' |
| | | |
| | | const router = useRouter() |
| | | |
| | | const userInfo = computed(() => ({ |
| | | name: '管理员' |
| | | })) |
| | | |
| | | const currentUserName = computed(() => userInfo.value.name || '用户') |
| | | const currentUserName = computed(() => getCurrentUserDisplayName()) |
| | | |
| | | const handleCommand = (command: string) => { |
| | | switch (command) { |
| | |
| | | router.push('/profile') |
| | | break |
| | | case 'logout': |
| | | localStorage.removeItem('token') |
| | | // 清除所有认证数据 |
| | | clearAuth() |
| | | // 跳转到登录页面 |
| | | router.push('/login') |
| | | break |
| | | } |