rt-sim-training-client/src/views/trainRoom/index.vue

195 lines
4.8 KiB
Vue
Raw Normal View History

2019-07-26 13:32:43 +08:00
<template>
2019-11-08 09:02:18 +08:00
<div class="room">
<div class="room__head">
<div class="room__head--title">
{{ $t('trainRoom.comprehensiveDrillRoom') }}
2019-10-18 17:15:04 +08:00
</div>
2019-11-08 09:02:18 +08:00
<div class="room__head--notes">
{{ $t('trainRoom.comprehensiveTrainingManager') + room.creator }}
2019-10-18 17:15:04 +08:00
</div>
</div>
2019-11-08 09:02:18 +08:00
<div class="room__container">
<e-members class="room__container--members" :user-id="userId" :room="room" :members="members" :height="height" />
<e-roles class="room__container--roles" :user-id="userId" :room="room" :members="members" :height="height" />
<e-chat class="room__container--chat" :user-id="userId" :room="room" :members="members" :height="height" />
2019-07-26 13:32:43 +08:00
</div>
2019-11-08 09:02:18 +08:00
<div class="room__footer" />
2019-10-18 17:15:04 +08:00
</div>
2019-07-26 13:32:43 +08:00
</template>
<script>
2019-11-08 09:02:18 +08:00
import eMembers from './e-members';
import eChat from './e-chat';
import eRoles from './e-roles';
import { postRoomDetail } from '@/api/chat';
2019-10-18 17:15:04 +08:00
import { getStationList } from '@/api/runplan';
2019-07-26 13:32:43 +08:00
2019-10-18 17:15:04 +08:00
export default {
2019-10-30 19:36:26 +08:00
components: {
2019-11-08 09:02:18 +08:00
eMembers,
eChat,
eRoles
2019-10-30 19:36:26 +08:00
},
data() {
return {
2019-11-08 09:02:18 +08:00
room: {
totalNum: 12,
2019-10-30 19:36:26 +08:00
group: '',
2019-11-08 09:02:18 +08:00
mapId: '',
creatorId: 1,
creator: 'Ival',
permissionRest: 1,
permissionNum: 20
2019-10-30 19:36:26 +08:00
},
2019-11-08 09:02:18 +08:00
members: [
{
nickName: 'Ival',
inRoom: true,
role: 'Instructor'
},
{
nickName: 'Dispatcher',
inRoom: true,
role: 'Dispatcher'
},
{
nickName: 'Instructor',
inRoom: true,
role: 'Instructor'
},
{
nickName: 'Attendant',
inRoom: true,
role: 'Attendant'
},
{
nickName: 'Repair',
inRoom: true,
role: 'Repair'
},
{
nickName: 'Driver',
inRoom: true,
role: 'Driver'
},
{
nickName: 'IBP',
inRoom: true,
role: 'IBP'
},
{
nickName: 'Audience1',
inRoom: true,
role: 'Audience'
},
{
nickName: 'Audience2',
inRoom: true,
role: 'Audience'
},
{
nickName: 'Audience3',
inRoom: true,
role: 'Audience'
}
],
stationList: []
2019-10-30 19:36:26 +08:00
};
},
computed: {
height() {
2019-11-08 09:02:18 +08:00
return this.$store.state.app.height - 100;
2019-10-30 19:36:26 +08:00
},
2019-11-08 09:02:18 +08:00
userId() {
if (this.$store.state.user) {
return this.$store.state.user.id;
2019-10-30 19:36:26 +08:00
}
2019-11-08 09:02:18 +08:00
return '';
2019-10-30 19:36:26 +08:00
}
},
async mounted() {
2019-11-08 09:02:18 +08:00
await this.handleGetRoomInfo();
2019-10-30 19:36:26 +08:00
},
methods: {
2019-11-08 09:02:18 +08:00
async handleGetRoomInfo() {
2019-10-30 19:36:26 +08:00
// 获取房间信息 创建人和权限总数
const res = await postRoomDetail(this.$route.query.group);
this.starting = res.data.state == '02';
2019-11-08 09:02:18 +08:00
this.room = {
mapId: res.data.mapId,
2019-10-30 19:36:26 +08:00
creatorId: res.data.creatorId,
totalNum: Number(res.data.permissionNum) + Number(res.data.audiencePermissionNum),
creator: res.data.creator.nickName,
group: res.data.group,
audienceNum: res.data.audiencePermissionNum,
2019-11-08 09:02:18 +08:00
permissionNum: res.data.permissionNum,
permissionRest: 10
2019-10-30 19:36:26 +08:00
};
2019-07-26 13:32:43 +08:00
2019-10-30 19:36:26 +08:00
// 获取设备集中站
const resp = await getStationList(res.data.mapId);
this.stationList = resp.data;
}
}
2019-10-18 17:15:04 +08:00
};
2019-07-26 13:32:43 +08:00
</script>
<style scoped lang="scss">
2019-11-08 09:02:18 +08:00
.room {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
box-sizing: border-box;
background: #f0f0f0;
&__head {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #000;
color: #fff;
padding: 10px;
position: relative;
&--title {
font-size: 22px;
font-weight: bold;
}
&--notes {
position: absolute;
left: 10px;
bottom: 5px;
}
}
&__container {
display: flex;
flex-grow: 1;
padding: 10px;
&--members {
flex-shrink: 1;
flex-grow: 1;
}
&--roles {
flex-grow: 5;
flex-shrink: 5;
}
&--chat {
flex-basis: 360px;
}
}
&__footer {
height: 20px;
}
}
2019-07-26 13:32:43 +08:00
</style>