From 1a2c03bc7e67eb73de50da426fee23030b1a3115 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 20 Mar 2022 22:58:13 +0800 Subject: [PATCH] =?UTF-8?q?v3.8.2=20=E5=BC=80=E5=90=AFTopNav=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=AD=90=E8=8F=9C=E5=8D=95=E6=83=85=E5=86=B5=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E4=BE=A7=E8=BE=B9=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/codegen/vue/views/index.vue.vm | 2 +- yudao-ui-admin/src/assets/styles/sidebar.scss | 4 +++ .../src/components/TopNav/index.vue | 36 ++++++++----------- .../src/layout/components/Settings/index.vue | 5 +-- yudao-ui-admin/src/layout/index.vue | 6 ++-- yudao-ui-admin/src/router/index.js | 6 ++++ yudao-ui-admin/src/store/modules/app.js | 9 ++++- .../src/store/modules/permission.js | 7 +--- yudao-ui-admin/src/views/bpm/form/index.vue | 2 +- yudao-ui-admin/src/views/bpm/group/index.vue | 2 +- yudao-ui-admin/src/views/bpm/model/index.vue | 2 +- .../src/views/bpm/oa/leave/index.vue | 2 +- .../src/views/bpm/processInstance/index.vue | 2 +- yudao-ui-admin/src/views/bpm/task/done.vue | 2 +- yudao-ui-admin/src/views/bpm/task/todo.vue | 2 +- .../src/views/infra/apiAccessLog/index.vue | 2 +- .../src/views/infra/apiErrorLog/index.vue | 2 +- .../src/views/infra/codegen/index.vue | 2 +- .../src/views/infra/config/index.vue | 2 +- yudao-ui-admin/src/views/infra/file/index.vue | 2 +- .../src/views/infra/fileConfig/index.vue | 2 +- yudao-ui-admin/src/views/infra/job/index.vue | 2 +- yudao-ui-admin/src/views/infra/job/log.vue | 2 +- .../src/views/infra/testDemo/index.vue | 2 +- yudao-ui-admin/src/views/pay/app/index.vue | 2 +- .../src/views/pay/merchant/index.vue | 2 +- yudao-ui-admin/src/views/pay/order/index.vue | 2 +- yudao-ui-admin/src/views/pay/refund/index.vue | 2 +- .../src/views/system/dept/index.vue | 2 +- yudao-ui-admin/src/views/system/dict/data.vue | 2 +- .../src/views/system/dict/index.vue | 2 +- .../src/views/system/errorCode/index.vue | 2 +- .../src/views/system/loginlog/index.vue | 2 +- .../src/views/system/menu/index.vue | 2 +- .../src/views/system/notice/index.vue | 2 +- .../src/views/system/operatelog/index.vue | 2 +- .../src/views/system/post/index.vue | 2 +- .../src/views/system/session/index.vue | 2 +- .../src/views/system/sms/smsChannel.vue | 2 +- .../src/views/system/sms/smsLog.vue | 2 +- .../src/views/system/sms/smsTemplate.vue | 2 +- .../src/views/system/tenant/index.vue | 2 +- .../src/views/system/tenantPackage/index.vue | 2 +- .../src/views/system/user/index.vue | 2 +- 44 files changed, 76 insertions(+), 71 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/resources/codegen/vue/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-impl/src/main/resources/codegen/vue/views/index.vue.vm index 26aaccde4..aac0c27b6 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/resources/codegen/vue/views/index.vue.vm +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/resources/codegen/vue/views/index.vue.vm @@ -2,7 +2,7 @@
- + #foreach($column in $columns) #if ($column.listOperation) #set ($dictType=$column.dictType) diff --git a/yudao-ui-admin/src/assets/styles/sidebar.scss b/yudao-ui-admin/src/assets/styles/sidebar.scss index d2a7453f3..ed308b8dc 100644 --- a/yudao-ui-admin/src/assets/styles/sidebar.scss +++ b/yudao-ui-admin/src/assets/styles/sidebar.scss @@ -7,6 +7,10 @@ position: relative; } + .sidebarHide { + margin-left: 0!important; + } + .sidebar-container { -webkit-transition: width .28s; transition: width 0.28s; diff --git a/yudao-ui-admin/src/components/TopNav/index.vue b/yudao-ui-admin/src/components/TopNav/index.vue index 7ffbf4224..b6eb0f02b 100644 --- a/yudao-ui-admin/src/components/TopNav/index.vue +++ b/yudao-ui-admin/src/components/TopNav/index.vue @@ -71,7 +71,7 @@ export default { for (var item in router.children) { if (router.children[item].parentPath === undefined) { if(router.path === "/") { - router.children[item].path = "/redirect/" + router.children[item].path; + router.children[item].path = "/" + router.children[item].path; } else { if(!this.ishttp(router.children[item].path)) { router.children[item].path = router.path + "/" + router.children[item].path; @@ -87,22 +87,23 @@ export default { // 默认激活的菜单 activeMenu() { const path = this.$route.path; - let activePath = this.defaultRouter(); + let activePath = path; if (path.lastIndexOf("/") > 0) { const tmpPath = path.substring(1, path.length); activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/")); + this.$store.dispatch('app/toggleSideBarHide', false); } else if ("/index" == path || "" == path) { if (!this.isFrist) { this.isFrist = true; } else { activePath = "index"; } + this.$store.dispatch('app/toggleSideBarHide', true); + } else if(!this.$route.children) { + activePath = path; + this.$store.dispatch('app/toggleSideBarHide', true); } - var routes = this.activeRoutes(activePath); - if (routes.length === 0) { - activePath = this.currentIndex || this.defaultRouter() - this.activeRoutes(activePath); - } + this.activeRoutes(activePath); return activePath; }, }, @@ -121,29 +122,21 @@ export default { const width = document.body.getBoundingClientRect().width / 3; this.visibleNumber = parseInt(width / 85); }, - // 默认激活的路由 - defaultRouter() { - let router; - Object.keys(this.routers).some((key) => { - if (!this.routers[key].hidden) { - router = this.routers[key].path; - return true; - } - }); - return router; - }, // 菜单选择事件 handleSelect(key, keyPath) { this.currentIndex = key; + const route = this.routers.find(item => item.path === key); if (this.ishttp(key)) { // http(s):// 路径新窗口打开 window.open(key, "_blank"); - } else if (key.indexOf("/redirect") !== -1) { - // /redirect 路径内部打开 - this.$router.push({ path: key.replace("/redirect", "") }); + } else if (!route || !route.children) { + // 没有子路由路径内部打开 + this.$router.push({ path: key }); + this.$store.dispatch('app/toggleSideBarHide', true); } else { // 显示左侧联动菜单 this.activeRoutes(key); + this.$store.dispatch('app/toggleSideBarHide', false); } }, // 当前激活的路由 @@ -159,7 +152,6 @@ export default { if(routes.length > 0) { this.$store.commit("SET_SIDEBAR_ROUTERS", routes); } - return routes; }, ishttp(url) { return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1 diff --git a/yudao-ui-admin/src/layout/components/Settings/index.vue b/yudao-ui-admin/src/layout/components/Settings/index.vue index eb0a83940..e5ae2a610 100644 --- a/yudao-ui-admin/src/layout/components/Settings/index.vue +++ b/yudao-ui-admin/src/layout/components/Settings/index.vue @@ -108,6 +108,7 @@ export default { value: val }) if (!val) { + this.$store.dispatch('app/toggleSideBarHide', false); this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes); } } @@ -162,7 +163,7 @@ export default { this.sideTheme = val; }, saveSetting() { - this.$modal.loading("正在保存到本地,请稍后..."); + this.$modal.loading("正在保存到本地,请稍候..."); this.$cache.local.set( "layout-setting", `{ @@ -178,7 +179,7 @@ export default { setTimeout(this.$modal.closeLoading(), 1000) }, resetSetting() { - this.$modal.loading("正在清除设置缓存并刷新,请稍后..."); + this.$modal.loading("正在清除设置缓存并刷新,请稍候..."); this.$cache.local.remove("layout-setting") setTimeout("window.location.reload()", 1000) } diff --git a/yudao-ui-admin/src/layout/index.vue b/yudao-ui-admin/src/layout/index.vue index 40c2e1392..26e64e93d 100644 --- a/yudao-ui-admin/src/layout/index.vue +++ b/yudao-ui-admin/src/layout/index.vue @@ -1,8 +1,8 @@