diff --git a/src/store/index.js b/src/store/index.js index a5f1c875..9793f5c7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -8,6 +8,7 @@ const initialState = () => ({ accountName: undefined, userName: undefined, platformList: [], + currentPlatform: {}, currentCompanyId: undefined, }); @@ -16,10 +17,12 @@ const getBootstrapState = () => { try { const sessionState = JSON.parse(sessionStorage.getItem('user')); const currentCompanyId = sessionStorage.getItem('companyId'); + const currentPlatform = JSON.parse(sessionStorage.getItem('platform') || '{}'); if (sessionState && sessionState.accountId) { state.isLogin = true; Object.assign(state, sessionState); state.currentCompanyId = currentCompanyId; + state.currentPlatform = currentPlatform; } } catch (e) { console.log('加载session数据失败'); @@ -31,12 +34,13 @@ const getBootstrapState = () => { export default { state: getBootstrapState(), - setCurrentCompanyId(v) { - this.state.currentCompanyId = v; - sessionStorage.companyId = v; + setCurrentPlatform(platformInfo) { + this.state.currentPlatform = platformInfo; + this.state.currentCompanyId = platformInfo.orgId; + sessionStorage.companyId = platformInfo.orgId; + sessionStorage.platform = JSON.stringify(platformInfo); }, async login(UserName, PassWord) { - const loginRes = await fetchApi('authentication/login', { UserName, PassWord }); const loginSucc = loginRes.Code === 0; if (!loginSucc) { diff --git a/src/views/components_web/head/head.vue b/src/views/components_web/head/head.vue index 47710f4b..dd329e6d 100644 --- a/src/views/components_web/head/head.vue +++ b/src/views/components_web/head/head.vue @@ -66,7 +66,7 @@ class="back_title" @click="toMainIndex()" v-show="isPage_index" - >{{ user.companyName }}{{ currentPlatform.orgName }} @@ -1415,7 +1415,9 @@ export default { isShowOutWorkSpace: Boolean, }, data() { + const { currentCompanyId, currentPlatform, userName} = this.$store.state; return { + currentPlatform, imgSrc: process.env.API_HOST + "archives/cover?path=", headSrc: process.env.API_HOST + "archives/head?path=", totalList: [ @@ -1464,7 +1466,7 @@ export default { }, ], editusername: { - oldUserName: sessionStorage.userName, + oldUserName: userName, newUserName: "", sureUserName: "", password: "", @@ -1521,7 +1523,7 @@ export default { }, cloudManagerBoxPain: false, //默认隐藏置面板 user: "", - uploadCompId: sessionStorage.companyId, + uploadCompId: currentCompanyId, uploadTypeHead: 3, projName: "", showeditpassword: false, // 登入密码修改弹框 diff --git a/src/views/main_web/index/index.vue b/src/views/main_web/index/index.vue index 9e728f12..6ff46080 100644 --- a/src/views/main_web/index/index.vue +++ b/src/views/main_web/index/index.vue @@ -39,7 +39,7 @@ class="yiyun_btn_new" id="buttonbtn" @click="showNewProj" - v-if="userPerm == 1" + v-if="isUserPerm" >新建项目 @@ -48,7 +48,7 @@