diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 773373e..328d553 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -137,13 +137,20 @@ const user = { const parentId=response.result.parentId; const puwwcId=response.result.puwwcId; const userInformation=response.result.userInfo; - console.log('------>登录后的信息',response) //Vue.ls.set(USER_AUTH,authData); sessionStorage.setItem(USER_AUTH,JSON.stringify(authData)); sessionStorage.setItem(SYS_BUTTON_AUTH,JSON.stringify(allAuthData)); - sessionStorage.setItem(PARENT_ID,parentId); - sessionStorage.setItem(PUWWC_Id,puwwcId); - sessionStorage.setItem(USER_INFORMATION,JSON.stringify(userInformation)); + if (!sessionStorage.getItem(PARENT_ID)){ + sessionStorage.setItem(PARENT_ID,parentId); + } + if (!sessionStorage.getItem(PUWWC_Id)){ + sessionStorage.setItem(PUWWC_Id,puwwcId); + } + if (Vue.ls.get(USER_INFO)){ + sessionStorage.setItem(USER_INFORMATION,JSON.stringify(Vue.ls.get(USER_INFO))); + }else { + sessionStorage.setItem(USER_INFORMATION,JSON.stringify(userInformation)); + } sessionStorage.setItem('ASIDE_MEAN',JSON.stringify(menuData)); if (menuData && menuData.length > 0) { //update--begin--autor:qinfeng-----date:20200109------for:JEECG-63 一级菜单的子菜单全部是隐藏路由,则一级菜单不显示------ diff --git a/src/views/user/LoginSelectTenant.vue b/src/views/user/LoginSelectTenant.vue index fd4b46d..aebf12e 100644 --- a/src/views/user/LoginSelectTenant.vue +++ b/src/views/user/LoginSelectTenant.vue @@ -52,7 +52,7 @@ import Vue from 'vue' import { getAction,putAction } from '@/api/manage' - import { USER_INFO } from "@/store/mutation-types" + import { USER_INFO,PARENT_ID,PUWWC_Id } from "@/store/mutation-types" import store from './Login' export default { @@ -159,10 +159,17 @@ } putAction("/sys/selectDepart",obj).then(res=>{ if(res.success){ + console.log(res.result,"切换部门") const userInfo = res.result.userInfo; Vue.ls.set(USER_INFO, userInfo, 7 * 24 * 60 * 60 * 1000); this.$store.commit('SET_INFO', userInfo); - //console.log("---切换组织机构---userInfo-------",store.getters.userInfo.orgCode); + const parentId=res.result.parentId; + sessionStorage.setItem(PARENT_ID,parentId); + if (res.result.puwwcId){ + console.log(res.result.puwwcId) + const puwwcId=res.result.puwwcId; + sessionStorage.setItem('PUWWC_Id',puwwcId); + } resolve(); }else{ this.requestFailed(res)