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 @@
-
@@ -78,7 +78,7 @@
@@ -209,6 +209,7 @@ import commonJs from "@/common/webCommon"; import DistWork from "@/views/components_web/distWork/distWork"; import NewProj from "@/views/components_web/newProj/newProj"; import ProjSetting from "@/views/components_web/projSetting/projSetting"; +import { haveAccess, AccessCode } from '@/utils/access'; const BMap = window.BMap; const Velocity = window.Velocity; export default { @@ -219,9 +220,9 @@ export default { ProjSetting, }, data() { + const { currentPlatform } = this.$store.state; return { - imgSrc: process.env.API_HOST + "archives/cover?path=", - userPerm: sessionStorage.permission, + isUserPerm: haveAccess(currentPlatform.accessList, AccessCode.ProjectManager), nowDate: "", nowTime: "", cnName: "", @@ -315,25 +316,25 @@ export default { /** * 设置地图定位搜索位置 */ - setSearchAddress: function () { - var ac = new BMap.Autocomplete({ - //建立一个自动完成的对象 - input: "suggestId", - }); - var myValue; - var thisApp = this; - ac.addEventListener("onconfirm", function (e) { - //鼠标点击下拉列表后的事件 - var _value = e.item.value; - myValue = - _value.province + - _value.city + - _value.district + - _value.street + - _value.business; - thisApp.newProjData.projectData.address = myValue; - }); - }, + // setSearchAddress: function () { + // var ac = new BMap.Autocomplete({ + // //建立一个自动完成的对象 + // input: "suggestId", + // }); + // var myValue; + // var thisApp = this; + // ac.addEventListener("onconfirm", function (e) { + // //鼠标点击下拉列表后的事件 + // var _value = e.item.value; + // myValue = + // _value.province + + // _value.city + + // _value.district + + // _value.street + + // _value.business; + // thisApp.newProjData.projectData.address = myValue; + // }); + // }, /** * 设置日期、时间 */ diff --git a/src/views/platform_center/index.vue b/src/views/platform_center/index.vue index 8e630bdc..db064a52 100644 --- a/src/views/platform_center/index.vue +++ b/src/views/platform_center/index.vue @@ -87,8 +87,9 @@ export default { }, methods: { navToPlatform(platformInfo, isCompanyConsole = false) { - // 设置将要进入的平台对应的企业id - this.$store.setCurrentCompanyId(platformInfo.orgId); + // 设置将要进入的平台 + // this.$store.setCurrentCompanyId(platformInfo.orgId); + this.$store.setCurrentPlatform(platformInfo); this.$router.push({ path: platformInfo.platformType === PLATFORM_TYPE.MANAGE_CENTER