diff --git a/src/views/trainRoom/index.vue b/src/views/trainRoom/index.vue index 09a73426f..650bbfc70 100644 --- a/src/views/trainRoom/index.vue +++ b/src/views/trainRoom/index.vue @@ -73,7 +73,8 @@ export default { members: [], stationList: [], standList: [], - doorList: [] + doorList: [], + timer: null }; }, computed: { @@ -109,19 +110,27 @@ export default { // 设备信息 '$store.state.socket.realDeviceInfo': async function (val) { await this.getStandList(); + }, + // 路由切换 + '$route': async function() { + await this.loadInit(); } }, async created() { - await this.getRoomInfo(); - await this.getUserList(); - await this.getStandList(); - await this.getStaionList(this.room.mapId); - await this.getDoorList(this.room.mapId, this.stationList); - this.timeDemon = setInterval(() => { - checkLoginLine(); - }, 5000 * 60); + await this.loadInit(); }, methods: { + async loadInit() { + await this.getRoomInfo(); + await this.getUserList(); + await this.getStandList(); + await this.getStaionList(this.room.mapId); + await this.getDoorList(this.room.mapId, this.stationList); + if (this.timer) { clearInterval(this.timer); } + this.timer = setInterval(() => { + checkLoginLine(); + }, 5000 * 60); + }, async getRoomInfo() { const resp = await postRoomDetail(this.group); this.room = {