修改代码

This commit is contained in:
ival 2019-11-08 19:32:21 +08:00
parent a348552d1e
commit b049ff3be2
3 changed files with 43 additions and 30 deletions

View File

@ -5,9 +5,9 @@ export function getBaseUrl() {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 杜闪
BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -344,9 +344,6 @@ export default {
this.loading = true;
const res = await putJointTrainingSimulation(this.group);
this.mapId = res.data.mapId;
if (res.data.state == '01') {
this.starting = false;
}
this.loading = false;
},
async handleExit() {

View File

@ -163,15 +163,15 @@ export default {
const index = this.members.findIndex(elem => { return user.id == elem.id; });
if (user.userRole) {
if (index >= 0) {
this.checkUserState(user, this.members[index]);
this.members.splice(index, 1, Object.assign(this.members[index], this.transformUser(user)));
this.checkUserState(user, 'upd');
} else {
this.checkUserState(user, null);
this.members.push(this.transformUser(user));
this.checkUserState(user, 'add');
}
} else {
this.checkUserState(user, this.members[index]);
this.members.splice(index, 1);
this.checkUserState(user, 'del');
}
});
},
@ -189,32 +189,48 @@ export default {
//
this.$store.dispatch('socket/setJointRoomInfo');
},
async checkUserState(user, operate) {
switch (operate) {
case 'add':
this.$store.dispatch('socket/setChatContent', {roomTip: `${user.nickName}进入房间`});
break;
case 'upd':
async checkUserState(user, old) {
const message = {
join: true,
id: user.id,
userName: user.nickName,
userRole: user.userRole,
name: user.name,
roomTip: '',
chatInfo: true,
inSimulation: user.inSimulation,
inRoom: user.inRoom,
session: 'session',
oneself: user.id === this.$store.state.user.id
};
if (old) {
if (old.userRole) {
if (!user.inRoom) {
this.$store.dispatch('socket/setChatContent', {roomTip: `${user.nickName}退出房间`});
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}退出房间`});
if (this.userId == user.id) {
this.jumpOutRoom();
}
}
if (!old.inRoom && user.inRoom) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入房间`});
}
if (user.inSimulation) {
this.$store.dispatch('socket/setChatContent', {roomTip: `${user.nickName}进入仿真`});
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入仿真`});
if (this.userId == user.id) {
this.jumpInSimulation();
}
}
break;
case 'del':
this.$store.dispatch('socket/setChatContent', {roomTip: `${user.nickName}被提出房间`});
} else {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}被提出房间`});
if (this.userId == user.id) {
this.jumpOutRoom();
}
break;
}
} else {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入房间`});
}
},
async jumpInSimulation() {