2022-08-22 09:24:56 +08:00
|
|
|
<template>
|
|
|
|
<div class="train">
|
|
|
|
<menu-demon ref="menuDemon" />
|
2022-08-29 16:51:36 +08:00
|
|
|
<training-jlmap refs="trainingJlmap" />
|
2022-08-24 17:52:33 +08:00
|
|
|
<training-tip ref="trainingTip" />
|
2022-09-01 13:38:11 +08:00
|
|
|
<training-position-tip ref="trainingPositionTip" />
|
2022-09-13 17:06:36 +08:00
|
|
|
<!-- <training-menu ref="trainingMenu" :offset-bottom="offsetBottom" />-->
|
2022-08-22 09:24:56 +08:00
|
|
|
<div class="trainBack">
|
|
|
|
<el-button-group>
|
2022-08-24 17:52:33 +08:00
|
|
|
<el-button v-if="!trainingSwitch && trainingDetail" type="success" @click="handlerStart">开始</el-button>
|
|
|
|
<el-button v-if="trainingSwitch" type="danger" @click="handlerEnd">结束</el-button>
|
2022-08-22 09:24:56 +08:00
|
|
|
<el-button type="primary" @click="back">返回</el-button>
|
|
|
|
</el-button-group>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { clearSimulation } from '@/api/simulation';
|
2022-08-24 17:52:33 +08:00
|
|
|
import { startTraining, endTraining, endTrainingStep } from '@/api/jmap/training';
|
2022-08-23 18:07:28 +08:00
|
|
|
import MenuDemon from './demonMenu.vue';
|
2022-08-24 17:52:33 +08:00
|
|
|
import TrainingTip from './trainingTip';
|
2022-09-01 13:38:11 +08:00
|
|
|
import TrainingPositionTip from './trainingPositionTip';
|
2022-08-29 16:51:36 +08:00
|
|
|
import TrainingJlmap from './trainingJlmap';
|
2022-09-13 17:06:36 +08:00
|
|
|
// import TrainingMenu from './trainingMenu';
|
2022-08-22 09:24:56 +08:00
|
|
|
export default {
|
|
|
|
name: 'TrainingDesign',
|
|
|
|
components: {
|
|
|
|
MenuDemon,
|
2022-08-29 16:51:36 +08:00
|
|
|
TrainingTip,
|
2022-09-01 13:38:11 +08:00
|
|
|
TrainingJlmap,
|
2022-09-13 17:06:36 +08:00
|
|
|
TrainingPositionTip
|
|
|
|
// TrainingMenu
|
2022-08-22 09:24:56 +08:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
widthLeft: {
|
|
|
|
type: Number,
|
2022-08-23 09:24:36 +08:00
|
|
|
default: 0
|
2022-08-22 09:24:56 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-08-29 16:51:36 +08:00
|
|
|
// maskOpen: false,
|
2022-08-23 09:24:36 +08:00
|
|
|
trainingObj: null,
|
2022-08-24 17:52:33 +08:00
|
|
|
starting: false,
|
2022-08-29 11:06:11 +08:00
|
|
|
selected: null,
|
2022-09-09 13:06:12 +08:00
|
|
|
menus: null,
|
|
|
|
offsetBottom: 50
|
2022-08-22 09:24:56 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
mapId() {
|
|
|
|
return this.$route.query.mapId;
|
|
|
|
},
|
|
|
|
width() {
|
|
|
|
return this.$store.state.app.width;
|
|
|
|
},
|
|
|
|
height() {
|
|
|
|
return this.$store.state.app.height;
|
|
|
|
},
|
|
|
|
group() {
|
|
|
|
return this.$route.query.group;
|
|
|
|
},
|
2022-08-24 17:52:33 +08:00
|
|
|
teachMode() {
|
|
|
|
return this.$store.state.trainingNew.teachMode;
|
|
|
|
},
|
|
|
|
trainingSwitch() {
|
|
|
|
return this.$store.state.trainingNew.trainingSwitch;
|
|
|
|
},
|
|
|
|
trainingDetail() {
|
|
|
|
return this.$store.state.trainingNew.trainingDetail;
|
2022-08-22 09:24:56 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2022-08-30 15:38:26 +08:00
|
|
|
'$store.state.trainingNew.stepOverCount': function(val) {
|
|
|
|
this.nextStep();
|
2022-08-22 09:24:56 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async beforeDestroy() {
|
2022-08-29 11:06:11 +08:00
|
|
|
this.$store.dispatch('socket/clearTrainingOverCount');
|
2022-08-30 16:09:17 +08:00
|
|
|
this.$store.dispatch('trainingNew/clearStepOverCount');
|
2022-08-31 10:34:18 +08:00
|
|
|
this.$store.dispatch('trainingNew/setTrainingDetail', null);
|
|
|
|
this.$store.dispatch('trainingNew/trainingEnd');
|
|
|
|
this.$store.dispatch('trainingNew/clearStepOrder');
|
|
|
|
this.$store.dispatch('trainingNew/clearOperateOrder');
|
|
|
|
this.$store.dispatch('trainingNew/changeTeachMode', '');
|
2022-08-22 09:24:56 +08:00
|
|
|
},
|
|
|
|
mounted() {
|
2022-08-31 17:03:10 +08:00
|
|
|
this.$store.dispatch('trainingNew/setTrainingScore', '');
|
2022-08-22 09:24:56 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
overallTranslation(flag) {
|
|
|
|
const panel = document.getElementById('leftSlider');
|
|
|
|
if (flag) {
|
|
|
|
panel.style.transform = 'translateX(400px)';
|
|
|
|
} else {
|
|
|
|
panel.style.transform = '';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async back() {
|
|
|
|
if (this.$route.query.group) {
|
|
|
|
await clearSimulation(this.$route.query.group);
|
|
|
|
}
|
|
|
|
},
|
2022-08-24 17:52:33 +08:00
|
|
|
handlerStart() {
|
|
|
|
startTraining(this.group, {mode: this.teachMode}).then(() => {
|
|
|
|
this.$store.dispatch('trainingNew/trainingStart');
|
2022-08-31 17:03:10 +08:00
|
|
|
this.$store.dispatch('trainingNew/setTrainingScore', '');
|
2022-08-24 17:52:33 +08:00
|
|
|
}).catch(() => {
|
|
|
|
this.$message.error('开始实训失败!');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
nextStep() {
|
2022-08-29 11:06:11 +08:00
|
|
|
endTrainingStep(this.group, this.$store.state.trainingNew.stepOrder).then(resp => {
|
|
|
|
}).catch(() => {
|
|
|
|
this.$message.error('进入下一步实训失败!');
|
2022-08-24 17:52:33 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
handlerEnd() {
|
2022-08-31 17:03:10 +08:00
|
|
|
endTraining(this.group).then((resp) => {
|
2022-08-24 17:52:33 +08:00
|
|
|
this.$store.dispatch('trainingNew/trainingEnd');
|
|
|
|
this.$store.dispatch('socket/clearTrainingStepTip');
|
2022-08-29 11:06:11 +08:00
|
|
|
this.$store.dispatch('trainingNew/clearStepOrder');
|
2022-08-31 17:03:10 +08:00
|
|
|
this.$store.dispatch('trainingNew/setTrainingScore', resp.data);
|
2022-08-24 17:52:33 +08:00
|
|
|
}).catch(() => {
|
|
|
|
this.$message.error('结束实训失败!');
|
|
|
|
});
|
2022-08-22 09:24:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.train {
|
|
|
|
width: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
.trainMask{
|
|
|
|
opacity: 1;
|
|
|
|
background: #000;
|
|
|
|
position: absolute;
|
|
|
|
right: 0;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
z-index: 9;
|
|
|
|
}
|
|
|
|
.trainBack {
|
|
|
|
position: absolute;
|
|
|
|
float: right;
|
|
|
|
right: 15px;
|
|
|
|
bottom: 15px;
|
|
|
|
z-index: 19;
|
|
|
|
}
|
|
|
|
</style>
|