From 8c121c39deec41e569d1f97f5b11787b4227b9d6 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 24 Feb 2020 17:41:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=88=90=E5=91=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserController.java | 3 +- .../performance/components/HeaderTopMenus.vue | 4 +- .../src/performance/components/HeaderUser.vue | 7 ++- .../settings/OrganizationMember.vue | 55 ++++++++----------- 4 files changed, 32 insertions(+), 37 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/UserController.java b/backend/src/main/java/io/metersphere/controller/UserController.java index 6bb7923634..4263463373 100644 --- a/backend/src/main/java/io/metersphere/controller/UserController.java +++ b/backend/src/main/java/io/metersphere/controller/UserController.java @@ -62,9 +62,10 @@ public class UserController { } @PostMapping("/switch/source/{sourceId}") - public void switchUserRole(@PathVariable(value = "sourceId") String sourceId) { + public UserDTO switchUserRole(@PathVariable(value = "sourceId") String sourceId) { UserDTO user = SessionUtils.getUser(); userService.switchUserRole(user, sourceId); + return SessionUtils.getUser(); } @GetMapping("/info/{userId}") diff --git a/frontend/src/performance/components/HeaderTopMenus.vue b/frontend/src/performance/components/HeaderTopMenus.vue index f186232e60..ac4a608536 100644 --- a/frontend/src/performance/components/HeaderTopMenus.vue +++ b/frontend/src/performance/components/HeaderTopMenus.vue @@ -32,7 +32,9 @@ } }, mounted() { - this.activeIndex = this.$route.matched[0].path || '/' + if (this.$route.matched.length > 0) { + this.activeIndex = this.$route.matched[0].path; + } }, methods: { handleSelect(index) { diff --git a/frontend/src/performance/components/HeaderUser.vue b/frontend/src/performance/components/HeaderUser.vue index 0abba4a06a..0772afc3c5 100644 --- a/frontend/src/performance/components/HeaderUser.vue +++ b/frontend/src/performance/components/HeaderUser.vue @@ -124,8 +124,11 @@ let user = {}; user.id = this.currentUserInfo.id; user.lastSourceId = data.id; - this.$post("/user/switch/source/" + user.lastSourceId, {}); - window.location.reload(); + this.$post("/user/switch/source/" + user.lastSourceId, {},response => { + Cookies.set(TokenKey, response.data); + window.location.reload(); + }) + } } } diff --git a/frontend/src/performance/components/settings/OrganizationMember.vue b/frontend/src/performance/components/settings/OrganizationMember.vue index 8acece4256..befb41d049 100644 --- a/frontend/src/performance/components/settings/OrganizationMember.vue +++ b/frontend/src/performance/components/settings/OrganizationMember.vue @@ -63,6 +63,8 @@