优化了后台界面最上方无用区域

This commit is contained in:
yml
2026-06-18 01:40:44 +08:00
parent 7dc7368367
commit 2223665b14
+101 -66
View File
@@ -217,6 +217,11 @@ const defaultOpeneds = computed(() => {
}) })
const adminName = computed(() => adminSession.nickname || adminSession.username || '管理员') const adminName = computed(() => adminSession.nickname || adminSession.username || '管理员')
const adminRoleText = computed(() => {
if (adminSession.isSuperAdmin) return '超级管理员'
const names = adminSession.roles.map(role => role.name).filter(Boolean)
return names.join(' / ') || '管理员'
})
const supportStatus = computed(() => adminSession.supportStatus || 'offline') const supportStatus = computed(() => adminSession.supportStatus || 'offline')
const hasChatPermission = computed(() => adminSession.hasPermission('chat:view')) const hasChatPermission = computed(() => adminSession.hasPermission('chat:view'))
@@ -330,29 +335,20 @@ async function handleForcedPasswordChange() {
</el-menu-item> </el-menu-item>
</el-sub-menu> </el-sub-menu>
</el-menu> </el-menu>
</aside>
<section class="admin-workspace"> <div class="admin-sidebar-footer">
<header class="admin-topbar">
<div class="topbar-left">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: ADMIN_DASHBOARD_PATH }">首页</el-breadcrumb-item>
<el-breadcrumb-item v-if="route.meta.title">{{ route.meta.title }}</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="topbar-right">
<el-dropdown <el-dropdown
v-if="hasChatPermission" v-if="hasChatPermission"
trigger="click" trigger="click"
@command="handleStatusChange" @command="handleStatusChange"
:disabled="updatingStatus" :disabled="updatingStatus"
> >
<span class="status-badge" :style="{ borderColor: statusColors[supportStatus] }"> <span class="sidebar-status" :style="{ borderColor: statusColors[supportStatus] }">
<span <span
class="status-dot" class="status-dot"
:style="{ backgroundColor: statusColors[supportStatus] }" :style="{ backgroundColor: statusColors[supportStatus] }"
></span> ></span>
<span class="status-text">{{ statusLabels[supportStatus] }}</span> <span v-show="!isCollapsed" class="status-text">{{ statusLabels[supportStatus] }}</span>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
@@ -372,9 +368,12 @@ async function handleForcedPasswordChange() {
</template> </template>
</el-dropdown> </el-dropdown>
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<span class="user-info"> <span class="sidebar-user">
<el-avatar :size="32" :icon="User" /> <el-avatar :size="32" :icon="User" />
<span class="username">{{ adminName }}</span> <span v-show="!isCollapsed" class="sidebar-user-text">
<strong>{{ adminName }}</strong>
<small>{{ adminRoleText }}</small>
</span>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
@@ -385,7 +384,9 @@ async function handleForcedPasswordChange() {
</template> </template>
</el-dropdown> </el-dropdown>
</div> </div>
</header> </aside>
<section class="admin-workspace">
<main class="admin-main"> <main class="admin-main">
<slot /> <slot />
</main> </main>
@@ -523,6 +524,89 @@ async function handleForcedPasswordChange() {
overflow-x: hidden; overflow-x: hidden;
} }
.admin-sidebar-footer {
display: grid;
flex: none;
gap: 10px;
padding: 12px;
border-top: 1px solid #3d4e5f;
background: rgba(16, 24, 39, 0.18);
}
.admin-shell--collapsed .admin-sidebar-footer {
padding: 10px 8px;
}
.sidebar-status {
display: flex;
align-items: center;
justify-content: center;
gap: 7px;
width: 100%;
min-height: 30px;
padding: 0 10px;
border: 1px solid;
border-radius: 8px;
color: #d7dfec;
cursor: pointer;
transition:
background-color 0.2s,
border-color 0.2s;
}
.sidebar-status:hover {
background-color: rgba(255, 255, 255, 0.08);
}
.admin-shell--collapsed .sidebar-status {
padding: 0;
}
.sidebar-user {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
width: 100%;
padding: 8px;
border-radius: 10px;
cursor: pointer;
transition: background-color 0.2s;
}
.sidebar-user:hover {
background-color: rgba(255, 255, 255, 0.08);
}
.admin-shell--collapsed .sidebar-user {
justify-content: center;
padding: 8px 0;
}
.sidebar-user-text {
display: grid;
min-width: 0;
gap: 2px;
}
.sidebar-user-text strong {
overflow: hidden;
color: #fff;
font-size: 13px;
line-height: 18px;
text-overflow: ellipsis;
white-space: nowrap;
}
.sidebar-user-text small {
overflow: hidden;
color: #8fa0ba;
font-size: 12px;
line-height: 16px;
text-overflow: ellipsis;
white-space: nowrap;
}
.admin-menu:not(.el-menu--collapse) { .admin-menu:not(.el-menu--collapse) {
width: 100%; width: 100%;
} }
@@ -603,43 +687,6 @@ async function handleForcedPasswordChange() {
overflow: hidden; overflow: hidden;
} }
.admin-topbar {
height: 56px;
flex: none;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
background-color: #fff;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.topbar-left {
display: flex;
align-items: center;
}
.topbar-right {
display: flex;
align-items: center;
gap: 16px;
}
.status-badge {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
border: 1px solid;
border-radius: 16px;
cursor: pointer;
transition: all 0.2s;
}
.status-badge:hover {
background-color: #f5f7fa;
}
.status-dot { .status-dot {
width: 8px; width: 8px;
height: 8px; height: 8px;
@@ -649,7 +696,7 @@ async function handleForcedPasswordChange() {
.status-text { .status-text {
font-size: 13px; font-size: 13px;
color: #606266; color: inherit;
font-weight: 500; font-weight: 500;
} }
@@ -657,22 +704,10 @@ async function handleForcedPasswordChange() {
margin-right: 8px; margin-right: 8px;
} }
.user-info {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
color: #606266;
}
.username {
font-size: 14px;
}
.admin-main { .admin-main {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
padding: 24px; padding: 18px 24px 24px;
overflow-y: auto; overflow-y: auto;
} }