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(); },