接收登出消息根据token 判断是否登出

This commit is contained in:
fan 2021-08-06 17:46:30 +08:00
parent bc47132b21
commit a01ffd71d0
2 changed files with 15 additions and 10 deletions

View File

@ -41,16 +41,19 @@ export default {
}
},
'$store.state.socket.beLogoutCount': async function(val) {
this.$store.dispatch('disconnect').then(()=>{
this.$alert(this.$t('tip.logoutTips'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
callback: action => {
this.$store.dispatch('exit').then(resp => {
this.$router.push({path: loginInfo[getSessionStorage('project')].loginPath});
});
}
if (this.$store.state.socket.loggedOutMsg.token === getToken()) {
this.$store.dispatch('disconnect').then(()=>{
this.$alert(this.$t('tip.logoutTips'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
callback: action => {
this.$store.dispatch('exit').then(resp => {
this.$router.push({path: loginInfo[getSessionStorage('project')].loginPath});
});
}
});
});
});
}
},
'$store.state.app.transitionAnimationsCount': function(val) {
this.loading = true;

View File

@ -135,6 +135,7 @@ function handle(state, data) {
break;
case 'Be_Logged_Out': // 重复登录被登出
state.beLogoutCount++;
state.loggedOutMsg = msg;
break;
case 'Simulation_Run_Plan_Reload': // 运行图变更
state.runPlanReloadCount++;
@ -342,7 +343,8 @@ const socket = {
simulationSpeed: 1, // 仿真倍速
simulationPause: false,
simulationPslStatus: [], // PSL面板按钮状态信息
simulationPlanChange:{} // 运行图加线/抽线/变化推送消息
simulationPlanChange:{}, // 运行图加线/抽线/变化推送消息
loggedOutMsg: ''
},
getters: {
},