From a3adaa057d8ee581d9b6aff58cc1f732b7de7416 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Wed, 3 Feb 2021 13:57:09 +0800 Subject: [PATCH] update Former-commit-id: 08ddfbafd3c54264f302efc6bcb235f5229e76f8 Former-commit-id: ff58ed1f19552efdda3dbe1a1ddaea6353313fb9 --- .../components/views/shared/layout.html | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/projects/Platform/wwwroot/components/views/shared/layout.html b/projects/Platform/wwwroot/components/views/shared/layout.html index 7c9f0a04..aa813d08 100644 --- a/projects/Platform/wwwroot/components/views/shared/layout.html +++ b/projects/Platform/wwwroot/components/views/shared/layout.html @@ -13,9 +13,30 @@ +
@@ -38,6 +59,7 @@ data: function () { return { url: config.baseUrl + 'Site/Layout', + viewPath:'/components/views/areas/' } }, mounted: function () { @@ -49,6 +71,14 @@ }); }, methods: { + getArea: function () { + var path = this.$route.path === '/' ? (this.viewPath+'default/index.html') : this.$route.path; + path = path.substr(this.viewPath.length); + return path === '/' ? 'default' : path.substr(0, path.indexOf('/')); + }, + getPath: function (area) { + return this.viewPath + area + '/index.html'; + }, getModules: function () { var numbers = Enumerable.from(store.state.layout.user.claims).where(o => o.type === store.state.layout.user.roleClaimType).select(o => o.value).toArray(); var modules = Enumerable.from(store.state.layout.modules) @@ -56,8 +86,16 @@ .orderBy(o => o.order).toArray(); return modules; }, - getPath: function (area) { - return '/components/views/' + area + '/index.html'; + getMenus: function (area) { + area = area||this.getArea(); + var module = Enumerable.from(store.state.layout.modules).firstOrDefault(o => o.number === area); + var numbers = Enumerable.from(store.state.layout.user.claims).where(o => o.type === store.state.layout.user.roleClaimType).select(o => o.value).toArray(); + var permissions = Enumerable.from(module.permissionCategories) + .selectMany(o => o.permissions) + .where(o => Enumerable.from(numbers).any(n => n === o.number)) + .orderBy(o => o.order) + .toArray() + return permissions; }, getLinkClass: function (area) { var cls = 'nav-link'; @@ -66,7 +104,7 @@ cls += ' active'; } else { - if (path.indexOf('/components/views/'+area) === 0) { + if (path.indexOf(this.viewPath+area) === 0) { cls += ' active'; } }