This commit is contained in:
2025-10-05 03:09:15 +08:00
parent 57f1a7f121
commit f36dc4f3d3
15 changed files with 1479 additions and 612 deletions

View File

@@ -1,87 +0,0 @@
// 自定义侧边栏样式 - 适配蓝色渐变背景
.sidebar-container {
// 覆盖Element UI菜单的默认样式
.el-menu {
background: transparent !important;
border: none !important;
.el-menu-item, .el-submenu__title {
color: #ffffff !important;
background: transparent !important;
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
color: #ffffff !important;
}
&.is-active {
background-color: rgba(255, 255, 255, 0.2) !important;
color: #ffffff !important;
border-right: 3px solid #ffffff !important;
}
}
.el-submenu {
.el-menu {
background-color: rgba(255, 255, 255, 0.05) !important;
.el-menu-item {
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
}
&.is-active {
background-color: rgba(255, 255, 255, 0.15) !important;
color: #ffffff !important;
}
}
}
}
}
// 图标颜色
.svg-icon {
color: #ffffff !important;
}
// 文字颜色
span {
color: #ffffff !important;
}
// 激活状态的子菜单标题
.is-active > .el-submenu__title {
color: #ffffff !important;
}
// 子菜单展开时的样式
.el-submenu.is-opened > .el-submenu__title {
color: #ffffff !important;
}
}
// 弹出菜单样式
.el-menu--popup {
background: linear-gradient(135deg, #3aa4ef 0%, #0067e2 100%) !important;
border-radius: 8px !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
.el-menu-item {
color: #ffffff !important;
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
}
&.is-active {
background-color: rgba(255, 255, 255, 0.2) !important;
}
}
}
// 响应式设计
@media (max-width: 768px) {
.sidebar-container {
border-radius: 0 !important;
}
}

View File

@@ -3,7 +3,6 @@
@import './transition.scss';
@import './element-ui.scss';
@import './sidebar.scss';
@import './custom-sidebar.scss';
@import './btn.scss';
body {

View File

@@ -12,10 +12,10 @@
}
.sidebar-container {
-webkit-transition: width .28s;
transition: width 0.28s;
-webkit-transition: width .28s ease-in-out;
transition: width 0.28s ease-in-out, box-shadow 0.3s ease;
width: $base-sidebar-width !important;
background: $base-menu-background;
background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
height: 100vh;
position: fixed;
font-size: 0px;
@@ -24,9 +24,31 @@
left: 0;
z-index: 1001;
overflow: hidden;
border-radius: 0 24px 0 0;
-webkit-box-shadow: 2px 0 6px rgba(0,21,41,.35);
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
border-radius: 0 20px 20px 0;
-webkit-box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
// 添加悬停效果
&:hover {
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
// 添加进入动画
animation: slideInLeft 0.5s ease-out;
}
@keyframes slideInLeft {
from {
transform: translateX(-100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
// reset element-ui css
.horizontal-collapse-transition {
@@ -65,47 +87,114 @@
margin-right: 16px;
}
.el-menu {
border: none;
height: 100%;
width: 100% !important;
font-size: 15px; // 增加菜单字体大小
}
.el-menu {
border: none;
height: 100%;
width: 100% !important;
font-size: 14px;
background: transparent !important;
padding: 10px 0;
}
.el-menu-item, .el-submenu__title {
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
font-size: 15px; // 确保菜单项字体大小一致
}
// menu hover
.submenu-title-noDropdown,
.el-submenu__title {
.el-menu-item, .el-submenu__title {
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
font-size: 14px;
font-weight: 500;
color: rgba(255, 255, 255, 0.95) !important;
background: transparent !important;
border-radius: 12px;
margin: 4px 12px;
padding: 0 16px !important;
height: 48px;
line-height: 48px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
background: rgba(255, 255, 255, 0.15) !important;
color: #ffffff !important;
transform: translateX(4px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
&.is-active {
background: rgba(255, 255, 255, 0.25) !important;
color: #ffffff !important;
font-weight: 600;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 4px;
height: 20px;
background: #ffffff;
border-radius: 0 2px 2px 0;
}
}
}
& .theme-dark .is-active > .el-submenu__title {
color: $base-menu-color-active !important;
}
& .nest-menu .el-submenu>.el-submenu__title,
& .el-submenu .el-menu-item {
min-width: $base-sidebar-width !important;
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
// 子菜单样式优化
.el-submenu {
.el-submenu__title {
border-radius: 12px;
margin: 4px 12px;
padding: 0 16px !important;
height: 48px;
line-height: 48px;
&:hover {
background: rgba(255, 255, 255, 0.15) !important;
color: #ffffff !important;
transform: translateX(4px);
}
}
.el-menu {
background: rgba(255, 255, 255, 0.08) !important;
border-radius: 12px;
margin: 8px 12px;
padding: 8px 0;
box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
.el-menu-item {
margin: 2px 8px;
padding: 0 24px !important;
height: 40px;
line-height: 40px;
font-size: 13px;
&:hover {
background: rgba(255, 255, 255, 0.12) !important;
transform: translateX(2px);
}
&.is-active {
background: rgba(255, 255, 255, 0.2) !important;
&::before {
width: 3px;
height: 16px;
}
}
}
}
}
& .theme-dark .nest-menu .el-submenu>.el-submenu__title,
& .theme-dark .el-submenu .el-menu-item {
background-color: $base-sub-menu-background !important;
// 图标样式优化
.svg-icon {
color: rgba(255, 255, 255, 0.8) !important;
transition: all 0.3s ease;
margin-right: 12px;
&:hover {
background-color: $base-sub-menu-hover !important;
color: #ffffff !important;
transform: scale(1.1);
}
}
}
@@ -171,8 +260,24 @@
}
.sidebar-container {
transition: transform .28s;
transition: transform .28s ease-in-out;
width: $base-sidebar-width !important;
border-radius: 0;
// 移动端优化
.el-menu-item, .el-submenu__title {
margin: 2px 8px;
padding: 0 12px !important;
height: 44px;
line-height: 44px;
font-size: 13px;
}
.el-submenu .el-menu-item {
height: 36px;
line-height: 36px;
font-size: 12px;
}
}
&.hideSidebar {
@@ -180,6 +285,38 @@
pointer-events: none;
transition-duration: 0.3s;
transform: translate3d(-$base-sidebar-width, 0, 0);
box-shadow: none;
}
}
}
// 平板设备优化
@media (max-width: 1024px) {
.sidebar-container {
.el-menu-item, .el-submenu__title {
font-size: 13px;
height: 44px;
line-height: 44px;
}
}
}
// 小屏幕优化
@media (max-width: 768px) {
.sidebar-container {
border-radius: 0;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
.el-menu {
padding: 8px 0;
}
.el-menu-item, .el-submenu__title {
margin: 2px 6px;
padding: 0 10px !important;
height: 40px;
line-height: 40px;
font-size: 12px;
}
}
}
@@ -191,9 +328,55 @@
transition: none;
}
}
// 弹出菜单样式优化
.el-menu--popup {
background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
border-radius: 12px !important;
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2) !important;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
padding: 8px 0;
.el-menu-item {
color: rgba(255, 255, 255, 0.95) !important;
margin: 2px 8px;
border-radius: 8px;
transition: all 0.3s ease;
&:hover {
background: rgba(255, 255, 255, 0.15) !important;
color: #ffffff !important;
transform: translateX(4px);
}
&.is-active {
background: rgba(255, 255, 255, 0.25) !important;
color: #ffffff !important;
}
}
// 自定义滚动条
&::-webkit-scrollbar-track-piece {
background: rgba(255, 255, 255, 0.1);
border-radius: 4px;
}
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 4px;
&:hover {
background: rgba(255, 255, 255, 0.5);
}
}
}
// when menu collapsed
// 收起状态下的样式
.el-menu--vertical {
&>.el-menu {
.svg-icon {
@@ -204,27 +387,7 @@
.nest-menu .el-submenu>.el-submenu__title,
.el-menu-item {
&:hover {
// you can use $subMenuHover
background-color: rgba(58, 164, 239, 0.1) !important;
}
}
// the scroll bar appears when the subMenu is too long
>.el-menu--popup {
max-height: 100vh;
overflow-y: auto;
&::-webkit-scrollbar-track-piece {
background: #d3dce6;
}
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background: #99a9bf;
border-radius: 20px;
background: rgba(255, 255, 255, 0.15) !important;
}
}
}

View File

@@ -8,18 +8,18 @@ $tiffany: #4AB7BD;
$yellow:#FEC171;
$panGreen: #30B08F;
// 默认菜单主题风格 - 蓝色渐变主题
$base-menu-color:#ffffff;
// 默认菜单主题风格 - 现代化渐变主题
$base-menu-color:rgba(255, 255, 255, 0.95);
$base-menu-color-active:#ffffff;
$base-menu-background:linear-gradient(0deg, #3aa4ef 0%, #0067e2 100%);
$base-menu-background:linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
$base-logo-title-color: #ffffff;
$base-menu-light-color:rgba(0,0,0,.70);
$base-menu-light-background:#ffffff;
$base-logo-light-title-color: #001529;
$base-sub-menu-background:rgba(255,255,255,0.1);
$base-sub-menu-hover:rgba(255,255,255,0.2);
$base-sub-menu-background:rgba(255,255,255,0.08);
$base-sub-menu-hover:rgba(255,255,255,0.15);
// 自定义暗色菜单风格
/**