接收登出消息根据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,6 +41,7 @@ export default {
} }
}, },
'$store.state.socket.beLogoutCount': async function(val) { '$store.state.socket.beLogoutCount': async function(val) {
if (this.$store.state.socket.loggedOutMsg.token === getToken()) {
this.$store.dispatch('disconnect').then(()=>{ this.$store.dispatch('disconnect').then(()=>{
this.$alert(this.$t('tip.logoutTips'), this.$t('tip.hint'), { this.$alert(this.$t('tip.logoutTips'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
@ -51,6 +52,8 @@ export default {
} }
}); });
}); });
}
}, },
'$store.state.app.transitionAnimationsCount': function(val) { '$store.state.app.transitionAnimationsCount': function(val) {
this.loading = true; this.loading = true;

View File

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