2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-02 10:36:17 +08:00
|
|
|
<div>
|
2019-07-26 13:32:43 +08:00
|
|
|
<div>
|
2019-08-02 10:36:17 +08:00
|
|
|
<chart-view ref="chatView" :group="group" />
|
2019-07-26 13:32:43 +08:00
|
|
|
</div>
|
2019-08-02 10:36:17 +08:00
|
|
|
<div class="draft-box">
|
|
|
|
<div class="draft-menu">
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="4">
|
2019-09-11 15:33:00 +08:00
|
|
|
<el-select v-model="speed" :placeholder="$t('display.replay.pleaseSelect')" @change="changeSpeed">
|
2019-08-02 10:36:17 +08:00
|
|
|
<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">
|
2019-09-11 15:33:00 +08:00
|
|
|
<el-button type="primary" class="back" @click="back">{{$t('display.replay.back')}}</el-button>
|
2019-08-02 10:36:17 +08:00
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<!-- 回放界面 -->
|
|
|
|
<script>
|
2019-08-02 10:36:17 +08:00
|
|
|
import { Notification } from 'element-ui';
|
|
|
|
import { exitFullscreen } from '@/utils/screen';
|
|
|
|
import ChartView from './demon/chatBox';
|
|
|
|
import { putsSimulationRecord, putsSimulationRecordPause, putsSimulationRecordPlay, putsSimulationRecordPlaySpeed, putsSimulationRecordplayTime } from '@/api/simulationRecord';
|
2019-08-02 10:58:28 +08:00
|
|
|
import { EventBus } from '@/scripts/event-bus';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-02 10:36:17 +08:00
|
|
|
export default {
|
|
|
|
name: 'MenuReplay',
|
|
|
|
components: {
|
|
|
|
ChartView
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
offset: {
|
2019-08-29 17:16:33 +08:00
|
|
|
type: Number,
|
|
|
|
required: true
|
2019-08-02 10:36:17 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isDisable: false,
|
|
|
|
startLoading: false,
|
|
|
|
speed: '1X',
|
|
|
|
level: 1,
|
2019-08-29 17:16:33 +08:00
|
|
|
isPlay: false,
|
2019-08-02 10:36:17 +08:00
|
|
|
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() {
|
2019-09-11 15:33:00 +08:00
|
|
|
return this.isPlay ? this.$t('display.replay.pause') : this.$t('display.replay.play');
|
2019-08-02 10:36:17 +08:00
|
|
|
}
|
|
|
|
},
|
2019-08-29 17:16:33 +08:00
|
|
|
watch: {
|
|
|
|
'$store.state.map.mapViewLoadedCount': function() {
|
|
|
|
this.isPlay = true;
|
|
|
|
}
|
|
|
|
},
|
2019-08-02 10:36:17 +08:00
|
|
|
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();
|
2019-11-08 18:52:09 +08:00
|
|
|
// exitFullscreen();
|
2019-08-02 10:36:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
|
|
|
.draft-box {
|
|
|
|
position: absolute;
|
|
|
|
display: inline;
|
|
|
|
bottom: 10px;
|
2019-08-29 17:16:33 +08:00
|
|
|
right: 0px;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
|
|
.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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-02 10:36:17 +08:00
|
|
|
</style>
|