解决 页面刷新 用户进入房间的问题
This commit is contained in:
parent
09a8b6b630
commit
5357d5c23c
@ -222,6 +222,7 @@ const socket = {
|
||||
permissionOver: {}, // 权限结束
|
||||
|
||||
roomIsSubscribe:false, // 房间是否订阅
|
||||
isInRoom:false, // 是否己经进入房间
|
||||
|
||||
tipOperateCount: 0, // 任务结束提示消息
|
||||
realDeviceInfo: 0, // 真实设备信息
|
||||
@ -281,6 +282,9 @@ const socket = {
|
||||
},
|
||||
setRoomSubscribe:(state, roomIsSubscribe)=>{
|
||||
state.roomIsSubscribe = roomIsSubscribe;
|
||||
},
|
||||
setInRoom:(state, isInRoom)=>{
|
||||
state.isInRoom = isInRoom;
|
||||
}
|
||||
},
|
||||
|
||||
@ -345,6 +349,9 @@ const socket = {
|
||||
},
|
||||
setRoomSubscribe:({ commit }, msg) => {
|
||||
commit('setRoomSubscribe', msg);
|
||||
},
|
||||
setInRoom:({ commit }, msg) => {
|
||||
commit('setInRoom', msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -172,6 +172,7 @@ export default {
|
||||
async joinRoom() {
|
||||
this.disabled = true;
|
||||
await getjointTraining(this.jointGroup);
|
||||
this.$store.dispatch('socket/setInRoom', true);
|
||||
const query = { lineCode: this.courseModel.lineCode, group: this.jointGroup, drawWay: this.drawWay};
|
||||
this.$router.push({ path: `/trainroom`, query: query });
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ import { creatSubscribe, clearSubscribe, roomTopic} from '@/utils/stomp';
|
||||
import eMembers from './e-members';
|
||||
import eChat from './e-chat';
|
||||
import eRoles from './e-roles';
|
||||
import { postRoomDetail, getJointTrainRoomUserList, getRealDevices, putJointTrainingSimulationEntrance } from '@/api/chat';
|
||||
import { postRoomDetail, getJointTrainRoomUserList, getRealDevices, putJointTrainingSimulationEntrance, getjointTraining } from '@/api/chat';
|
||||
import { getPublishMapInfo, hasDoorStationList } from '@/api/jmap/map';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { getStationList } from '@/api/runplan';
|
||||
@ -125,6 +125,9 @@ export default {
|
||||
methods: {
|
||||
async loadInit() {
|
||||
await this.subscribe();
|
||||
if (!this.$store.state.socket.setInRoom) {
|
||||
await getjointTraining(this.group);
|
||||
}
|
||||
await this.getRoomInfo();
|
||||
await this.getUserList();
|
||||
await this.getStandList();
|
||||
|
Loading…
Reference in New Issue
Block a user