From 2358145a3c10126bbb4c86426167e0f8873473e4 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 10 Oct 2023 16:30:21 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E6=A8=A1=E5=9D=97=E7=9A=84=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontend/src/components/head/HeaderWs.vue | 14 ++++++-------- .../src/components/head/ProjectSearchList.vue | 17 +++++++---------- .../src/components/layout/AsideMenus.vue | 3 +++ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/framework/sdk-parent/frontend/src/components/head/HeaderWs.vue b/framework/sdk-parent/frontend/src/components/head/HeaderWs.vue index a525feb7dd..e92cd1436b 100644 --- a/framework/sdk-parent/frontend/src/components/head/HeaderWs.vue +++ b/framework/sdk-parent/frontend/src/components/head/HeaderWs.vue @@ -79,6 +79,12 @@ export default { sessionStorage.setItem("workspace_name", this.currentWorkspaceName); } }, + mounted() { + getWorkspaceModules("workspace",getCurrentWorkspaceId()) + .then(res => { + sessionStorage.setItem('workspace_modules', JSON.stringify(res.data)); + }); + }, methods: { initMenuData() { getUserWorkspaceList() @@ -90,10 +96,6 @@ export default { this.currentWorkspaceName = workspace[0].name; this.workspaceList = response.data.filter(r => r.id !== this.workspaceId); this.workspaceList.unshift(workspace[0]); - getWorkspaceModules("workspace",workspace[0].id) - .then(res => { - sessionStorage.setItem('workspace_modules', JSON.stringify(res.data)); - }); } else { // 工作空间不存在, 切换到查询的第一个 this.currentWorkspaceName = response.data[0].name; @@ -155,10 +157,6 @@ export default { }) .catch(err => err); }); - getWorkspaceModules("workspace",response.data[0].id) - .then(res => { - sessionStorage.setItem('workspace_modules', JSON.stringify(res.data)); - }); } }, query(queryString) { diff --git a/framework/sdk-parent/frontend/src/components/head/ProjectSearchList.vue b/framework/sdk-parent/frontend/src/components/head/ProjectSearchList.vue index ad91142a26..7efccaa33f 100644 --- a/framework/sdk-parent/frontend/src/components/head/ProjectSearchList.vue +++ b/framework/sdk-parent/frontend/src/components/head/ProjectSearchList.vue @@ -46,6 +46,13 @@ export default { inject: [ 'reload', ], + mounted() { + getProjectModules("project", getCurrentProjectID()) + .then(res => { + let modules = res.data; + sessionStorage.setItem('project_modules', JSON.stringify(modules)); + }); + }, data() { return { loading: false, @@ -89,11 +96,6 @@ export default { this.change(this.items[0].id); } } - getProjectModules("project", projectId) - .then(res => { - let modules = res.data; - sessionStorage.setItem('project_modules', JSON.stringify(modules)); - }); this.changeProjectName(projectId); }); }, @@ -233,11 +235,6 @@ export default { .catch(() => { stopFullScreenLoading(loading); }); - getProjectModules("project", projectId) - .then(res => { - let modules = res.data; - sessionStorage.setItem('project_modules', JSON.stringify(modules)); - }); }, changeProjectName(projectId) { if (projectId) { diff --git a/framework/sdk-parent/frontend/src/components/layout/AsideMenus.vue b/framework/sdk-parent/frontend/src/components/layout/AsideMenus.vue index 762d06b604..8d0316415f 100644 --- a/framework/sdk-parent/frontend/src/components/layout/AsideMenus.vue +++ b/framework/sdk-parent/frontend/src/components/layout/AsideMenus.vue @@ -120,6 +120,9 @@ export default { mounted() { if (this.$route.matched.length > 0) { this.activeIndex = this.$route.matched[0].path; + if (!this.check(this.$route.matched[0].name.toLowerCase())) { + window.location.href = "/#/"; + } } this.registerEvents(); },