@@ -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) { | |||
@@ -66,7 +66,7 @@ | |||
class="back_title" | |||
@click="toMainIndex()" | |||
v-show="isPage_index" | |||
>{{ user.companyName }}</span | |||
>{{ currentPlatform.orgName }}</span | |||
> | |||
</div> | |||
</div> | |||
@@ -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, // 登入密码修改弹框 | |||
@@ -39,7 +39,7 @@ | |||
class="yiyun_btn_new" | |||
id="buttonbtn" | |||
@click="showNewProj" | |||
v-if="userPerm == 1" | |||
v-if="isUserPerm" | |||
>新建项目</button> | |||
</div> | |||
</div> | |||
@@ -48,7 +48,7 @@ | |||
<div class="yiyun_row"> | |||
<!-- 右侧操作栏 --> | |||
<div class="section_item fr section_item_aside_fr"> | |||
<!-- <button class="yiyun_btn_new" id="buttonbtn" @click="showNewProj" v-if="userPerm == 1"> | |||
<!-- <button class="yiyun_btn_new" id="buttonbtn" @click="showNewProj" v-if="isUserPerm"> | |||
新建项目 | |||
</button>--> | |||
</div> | |||
@@ -78,7 +78,7 @@ | |||
<img | |||
class="fandatupian" | |||
@click="goFilePage(projItem)" | |||
v-lazy="imgSrc + projItem.showImgUrl" | |||
v-lazy="projItem.showImgUrl | resolveAvator" | |||
alt | |||
/> | |||
<div class="yiyun_product_item_top"> | |||
@@ -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; | |||
// }); | |||
// }, | |||
/** | |||
* 设置日期、时间 | |||
*/ | |||
@@ -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 | |||