From 9e41c496db00eabb9fffe9f3956c52f26bc59fa8 Mon Sep 17 00:00:00 2001 From: toesbieya <1647775459@qq.com> Date: Tue, 25 Feb 2020 21:13:33 +0800 Subject: [PATCH] none --- vue/src/assets/styles/sidebar.scss | 5 +- vue/src/assets/styles/variables.scss | 3 +- .../Sidebar/components/SidebarItem.vue | 12 ++--- vue/src/store/modules/resource.js | 8 ++-- .../components/PanelGroup/PanelGroupItem.vue | 47 ++++++------------- .../index/components/PanelGroup/index.vue | 13 ++--- .../views/userCenter/components/UserCard.vue | 4 +- 7 files changed, 37 insertions(+), 55 deletions(-) diff --git a/vue/src/assets/styles/sidebar.scss b/vue/src/assets/styles/sidebar.scss index 8631472..e45ddfa 100644 --- a/vue/src/assets/styles/sidebar.scss +++ b/vue/src/assets/styles/sidebar.scss @@ -116,10 +116,11 @@ $iconSize: 17px; .popover-menu__title { cursor: auto; text-align: center; + color: $menuText; border-bottom: 1px solid $subMenuBg; - &.is-disabled { - opacity: 1; + &.el-menu-item:hover { + background-color: $menuBg; } } } diff --git a/vue/src/assets/styles/variables.scss b/vue/src/assets/styles/variables.scss index c15d135..b22edac 100644 --- a/vue/src/assets/styles/variables.scss +++ b/vue/src/assets/styles/variables.scss @@ -31,7 +31,8 @@ $--color-info: $--color-teal; } // sidebar -$menuText: #bfcbd9; +//$menuText: #bfcbd9; +$menuText: #D6E2F0; $menuBg: #304156; $menuHover: #263445; $subMenuBg: #1f2d3d; diff --git a/vue/src/layout/components/Sidebar/components/SidebarItem.vue b/vue/src/layout/components/Sidebar/components/SidebarItem.vue index 77eed8b..25fc747 100644 --- a/vue/src/layout/components/Sidebar/components/SidebarItem.vue +++ b/vue/src/layout/components/Sidebar/components/SidebarItem.vue @@ -9,11 +9,11 @@ } function getOnlyChild(item) { - const showingChildren = item.children || [] + const children = item.children || [] - if (showingChildren.length === 1) return showingChildren[0] + if (children.length === 1) return children[0] - if (showingChildren.length <= 0) return {...item, path: undefined, children: undefined} + if (children.length < 1) return {...item, path: undefined, children: undefined} return null } @@ -31,7 +31,7 @@ function renderNode({item, isNest, showParent, collapse, basePath}) { let onlyOneChild = getOnlyChild(item) - const showSingle = onlyOneChild && !onlyOneChild.children && !item.alwaysShow + const showSingle = onlyOneChild && !onlyOneChild.children if (showSingle) { const index = resolvePath(basePath, onlyOneChild.path) @@ -64,9 +64,9 @@ //弹出菜单显示父级信息 if (showParent) { children.unshift( - +
- +
) } } diff --git a/vue/src/store/modules/resource.js b/vue/src/store/modules/resource.js index 76b7656..0e8f68c 100644 --- a/vue/src/store/modules/resource.js +++ b/vue/src/store/modules/resource.js @@ -68,7 +68,7 @@ const actions = { } } -//再原始路由数组基础上添加全路径 +//在原始路由数组基础上添加全路径 function transformOriginRoutes(routes) { let res = JSON.parse(JSON.stringify(routes)) @@ -90,7 +90,7 @@ function clean(routes, cleanHidden = true) { } if (routes[i].children) { clean(routes[i].children, cleanHidden) - if (routes[i].children.length < 1) { + if (routes[i].children.length < 1 && routes[i].alwaysShow !== true) { routes.splice(i, 1) } } @@ -111,14 +111,14 @@ function getAuthorizedRoutes({resources, admin}) { if (admin === 1) return finalAuthorityRoutes if (!resources) return [] let arr = JSON.parse(JSON.stringify(finalAuthorityRoutes)) - filter(arr, i => i.fullPath in resources) + filter(arr, i => !needAuth(i) || i.fullPath in resources) return arr } //若没有children且未通过,则删除,若有,当children长度为0时删除 function filter(arr, fun) { for (let i = 0; i < arr.length; i++) { - if (!arr[i].children && needAuth(arr[i]) && !fun(arr[i])) { + if (!arr[i].children && !fun(arr[i])) { arr.splice(i, 1) i-- continue diff --git a/vue/src/views/index/components/PanelGroup/PanelGroupItem.vue b/vue/src/views/index/components/PanelGroup/PanelGroupItem.vue index 91ff399..a8ff774 100644 --- a/vue/src/views/index/components/PanelGroup/PanelGroupItem.vue +++ b/vue/src/views/index/components/PanelGroup/PanelGroupItem.vue @@ -1,45 +1,28 @@ - - - diff --git a/vue/src/views/index/components/PanelGroup/index.vue b/vue/src/views/index/components/PanelGroup/index.vue index 472f14c..5638b62 100644 --- a/vue/src/views/index/components/PanelGroup/index.vue +++ b/vue/src/views/index/components/PanelGroup/index.vue @@ -1,7 +1,7 @@ @@ -29,8 +29,8 @@ value: 0, text: '今日采购额' }, - {id: 'sell', path: '/sell/order', icon: 'sell', color: variables.danger, value: 0, text: '今日销售额'}, - {id: 'profit', icon: 'money', color: variables.info, value: 0, text: '今日毛利润'}, + {id: 'sell', path: '/sell/order', icon: 'sell', color: variables.warning, value: 0, text: '今日销售额'}, + {id: 'profit', icon: 'money', color: variables.success, value: 0, text: '今日毛利润'}, ] } }, @@ -46,11 +46,8 @@ }) .finally(() => this.loading = false) }, - jump({id, path}) { - if (!isEmpty(path) && auth(path)) { - this.$router.push(path) - this.$refs[id][0].mouseout() - } + jump({path}) { + if (!isEmpty(path) && auth(path)) this.$router.push(path) } }, mounted() { diff --git a/vue/src/views/userCenter/components/UserCard.vue b/vue/src/views/userCenter/components/UserCard.vue index 8828792..4ea54f9 100644 --- a/vue/src/views/userCenter/components/UserCard.vue +++ b/vue/src/views/userCenter/components/UserCard.vue @@ -8,14 +8,14 @@ -
+