代码调整

This commit is contained in:
joylink_cuiweidong 2022-11-29 18:25:50 +08:00
parent 611d5a4e59
commit 72e9a4535f
3 changed files with 64 additions and 22 deletions

View File

@ -165,6 +165,14 @@ const user = {
});
});
},
GetUserInfo({ commit }, token) {
return new Promise((resolve, reject) => {
getInfo(token).then(response => {
const user = response.data;
resolve(user);
});
});
},
// 前端登出
FedLogOut({ commit }) {
commit('SUBSCRIBE_UN');

View File

@ -1,8 +1,15 @@
<template>
<div>
<!-- 设备登陆 -->
<div v-if="syncLogin">
{{}}
<div
v-if="syncLogin"
:style="{ 'background-image': 'url(' + deviceImg + ')' }"
class="login-container"
>
<div class="loadingText">
<span class="el-icon-loading" />
<span>{{ loadingText }}</span>
</div>
</div>
<div v-else v-show="loadedConfig" class="login-container" :style="{ 'background-image': showBackPic?'url(' + bgImg + ')':'none' }">
<!-- 中英文切换 -->
@ -46,6 +53,11 @@ import NormalLogin from './normalLogin';
import BaseDevelopment from './baseDevelopment';
import ForgetPassword from './forgetPassword';
import OrgSelect from './orgSelect';
import bgIbpImg from '@/assets/bg_ibp.png';
import bgIscsImg from '@/assets/bg_iscs.jpg';
import bgCctvImg from '@/assets/bg_cctv.jpg';
import bgLswImg from '@/assets/bg_lsw.jpg';
import bgPsdImg from '@/assets/bg_psd.png';
export default {
name:'LoginNew',
// components: { Register },
@ -65,16 +77,21 @@ export default {
baseDevelopment:false, //
loginOrgTitle:'',
loginProLogo:'',
aboutSystem:''
aboutSystem:'',
loadingText:'',
deviceImg:''
};
},
computed: {
project() {
return this.$route.query.project || 'login';
},
type() {
return this.$route.query.type;
},
syncLogin() {
const synchronousLogin = ['VR_IBP', 'LSW', 'CCTV', 'ISCS_LW', 'ISCS_CW', 'VR_PSD', 'SANDBOX', 'ILW', 'PIS_STAND', 'PIS_TRAIN'];
return this.$route.query.type ? synchronousLogin.includes(this.$route.query.type) : false;
return this.type ? synchronousLogin.includes(this.type) : false;
},
bgImg() {
return bgImg;
@ -136,7 +153,20 @@ export default {
this.$refs.normalLogin.selectOrg(orgId);
},
deviceRelatedLogin() {
const deviceMap = {
ISCS_LW:{text:'检测现地工作站登录中', Img:bgIscsImg },
ISCS_CW:{text:'检测行调工作站登录中', Img:bgIscsImg},
VR_IBP:{text:'检测现地工作站登陆中', Img:bgIbpImg},
CCTV:{text:'检测教员机登录中', Img:bgCctvImg},
VR_PSD:{text:'检测教员机登录中', Img:bgPsdImg},
LSW:{text:'检测教员机登录中', Img:bgLswImg},
ILW:{text:'检测教员机登录中', Img:bgLswImg},
PIS_TRAIN:{text:'检测教员机登录中'},
PIS_STAND:{text:'检测教员机登录中'},
SANDBOX:{Img:bgLswImg}
};
this.loadingText = deviceMap[this.type].text;
this.deviceImg = deviceMap[this.type].Img;
}
}
};
@ -199,5 +229,8 @@ export default {
right: 20px;
font-size: 14px;
}
.loadingText{
font-size: 36px;
}
</style>

View File

@ -85,6 +85,7 @@ import { getOrgList, selectOrgnization } from '@/api/login';
import { createSimulation, getSimulationInfoNew, getGroupByMapAndFunction } from '@/api/simulation';
import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
import { getToken} from '@/utils/auth';
export default {
name:'NormalLogin',
props: {
@ -246,14 +247,8 @@ export default {
if (params.type == 'IM') {
createSimulation(functionId).then(resp => {
const group = resp.data;
if (this.role) {
const data = [{userId: this.$store.state.user.id, memberId:this.role}];
assignUsersPlayRoles(data, group).then(() => {
this.enterSimulation(group, mapId);
});
} else {
this.enterSimulation(group, mapId);
}
this.assignUser(group, mapId);
}).catch(error=>{
if (error.code == 10003) {
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
@ -264,14 +259,7 @@ export default {
} else {
getGroupByMapAndFunction(mapId, functionId).then(resp => {
const group = resp.data;
if (this.role) {
const data = [{userId: this.$store.state.user.id, memberId:this.role}];
assignUsersPlayRoles(data, group).then(() => {
this.enterSimulation(group, mapId);
});
} else {
this.enterSimulation(group, mapId);
}
this.assignUser(group, mapId);
});
}
} else {
@ -280,14 +268,27 @@ export default {
}
});
},
assignUser(group, mapId) {
if (this.role) {
this.$store.dispatch('changeRole');
this.$store.dispatch('GetUserInfo', getToken()).then(res => {
const data = [{userId: res.id, memberId:this.role}];
assignUsersPlayRoles(data, group).then(() => {
this.enterSimulation(group, mapId);
});
});
} else {
this.enterSimulation(group, mapId);
}
},
enterSimulation(group, mapId) {
getSimulationInfoNew(group).then(response=>{
debugger;
const paramVO = response.data.paramVO;
const query = {
lineCode: response.data.map.lineCode,
group: group,
mapId: mapId,
simType:paramVO.type,
project: this.project
};
if (paramVO && paramVO.domConfig && paramVO.domConfig.client) {