修改代码

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://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // 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.41:9000'; // 杜闪
BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;
} }

View File

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

View File

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