2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-08 11:29:03 +08:00
|
|
|
<el-dialog
|
|
|
|
v-dialogDrag
|
|
|
|
:title="title"
|
|
|
|
:visible.sync="show"
|
|
|
|
width="600px"
|
|
|
|
:before-close="doClose"
|
|
|
|
:z-index="2000"
|
|
|
|
:modal="false"
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
>
|
2019-08-29 17:16:33 +08:00
|
|
|
<div style="height: 80px; line-height: 80px; font-size: 16px; padding-left: 10px;">{{ roomName }}{{ $t('global.inviteJoinRoom') }}</div>
|
2019-08-08 11:29:03 +08:00
|
|
|
<span slot="footer" class="dialog-footer">
|
2019-11-14 13:59:33 +08:00
|
|
|
<el-button v-loading="loading" type="primary" @click="handleJoin">{{ $t('global.confirm') }}</el-button>
|
2019-08-29 17:16:33 +08:00
|
|
|
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
|
2019-08-08 11:29:03 +08:00
|
|
|
</span>
|
|
|
|
</el-dialog>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-08 11:29:03 +08:00
|
|
|
import { launchFullscreen } from '@/utils/screen';
|
2020-07-13 14:34:56 +08:00
|
|
|
import { getPublishMapInfo } from '@/api/jmap/map';
|
|
|
|
import { getToken } from '@/utils/auth';
|
|
|
|
import { creatSubscribe, clearSubscribe, roomTopic} from '@/utils/stomp';
|
2020-07-10 18:41:29 +08:00
|
|
|
// 仿真邀请消息
|
2019-08-08 11:29:03 +08:00
|
|
|
export default {
|
2019-10-31 17:30:24 +08:00
|
|
|
name: 'DeomonList',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dialogShow: false,
|
|
|
|
group: '',
|
|
|
|
roomName: '',
|
2020-07-13 14:34:56 +08:00
|
|
|
state: '',
|
2019-11-14 13:59:33 +08:00
|
|
|
mapId: '',
|
2020-06-30 18:35:57 +08:00
|
|
|
lineCode: '',
|
2019-11-14 13:59:33 +08:00
|
|
|
loading: false
|
2019-10-31 17:30:24 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
show() {
|
|
|
|
return this.dialogShow;
|
|
|
|
},
|
|
|
|
title() {
|
|
|
|
return this.$t('global.synthesisTrainingTitle');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
doShow(data) {
|
2020-07-01 18:52:29 +08:00
|
|
|
this.roomName = data.creator.nickname;
|
2019-10-31 17:30:24 +08:00
|
|
|
this.group = data.group;
|
2020-07-13 14:34:56 +08:00
|
|
|
this.mapId = data.mapId || data.map.id;
|
|
|
|
this.lineCode = (data.map || {}).lineCode;
|
|
|
|
this.state = data.state;
|
2019-10-31 17:30:24 +08:00
|
|
|
this.dialogShow = true;
|
2019-11-14 13:59:33 +08:00
|
|
|
this.loading = false;
|
2019-10-31 17:30:24 +08:00
|
|
|
},
|
|
|
|
doClose() {
|
|
|
|
this.dialogShow = false;
|
|
|
|
},
|
2020-07-13 14:34:56 +08:00
|
|
|
async subscribe() {
|
|
|
|
if (!this.$store.state.socket.roomIsSubscribe) {
|
|
|
|
this.clearSubscribe();
|
|
|
|
const header = { group: this.group || '', 'X-Token': getToken() };
|
|
|
|
creatSubscribe(`${roomTopic}\/${this.group}`, header);
|
|
|
|
await this.$store.dispatch('socket/setRoomSubscribe', true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async clearSubscribe() {
|
|
|
|
clearSubscribe(`${roomTopic}\/${this.group}`);
|
|
|
|
await this.$store.dispatch('socket/setRoomSubscribe', false);
|
|
|
|
},
|
2019-10-31 17:30:24 +08:00
|
|
|
async handleJoin() {
|
2019-11-14 13:59:33 +08:00
|
|
|
try {
|
|
|
|
this.loading = true;
|
2020-10-28 13:51:26 +08:00
|
|
|
await getPublishMapInfo(this.mapId);
|
2020-10-26 11:07:49 +08:00
|
|
|
launchFullscreen();
|
|
|
|
const query = { lineCode: this.lineCode, mapId: this.mapId, group: this.group};
|
|
|
|
this.$router.push({path: `/jointTrainingNew`, query: query});
|
2019-11-14 13:59:33 +08:00
|
|
|
this.dialogShow = false;
|
|
|
|
} catch (e) {
|
2020-03-23 16:00:28 +08:00
|
|
|
this.$messageBox(this.$t('tip.enterTrainingRoomFailed'));
|
2019-11-14 13:59:33 +08:00
|
|
|
console.error(e);
|
|
|
|
} finally {
|
|
|
|
this.loading = false;
|
2020-03-23 16:00:28 +08:00
|
|
|
this.dialogShow = false;
|
2019-10-31 17:30:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-08 11:29:03 +08:00
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
/deep/ {
|
|
|
|
.el-dialog__body {
|
|
|
|
padding: 0px 30px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-tree-node.is-current>.el-tree-node__content {
|
|
|
|
background-color: #e4e3e3 !important;
|
|
|
|
}
|
|
|
|
}
|
2019-08-08 11:29:03 +08:00
|
|
|
</style>
|