删除仿真里的回放

This commit is contained in:
joylink_cuiweidong 2019-12-27 11:30:49 +08:00
parent 1ad20fe522
commit 25ff5bdb6b
3 changed files with 23 additions and 252 deletions

View File

@ -25,8 +25,6 @@
<menu-plan v-if="isPlan" ref="menuPlan" :offset="offset" :group="group" /> <menu-plan v-if="isPlan" ref="menuPlan" :offset="offset" :group="group" />
<menu-replay v-if="isReplay" ref="menuReplay" :offset="offset" :group="group" />
<menu-script v-if="isScript" ref="menuScript" :offset="offset" :group="group" /> <menu-script v-if="isScript" ref="menuScript" :offset="offset" :group="group" />
<menu-schema <menu-schema
@ -59,7 +57,7 @@ import FaultChoose from './demon/faultChoose';
import MapSystemDraft from '@/views/mapsystem/index'; import MapSystemDraft from '@/views/mapsystem/index';
import MenuExam from '@/views/display/menuExam'; import MenuExam from '@/views/display/menuExam';
import MenuLesson from '@/views/display/menuLesson'; import MenuLesson from '@/views/display/menuLesson';
import MenuReplay from '@/views/display/menuReplay'; // import MenuReplay from '@/views/display/menuReplay';
import MenuDemon from '@/views/display/menuDemon'; import MenuDemon from '@/views/display/menuDemon';
import MenuScreen from '@/views/display/menuScreen'; import MenuScreen from '@/views/display/menuScreen';
import MenuSchema from '@/views/display/menuSchema'; import MenuSchema from '@/views/display/menuSchema';
@ -93,7 +91,7 @@ export default {
AddQuest, AddQuest,
MenuExam, MenuExam,
MenuLesson, MenuLesson,
MenuReplay, // MenuReplay,
MapSystemDraft, MapSystemDraft,
MenuPlan, MenuPlan,
MenuDemon, MenuDemon,
@ -191,9 +189,6 @@ export default {
isScreen() { isScreen() {
return this.mode === 'dp'; return this.mode === 'dp';
}, },
isReplay() {
return this.mode === 'replay';
},
isScript() { isScript() {
return this.mode === 'script'; return this.mode === 'script';
}, },
@ -260,9 +255,6 @@ export default {
}, },
async beforeDestroy() { async beforeDestroy() {
await this.clearAllTimer(); await this.clearAllTimer();
if (!this.isReplay) {
await this.quit();
}
await this.$store.dispatch('training/reset'); await this.$store.dispatch('training/reset');
await this.$store.dispatch('map/mapClear'); await this.$store.dispatch('map/mapClear');
EventBus.$off('clearCheckLogin'); EventBus.$off('clearCheckLogin');
@ -357,15 +349,11 @@ export default {
// //
async initLoadData() { async initLoadData() {
this.$store.dispatch('training/reset'); this.$store.dispatch('training/reset');
debugger;
try { try {
if (!this.isReplay) { await this.loadSimulationInfo();
await this.loadSimulationInfo(); if (this.isDemon) {
}
if (this.isReplay) {
await this.initLoadReplayData();
} else if (this.isDemon) {
await this.initLoadDemonData(); await this.initLoadDemonData();
} else if (this.isScreen) { } else if (this.isScreen) {
await this.initLoadScreenData(); await this.initLoadScreenData();
@ -395,6 +383,7 @@ export default {
const resp = await getTrainingDetail(this.trainingId); const resp = await getTrainingDetail(this.trainingId);
if (resp && resp.code == 200) { if (resp && resp.code == 200) {
const detail = resp.data; const detail = resp.data;
debugger;
const rest = await getProductDetail(detail.prdId); const rest = await getProductDetail(detail.prdId);
if (rest && rest.code == 200) { if (rest && rest.code == 200) {
const data = rest.data; const data = rest.data;
@ -409,18 +398,6 @@ export default {
this.endViewLoading(); this.endViewLoading();
} }
}, },
//
async initLoadReplayData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', '');
if (parseInt(this.mapId)) {
await this.loadMapDataById(this.mapId);
} else {
this.endViewLoading();
}
},
// 仿 // 仿
async initLoadDemonData() { async initLoadDemonData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL); this.$store.dispatch('training/end', TrainingMode.NORMAL);

View File

@ -26,8 +26,6 @@
<menu-plan v-if="isPlan" ref="menuPlan" :offset="offset" :group="group" /> <menu-plan v-if="isPlan" ref="menuPlan" :offset="offset" :group="group" />
<menu-replay v-if="isReplay" ref="menuReplay" :offset="offset" :group="group" />
<menu-script v-if="isScript" ref="menuScript" :offset="offset" :group="group" /> <menu-script v-if="isScript" ref="menuScript" :offset="offset" :group="group" />
<menu-schema <menu-schema
@ -55,7 +53,6 @@
import MapSystemDraft from '@/views/mapsystem/index'; import MapSystemDraft from '@/views/mapsystem/index';
import MenuExam from '@/views/display/menuExam'; import MenuExam from '@/views/display/menuExam';
import MenuLesson from '@/views/display/menuLesson'; import MenuLesson from '@/views/display/menuLesson';
import MenuReplay from '@/views/display/menuReplay';
import MenuDemon from '@/views/display/menuDemon'; import MenuDemon from '@/views/display/menuDemon';
import MenuScreen from '@/views/display/menuScreen'; import MenuScreen from '@/views/display/menuScreen';
import MenuSchema from '@/views/display/menuSchema'; import MenuSchema from '@/views/display/menuSchema';
@ -84,7 +81,6 @@ export default {
components: { components: {
MenuExam, MenuExam,
MenuLesson, MenuLesson,
MenuReplay,
MapSystemDraft, MapSystemDraft,
MenuPlan, MenuPlan,
MenuDemon, MenuDemon,
@ -177,9 +173,6 @@ export default {
isScreen() { // isScreen() { //
return this.mode === 'dp'; return this.mode === 'dp';
}, },
isReplay() { //
return this.mode === 'replay';
},
isScript() { isScript() {
return this.mode === 'script'; return this.mode === 'script';
}, },
@ -243,9 +236,6 @@ export default {
}, },
async beforeDestroy() { async beforeDestroy() {
await this.clearAllTimer(); await this.clearAllTimer();
if (!this.isReplay) {
await this.quit();
}
await this.$store.dispatch('training/reset'); await this.$store.dispatch('training/reset');
await this.$store.dispatch('map/mapClear'); await this.$store.dispatch('map/mapClear');
EventBus.$off('clearCheckLogin'); EventBus.$off('clearCheckLogin');
@ -342,13 +332,9 @@ export default {
this.$store.dispatch('training/reset'); this.$store.dispatch('training/reset');
try { try {
if (!this.isReplay) { await this.loadSimulationInfo();
await this.loadSimulationInfo();
}
if (this.isReplay) { if (this.isDemon) {
await this.initLoadReplayData();
} else if (this.isDemon) {
await this.initLoadDemonData(); await this.initLoadDemonData();
} else if (this.isScreen) { } else if (this.isScreen) {
await this.initLoadScreenData(); await this.initLoadScreenData();
@ -392,18 +378,6 @@ export default {
this.endViewLoading(); this.endViewLoading();
} }
}, },
//
async initLoadReplayData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', '');
if (parseInt(this.mapId)) {
await this.loadMapDataById(this.mapId);
} else {
this.endViewLoading();
}
},
// 仿 // 仿
async initLoadDemonData() { async initLoadDemonData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL); this.$store.dispatch('training/end', TrainingMode.NORMAL);
@ -532,23 +506,23 @@ export default {
this.drivingShow = true; this.drivingShow = true;
this.$refs.Jl3dDrive.show(this.mapId, this.group); this.$refs.Jl3dDrive.show(this.mapId, this.group);
} else { } else {
let routeData = this.$router.resolve({ const routeData = this.$router.resolve({
  path:'/jlmap3d/sandbox', path:'/jlmap3d/sandbox',
query:{ query:{
mapid:this.mapId, mapid:this.mapId,
group:this.group, group:this.group,
token:getToken(), token:getToken()
} }
}); });
window.open(routeData.href, '_blank','noopener noreferrer'); window.open(routeData.href, '_blank', 'noopener noreferrer');
} }
}, },
devicemodel(){ devicemodel() {
if(this.deviceShow == false){ if (this.deviceShow == false) {
this.deviceShow = true; this.deviceShow = true;
}else{ } else {
this.deviceShow = false; this.deviceShow = false;
} }
}, },
showScheduling() { showScheduling() {

View File

@ -1,180 +0,0 @@
<template>
<div>
<div>
<chart-view ref="chatView" :group="group" />
</div>
<div class="draft-box">
<div class="draft-menu">
<el-row>
<el-col :span="4">
<el-select v-model="speed" :placeholder="$t('display.replay.pleaseSelect')" @change="changeSpeed">
<el-option
v-for="item in optionsList"
:key="item.value"
:label="item.label"
size="mini"
:value="item.value"
/>
</el-select>
</el-col>
<el-col :span="4">
<el-button type="primary" class="back btn" @click="play">{{ playName }}</el-button>
</el-col>
<el-col :span="12">
<el-progress class="progress" :percentage="progress" style="width: 100%" :show-text="false" />
</el-col>
<el-col :span="2">
<el-button type="primary" class="back" @click="back">{{ $t('display.replay.back') }}</el-button>
</el-col>
</el-row>
</div>
</div>
</div>
</template>
<!-- 回放界面 -->
<script>
import { Notification } from 'element-ui';
// import { exitFullscreen } from '@/utils/screen';
import { putsSimulationRecord, putsSimulationRecordPause, putsSimulationRecordPlay, putsSimulationRecordPlaySpeed, putsSimulationRecordplayTime } from '@/api/simulationRecord';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'MenuReplay',
components: {
},
props: {
group: {
type: String,
required: true
},
offset: {
type: Number,
required: true
}
},
data() {
return {
isDisable: false,
startLoading: false,
speed: '1X',
level: 1,
isPlay: false,
time: '',
timeInterval: null,
progress: 0,
schedule: 0,
optionsList: [
{
label: '1X',
value: '1'
},
{
label: '2X',
value: '2'
},
{
label: '4X',
value: '4'
},
{
label: '8X',
value: '8'
}
]
};
},
computed: {
playName() {
return this.isPlay ? this.$t('display.replay.pause') : this.$t('display.replay.play');
}
},
watch: {
'$store.state.map.mapViewLoadedCount': function() {
this.isPlay = true;
}
},
mounted() {
EventBus.$emit('showChat');
this.time = (+new Date(this.$route.query.destroyTime) - +new Date(this.$route.query.createTime)) / 1000;
this.timeIntervals();
},
beforeDestroy() {
clearInterval(this.timeInterval);
this.timeInterval = null;
},
methods: {
timeIntervals() {
const timebili = 100 / this.time;
if (!this.timeInterval) {
this.timeInterval = setInterval(() => {
if (this.isPlay) {
this.progress += (this.level) * timebili;
if (this.progress >= 100) {
clearInterval(this.timeInterval);
this.timeInterval = null;
this.progress = 100;
this.isPlay = false;
}
}
}, 1000);
}
},
async play() {
this.isPlay = !this.isPlay;
if (this.isPlay) {
if (this.progress >= 100) {
this.progress = 0;
this.timeIntervals();
this.$refs.chatView.clearTextList();
await putsSimulationRecordplayTime(this.$route.query.replayId, 0);
} else {
await putsSimulationRecordPlay(this.$route.query.replayId);
}
} else {
await putsSimulationRecordPause(this.$route.query.replayId);
}
},
async changeSpeed(val) {
this.level = val;
await putsSimulationRecordPlaySpeed(this.$route.query.replayId, val);
},
async back() {
await putsSimulationRecord(this.$route.query.replayId);
history.go(-1);
Notification.closeAll();
// exitFullscreen();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.draft-box {
position: absolute;
display: inline;
bottom: 10px;
right: 0px;
.draft-menu {
position: static;
width: 800px;
float: right;
.back {
z-index: 100000;
/deep/ .el-button {
font-weight: bold;
}
}
.progress {
left: -30px;
position: relative;
top: 14px;
}
}
}
</style>