修改后台管理界面

This commit is contained in:
userName 2025-12-27 18:32:29 +08:00
parent e8bfa466e4
commit ca9789ba72
5 changed files with 52 additions and 13 deletions

View File

@ -15,11 +15,7 @@
<div :class="setColumnsAsidelayout"> <div :class="setColumnsAsidelayout">
<i :class="'el-icon-' + v.icon"></i> <i :class="'el-icon-' + v.icon"></i>
<div class="font13"> <div class="font13">
{{ {{ v.title }}
v.title && v.title.length >= 4
? v.title.substr(0, setColumnsAsidelayout === 'columns-vertical' ? 4 : 3)
: v.title
}}
</div> </div>
</div> </div>
</li> </li>
@ -194,7 +190,7 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.layout-columns-aside { .layout-columns-aside {
width: 80px; width: 140px;
height: 100%; height: 100%;
background: var(--prev-bg-columnsMenuBar); background: var(--prev-bg-columnsMenuBar);
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
@ -259,7 +255,7 @@ export default {
left: 50%; left: 50%;
top: 2px; top: 2px;
height: 50px; height: 50px;
width: 65px; width: 125px;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 0; z-index: 0;
transition: 0.3s ease-in-out; transition: 0.3s ease-in-out;

View File

@ -13,11 +13,7 @@
> >
<div :class="setColumnsAsidelayout"> <div :class="setColumnsAsidelayout">
<div class="font12"> <div class="font12">
{{ {{ v.title }}
v.title && v.title.length >= 4
? v.title.substr(0, setColumnsAsidelayout === 'columns-vertical' ? 4 : 3)
: v.title
}}
</div> </div>
</div> </div>
</li> </li>

View File

@ -207,6 +207,8 @@ const actions = {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
let accessRoutes = await roleApi.menuListApi(); let accessRoutes = await roleApi.menuListApi();
accessRoutes = replaceChildListWithChildren(accessRoutes); accessRoutes = replaceChildListWithChildren(accessRoutes);
// 去除重复菜单根据path去重
accessRoutes = removeDuplicateMenus(accessRoutes);
//处理移动端路由 //处理移动端路由
!Auth.isPhone() !Auth.isPhone()
? (accessRoutes = accessRoutes.filter((item) => item.path !== '/javaMobile')) ? (accessRoutes = accessRoutes.filter((item) => item.path !== '/javaMobile'))
@ -226,6 +228,22 @@ const actions = {
}, },
}; };
// 去除重复菜单根据path去重
function removeDuplicateMenus(menus) {
const seen = new Set();
return menus.filter((menu) => {
if (seen.has(menu.path)) {
return false;
}
seen.add(menu.path);
// 递归处理子菜单
if (menu.children && menu.children.length > 0) {
menu.children = removeDuplicateMenus(menu.children);
}
return true;
});
}
// 递归函数,用于替换 childList 为 children // 递归函数,用于替换 childList 为 children
function replaceChildListWithChildren(data) { function replaceChildListWithChildren(data) {
return data.map((item) => { return data.map((item) => {

View File

@ -70,10 +70,28 @@ body,
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-x: hidden !important; overflow-x: hidden !important;
width: 240px !important;
min-width: 240px !important;
flex: 0 0 240px !important;
.el-scrollbar__view { .el-scrollbar__view {
overflow: hidden; overflow: hidden;
} }
.el-menu {
width: 240px !important;
}
.el-menu-item,
.el-submenu__title {
width: 240px !important;
span {
display: inline-block !important;
width: auto !important;
white-space: nowrap !important;
}
}
} }
.layout-header { .layout-header {
@ -105,7 +123,7 @@ body,
} }
.layout-aside-width-default { .layout-aside-width-default {
width: 206px !important; width: 240px !important;
transition: width 0.2s ease; transition: width 0.2s ease;
box-shadow: 1px 1px 4px rgba(0, 21, 41, 0.08); box-shadow: 1px 1px 4px rgba(0, 21, 41, 0.08);
} }

View File

@ -115,6 +115,7 @@
// 默认样式修改 // 默认样式修改
.el-menu { .el-menu {
border-right: none !important; border-right: none !important;
width: 100% !important;
} }
.el-menu-item, .el-menu-item,
@ -123,6 +124,16 @@
line-height: 50px !important; line-height: 50px !important;
color: var(--prev-bg-menuBarColor) !important; color: var(--prev-bg-menuBarColor) !important;
transition: none !important; transition: none !important;
white-space: nowrap !important;
overflow: visible !important;
text-overflow: clip !important;
padding-right: 20px !important;
span {
display: inline !important;
white-space: nowrap !important;
overflow: visible !important;
}
} }
// horizontal 水平方向时 // horizontal 水平方向时