diff --git a/ZR.Vue/src/assets/styles/sidebar.scss b/ZR.Vue/src/assets/styles/sidebar.scss index 17381fc..c33d71f 100644 --- a/ZR.Vue/src/assets/styles/sidebar.scss +++ b/ZR.Vue/src/assets/styles/sidebar.scss @@ -3,22 +3,26 @@ .main-container { min-height: 100%; transition: margin-left .28s; - margin-left: $sideBarWidth; + margin-left: $base-sidebar-width; position: relative; } .sidebar-container { + -webkit-transition: width .28s; transition: width 0.28s; - width: $sideBarWidth !important; - background-color: $menuBg; + width: $base-sidebar-width !important; + background-color: $base-menu-background; height: 100%; position: fixed; - font-size: 0; + font-size: 0px; top: 0; bottom: 0; left: 0; z-index: 1001; overflow: hidden; + // 有改动 + -webkit-box-shadow: 2px 0 7px rgba(0,21,41 , .15); + box-shadow: 2px 0 7px rgba(0,21,41 , .15); // reset element-ui css .horizontal-collapse-transition { @@ -30,7 +34,7 @@ } .el-scrollbar__bar.is-vertical { - right: 0; + right: 0px; } .el-scrollbar { @@ -63,25 +67,39 @@ width: 100% !important; } + .el-menu-item, .el-submenu__title { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + } + // menu hover .submenu-title-noDropdown, .el-submenu__title { &:hover { - background-color: $menuHover !important; + background-color: rgba(0, 0, 0, 0.06) !important; } } - .is-active>.el-submenu__title { - color: $subMenuActiveText !important; + & .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: $sideBarWidth !important; - background-color: $subMenuBg !important; + min-width: $base-sidebar-width !important; &:hover { - background-color: $subMenuHover !important; + background-color: rgba(0, 0, 0, 0.06) !important; + } + } + + & .theme-dark .nest-menu .el-submenu>.el-submenu__title, + & .theme-dark .el-submenu .el-menu-item { + background-color: $base-sub-menu-background !important; + + &:hover { + background-color: $base-sub-menu-hover !important; } } } @@ -118,9 +136,6 @@ margin-left: 20px; } - .el-submenu__icon-arrow { - display: none; - } } } @@ -140,25 +155,25 @@ } .el-menu--collapse .el-menu .el-submenu { - min-width: $sideBarWidth !important; + min-width: $base-sidebar-width !important; } // mobile responsive .mobile { .main-container { - margin-left: 0; + margin-left: 0px; } .sidebar-container { transition: transform .28s; - width: $sideBarWidth !important; + width: $base-sidebar-width !important; } &.hideSidebar { .sidebar-container { pointer-events: none; transition-duration: 0.3s; - transform: translate3d(-$sideBarWidth, 0, 0); + transform: translate3d(-$base-sidebar-width, 0, 0); } } } @@ -184,7 +199,7 @@ .el-menu-item { &:hover { // you can use $subMenuHover - background-color: $menuHover !important; + background-color: rgba(0, 0, 0, 0.06) !important; } } diff --git a/ZR.Vue/src/assets/styles/variables.scss b/ZR.Vue/src/assets/styles/variables.scss index 5688f25..86ae632 100644 --- a/ZR.Vue/src/assets/styles/variables.scss +++ b/ZR.Vue/src/assets/styles/variables.scss @@ -8,28 +8,35 @@ $tiffany: #4AB7BD; $yellow:#FEC171; $panGreen: #30B08F; -// sidebar -$menuText:#bfcbd9; -$menuActiveText:#409EFF; -$subMenuActiveText:#f4f4f5; // https://github.com/ElemeFE/element/issues/12951 +// 默认菜单主题风格 +$base-menu-color:#bfcbd9; +$base-menu-color-active:#f4f4f5; +$base-menu-background:#304156; +$base-logo-title-color: #ffffff; -$menuBg:#304156; -$menuHover:#263445; +$base-menu-light-color:rgba(0,0,0,.70); +$base-menu-light-background:#ffffff; +$base-logo-light-title-color: #001529; -$subMenuBg:#1f2d3d; -$subMenuHover:#001528; +$base-sub-menu-background:#1f2d3d; +$base-sub-menu-hover:#001528; -$sideBarWidth: 200px; + + +$base-sidebar-width: 200px; // the :export directive is the magic sauce for webpack // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass :export { - menuText: $menuText; - menuActiveText: $menuActiveText; - subMenuActiveText: $subMenuActiveText; - menuBg: $menuBg; - menuHover: $menuHover; - subMenuBg: $subMenuBg; - subMenuHover: $subMenuHover; - sideBarWidth: $sideBarWidth; + menuColor: $base-menu-color; + menuLightColor: $base-menu-light-color; + menuColorActive: $base-menu-color-active; + menuBackground: $base-menu-background; + menuLightBackground: $base-menu-light-background; + subMenuBackground: $base-sub-menu-background; + subMenuHover: $base-sub-menu-hover; + sideBarWidth: $base-sidebar-width; + logoTitleColor: $base-logo-title-color; + logoLightTitleColor: $base-logo-light-title-color } + diff --git a/ZR.Vue/src/layout/components/Settings/index.vue b/ZR.Vue/src/layout/components/Settings/index.vue index 5079b8e..895042e 100644 --- a/ZR.Vue/src/layout/components/Settings/index.vue +++ b/ZR.Vue/src/layout/components/Settings/index.vue @@ -32,7 +32,7 @@ - +
开启 Tags-Views @@ -107,6 +107,7 @@ export default { key: "theme", value: val, }); + this.theme = val; }, handleTheme(val) { this.$store.dispatch("settings/changeSetting", { @@ -118,6 +119,12 @@ export default { // 保存配置好 saveSetting() { // this.$modal.loading("正在保存到本地,请稍后..."); + const loading = this.$loading({ + lock: true, + text: "正在保存到本地,请稍后...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); localStorage.setItem( "layout-setting", `{ @@ -129,7 +136,7 @@ export default { }` ); this.msgSuccess("保存成功"); - // setTimeout(this.$modal.closeLoading(), 1000); + setTimeout(loading.close(), 2000); }, resetSetting() { // this.$modal.loading("正在清除设置缓存并刷新,请稍后..."); diff --git a/ZR.Vue/src/layout/components/Sidebar/Logo.vue b/ZR.Vue/src/layout/components/Sidebar/Logo.vue index 1bc9b7a..c794875 100644 --- a/ZR.Vue/src/layout/components/Sidebar/Logo.vue +++ b/ZR.Vue/src/layout/components/Sidebar/Logo.vue @@ -1,5 +1,5 @@