lrj
3 天以前 7ba080d35812e6db7bd5aa8f88161c02653eb6c1
web/src/layout/index.vue
@@ -33,7 +33,8 @@
          <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>
@@ -58,9 +59,14 @@
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 = [
@@ -90,7 +96,7 @@
        type: 'warning'
      })
      
      localStorage.removeItem('token')
      clearAuth()
      ElMessage.success('退出登录成功')
      router.push('/login')
    } catch {