优化Salon后台侧边栏视觉
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
<template>
|
||||
<div class="admin-layout">
|
||||
<div
|
||||
class="admin-layout"
|
||||
:class="{
|
||||
'admin-layout--mobile': isMobile,
|
||||
'admin-layout--collapsed': collapsed && !isMobile
|
||||
}"
|
||||
>
|
||||
<a-layout>
|
||||
<a-layout-sider v-if="!isMobile" v-model:collapsed="collapsed" :trigger="null" collapsible class="sider" :width="236" :collapsed-width="76">
|
||||
<div class="logo"><span class="logo-mark">S</span><strong v-if="!collapsed">Salon</strong></div>
|
||||
<a-layout-sider v-if="!isMobile" v-model:collapsed="collapsed" :trigger="null" collapsible class="sider" :width="224" :collapsed-width="74">
|
||||
<div class="logo">
|
||||
<span class="logo-mark">S</span>
|
||||
<strong v-if="!collapsed">Salon</strong>
|
||||
</div>
|
||||
<div v-if="!collapsed" class="sider-section-label">工作台</div>
|
||||
<a-menu :selectedKeys="selectedKeys" mode="inline" theme="dark" @click="handleMenuClick">
|
||||
<a-menu-item v-for="item in menuItems" :key="item.key">
|
||||
<template #icon><component :is="item.icon" /></template>
|
||||
@@ -15,7 +25,7 @@
|
||||
<a-layout-header class="header">
|
||||
<div class="header-shell">
|
||||
<div class="header-left">
|
||||
<button v-if="!isMobile" class="trigger" type="button" aria-label="收起导航" @click="collapsed = !collapsed">
|
||||
<button v-if="!isMobile" class="trigger" type="button" :aria-label="collapsed ? '展开导航' : '收起导航'" @click="collapsed = !collapsed">
|
||||
<MenuUnfoldOutlined v-if="collapsed" /><MenuFoldOutlined v-else />
|
||||
</button>
|
||||
<button v-else class="trigger" type="button" aria-label="打开导航" @click="mobileDrawerOpen = true"><MenuOutlined /></button>
|
||||
@@ -40,12 +50,25 @@
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
|
||||
<a-drawer v-if="isMobile" v-model:open="mobileDrawerOpen" placement="left" :width="300" :closable="false">
|
||||
<div class="drawer-brand"><span class="logo-mark">S</span><strong>Salon 管理后台</strong></div>
|
||||
<a-menu :selectedKeys="selectedKeys" mode="inline" @click="openMobileMenu">
|
||||
<a-drawer v-if="isMobile" v-model:open="mobileDrawerOpen" placement="left" :width="300" :closable="false" class="mobile-drawer" root-class-name="admin-mobile-drawer">
|
||||
<div class="drawer-brand">
|
||||
<span class="logo-mark">S</span>
|
||||
<div class="drawer-brand__copy">
|
||||
<strong>Salon</strong>
|
||||
<span>平台管理后台</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drawer-section-label">工作台</div>
|
||||
<a-menu :selectedKeys="selectedKeys" mode="inline" theme="dark" @click="openMobileMenu">
|
||||
<a-menu-item v-for="item in menuItems" :key="item.key"><template #icon><component :is="item.icon" /></template>{{ item.label }}</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button danger block class="drawer-logout" @click="handleLogout">退出登录</a-button>
|
||||
<div class="drawer-footer">
|
||||
<a-avatar :size="34" :src="userInfo?.avatar || DEFAULT_AVATAR" />
|
||||
<span class="drawer-footer__name">{{ userInfo?.nickname || '平台管理员' }}</span>
|
||||
<a-button class="drawer-logout" aria-label="退出登录" title="退出登录" @click="handleLogout">
|
||||
<LogoutOutlined />
|
||||
</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
@@ -54,7 +77,7 @@
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { DownOutlined, HomeOutlined, MenuFoldOutlined, MenuOutlined, MenuUnfoldOutlined, SafetyCertificateOutlined, TeamOutlined, ToolOutlined, UserOutlined } from '@ant-design/icons-vue'
|
||||
import { DownOutlined, HomeOutlined, LogoutOutlined, MenuFoldOutlined, MenuOutlined, MenuUnfoldOutlined, SafetyCertificateOutlined, TeamOutlined, ToolOutlined, UserOutlined } from '@ant-design/icons-vue'
|
||||
import type { Component } from 'vue'
|
||||
import { adminNavigationItems, type AdminNavIconKey } from '@/config/admin-navigation'
|
||||
import { DEFAULT_AVATAR } from '@/constants'
|
||||
@@ -83,22 +106,344 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.admin-layout { min-height: 100vh; background: var(--theme-page-bg); }
|
||||
.sider { position: fixed; inset: 0 auto 0 0; z-index: 10; overflow: auto; background: #173f3b; }
|
||||
.logo, .drawer-brand { display: flex; align-items: center; gap: 10px; height: 72px; padding: 0 22px; color: #fff; font-size: 18px; letter-spacing: .02em; }
|
||||
.logo-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #5bc3a7; color: #17423c; font-weight: 900; }
|
||||
.header { position: sticky; top: 0; z-index: 8; height: 72px; padding: 0 28px; background: rgba(255, 255, 255, .88); border-bottom: 1px solid var(--admin-mobile-border); backdrop-filter: blur(12px); }
|
||||
.header-shell { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 20px; }
|
||||
.header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
|
||||
.trigger { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: #54736e; cursor: pointer; font-size: 18px; }
|
||||
.trigger:hover { background: #e7f5f0; color: #218d78; }
|
||||
.header-title { display: grid; gap: 3px; color: #224d47; }
|
||||
.header-title span { font-size: 15px; font-weight: 800; }
|
||||
.header-title small { color: #89a09b; font-size: 11px; }
|
||||
.user-dropdown { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; color: #315650; cursor: pointer; font-weight: 700; }
|
||||
.content { min-height: calc(100vh - 72px); padding: 30px clamp(20px, 4vw, 54px); }
|
||||
.content :deep(.ant-table) { table-layout: auto; width: max-content; min-width: 100%; }
|
||||
.content :deep(.ant-table-cell) { word-break: keep-all; }
|
||||
.drawer-logout { margin-top: 28px; }
|
||||
@media (max-width: 760px) { .header { padding: 0 16px; } .header-title small { display: none; } .content { padding: 18px 14px 28px; } }
|
||||
.admin-layout {
|
||||
min-height: 100vh;
|
||||
--admin-sider-width: 224px;
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.admin-layout--collapsed {
|
||||
--admin-sider-width: 74px;
|
||||
}
|
||||
|
||||
.admin-layout--mobile {
|
||||
--admin-sider-width: 0px;
|
||||
width: 100%;
|
||||
max-width: 100vw;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.sider {
|
||||
position: fixed;
|
||||
inset: 0 auto 0 0;
|
||||
z-index: 1000;
|
||||
height: 100vh;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
background: linear-gradient(
|
||||
165deg,
|
||||
var(--admin-mobile-shell-start) 0%,
|
||||
var(--admin-mobile-shell-mid) 56%,
|
||||
var(--admin-mobile-shell-end) 100%
|
||||
);
|
||||
transition: width 0.22s ease;
|
||||
}
|
||||
|
||||
.logo,
|
||||
.drawer-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
height: 68px;
|
||||
padding: 0 14px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.logo strong,
|
||||
.drawer-brand__copy strong {
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
font-weight: 760;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.logo-mark {
|
||||
display: inline-grid;
|
||||
flex: 0 0 34px;
|
||||
place-items: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.55);
|
||||
border-radius: 12px;
|
||||
background: #d7f5e9;
|
||||
color: #1e5b4e;
|
||||
font-family: Georgia, serif;
|
||||
font-size: 21px;
|
||||
font-weight: 800;
|
||||
box-shadow: 0 8px 20px rgba(16, 55, 46, 0.16);
|
||||
}
|
||||
|
||||
.sider-section-label,
|
||||
.drawer-section-label {
|
||||
margin: 0 22px 8px;
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.13em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.sider :deep(.ant-menu),
|
||||
.sider :deep(.ant-menu-dark),
|
||||
.mobile-drawer :deep(.ant-menu),
|
||||
.mobile-drawer :deep(.ant-menu-dark) {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.sider :deep(.ant-menu-item),
|
||||
.mobile-drawer :deep(.ant-menu-item) {
|
||||
width: calc(100% - 24px);
|
||||
height: 42px;
|
||||
margin: 5px 12px;
|
||||
padding-inline: 12px;
|
||||
border-radius: 13px;
|
||||
color: #f4f8f7;
|
||||
line-height: 42px;
|
||||
}
|
||||
|
||||
.sider :deep(.ant-menu-item .ant-menu-item-icon),
|
||||
.mobile-drawer :deep(.ant-menu-item .ant-menu-item-icon) {
|
||||
color: currentColor;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.sider :deep(.ant-menu-item::after),
|
||||
.mobile-drawer :deep(.ant-menu-item::after) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sider :deep(.ant-menu-dark .ant-menu-item:hover),
|
||||
.mobile-drawer :deep(.ant-menu-dark .ant-menu-item:hover) {
|
||||
color: #fff;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
.sider :deep(.ant-menu-dark .ant-menu-item-selected),
|
||||
.mobile-drawer :deep(.ant-menu-dark .ant-menu-item-selected) {
|
||||
color: #185448;
|
||||
background: #d9f4eb;
|
||||
font-weight: 700;
|
||||
box-shadow: 0 8px 18px rgba(17, 74, 61, 0.12);
|
||||
}
|
||||
|
||||
.sider :deep(.ant-menu-dark .ant-menu-item-selected:hover),
|
||||
.mobile-drawer :deep(.ant-menu-dark .ant-menu-item-selected:hover) {
|
||||
color: #185448;
|
||||
background: #e5f8f1;
|
||||
}
|
||||
|
||||
.admin-layout--collapsed .logo {
|
||||
padding-inline: 0;
|
||||
}
|
||||
|
||||
.admin-layout--collapsed .sider :deep(.ant-menu-item) {
|
||||
width: 50px;
|
||||
padding-inline: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
height: 64px;
|
||||
margin-left: var(--admin-sider-width);
|
||||
padding: 0 24px;
|
||||
border-bottom: 1px solid var(--admin-mobile-border);
|
||||
background: var(--theme-card-bg);
|
||||
transition: margin-left 0.22s ease;
|
||||
}
|
||||
|
||||
.header-shell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 64px;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.trigger {
|
||||
display: grid;
|
||||
flex: 0 0 36px;
|
||||
place-items: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border: 0;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
color: #54736e;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.trigger:hover {
|
||||
background: var(--admin-mobile-accent-soft);
|
||||
color: var(--theme-primary-action);
|
||||
}
|
||||
|
||||
.trigger:focus-visible,
|
||||
.user-dropdown:focus-visible {
|
||||
outline: 2px solid var(--theme-primary-action);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
display: grid;
|
||||
gap: 3px;
|
||||
color: #224d47;
|
||||
}
|
||||
|
||||
.header-title span {
|
||||
font-size: 15px;
|
||||
font-weight: 750;
|
||||
}
|
||||
|
||||
.header-title small {
|
||||
color: #78918b;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.user-dropdown {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
min-height: 40px;
|
||||
padding: 4px 8px;
|
||||
border: 0;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
color: #315650;
|
||||
cursor: pointer;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.user-dropdown:hover {
|
||||
background: var(--admin-mobile-accent-soft);
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: calc(100vh - 64px);
|
||||
margin-left: var(--admin-sider-width);
|
||||
padding: 30px clamp(20px, 4vw, 54px);
|
||||
transition: margin-left 0.22s ease;
|
||||
}
|
||||
|
||||
.content :deep(.ant-table) {
|
||||
table-layout: auto;
|
||||
width: max-content;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.content :deep(.ant-table-cell) {
|
||||
word-break: keep-all;
|
||||
}
|
||||
|
||||
.drawer-brand {
|
||||
justify-content: flex-start;
|
||||
height: 74px;
|
||||
padding-inline: 22px;
|
||||
}
|
||||
|
||||
.drawer-brand__copy {
|
||||
display: grid;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.drawer-brand__copy span {
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
:global(.admin-mobile-drawer .ant-drawer-body) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100%;
|
||||
padding: 0 0 16px;
|
||||
background: linear-gradient(
|
||||
165deg,
|
||||
var(--admin-mobile-shell-start) 0%,
|
||||
var(--admin-mobile-shell-mid) 56%,
|
||||
var(--admin-mobile-shell-end) 100%
|
||||
);
|
||||
}
|
||||
|
||||
:global(.admin-mobile-drawer .drawer-section-label) {
|
||||
margin-inline: 22px;
|
||||
}
|
||||
|
||||
.drawer-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: auto 14px 0;
|
||||
padding: 14px 8px 0;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.drawer-footer__name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.drawer-logout {
|
||||
display: grid;
|
||||
flex: 0 0 36px;
|
||||
place-items: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border-color: rgba(255, 255, 255, 0.28);
|
||||
background: transparent;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.drawer-logout:hover,
|
||||
.drawer-logout:focus-visible {
|
||||
border-color: rgba(255, 255, 255, 0.6);
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.header,
|
||||
.content {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.header {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.header-title small {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 18px 14px 28px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.sider,
|
||||
.header,
|
||||
.content {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Salon 后台侧栏视觉恢复
|
||||
|
||||
## 目标
|
||||
|
||||
恢复 Salon 后台侧栏原有的薄荷绿品牌识别,消除单一深绿色块带来的割裂感;桌面展开、桌面收起和移动端抽屉使用一致的导航视觉。
|
||||
|
||||
## 设计
|
||||
|
||||
- 桌面侧栏使用项目既有的薄荷绿渐变色变量,宽度为 224px,收起宽度为 74px。
|
||||
- 品牌区保留简洁的 Salon 字标;导航采用透明底,当前项使用浅薄荷绿圆角底色,悬停态使用轻量白色覆盖。
|
||||
- 顶部栏与主内容区根据侧栏展开状态同步偏移,避免内容被固定侧栏遮挡;收起/展开时平滑过渡。
|
||||
- 移动端抽屉复用相同品牌色和菜单状态,底部保留当前账号与退出操作。
|
||||
- 为导航控制补充键盘焦点样式;系统启用减少动态效果时关闭宽度过渡。
|
||||
|
||||
## 范围与兼容
|
||||
|
||||
- 仅调整 Salon 后台公共布局 `AdminLayout.vue`。
|
||||
- 不修改菜单项、路由、权限、身份校验、登录或退出逻辑。
|
||||
- ArtList、Salon 小程序和后台业务页面不在本次范围。
|
||||
|
||||
## 验证
|
||||
|
||||
- Salon 前端单元测试:28 个测试文件、88 项测试通过。
|
||||
- Salon 前端生产构建通过;构建输出仍提示 Ant Design Vue 公共包超过 500KB,该提示与本次侧栏样式无关。
|
||||
- `git diff --check` 通过;Impeccable 检测无问题项。
|
||||
- GitNexus 变更检测风险为低,未发现受影响业务流程。
|
||||
@@ -1,5 +1,12 @@
|
||||
# 项目变更记录
|
||||
|
||||
## 2026-10-26 Salon 后台侧栏视觉恢复
|
||||
|
||||
- 恢复薄荷绿渐变导航轨道、Salon 字标和浅薄荷色圆角选中态;桌面侧栏展开/收起时,顶部栏和主内容同步调整位置。
|
||||
- 移动端抽屉统一品牌配色,保留账号信息和退出入口;补充键盘焦点样式并尊重减少动态效果设置。
|
||||
- 不改变菜单、路由、登录、身份或权限行为。设计说明见 `docs/superpowers/specs/2026-10-26-salon后台侧栏视觉恢复-design.md`。
|
||||
- 验证:Salon 前端 28 个单测文件、88 项测试通过,生产构建通过;Impeccable 检测为空,GitNexus 风险为低,差异检查通过。
|
||||
|
||||
## 2026-10-25 Salon 后台单管理员与经营驾驶舱重构
|
||||
|
||||
- 后台登录、Token 刷新和后台请求统一限制为 `type = 4` 平台管理员;删除后台门店预选、门店切换和管理员注册入口。
|
||||
|
||||
Reference in New Issue
Block a user