rt-sim-training-client/src/views/newMap/displayNew/menuSystemTime.vue

101 lines
2.5 KiB
Vue
Raw Normal View History

2019-12-30 09:00:16 +08:00
<template>
2020-05-22 20:32:19 +08:00
<div v-if="isShowSystemTime" class="display-card" :style="{top: top+'px', right: xianRight+'px'}">
2019-12-30 09:00:16 +08:00
<template v-if="pause">
<span class="display-pause">{{ $t('display.systemTime.timePause') }}</span>
</template>
<template v-else>
<system-time
class="display-time"
:time="time"
/>
</template>
</div>
</template>
<script>
import { prefixIntrger } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
// 顶部时间栏显示
export default {
name: 'MenuSystemTime',
components: {
SystemTime
},
props: {
offset: {
type: Number,
required: true
},
right: {
type: Number,
required: true
}
},
data() {
return {
2020-05-22 20:32:19 +08:00
time: '00:0000',
top: 0,
xianRight: 0
2019-12-30 09:00:16 +08:00
};
},
computed: {
isShowSystemTime() {
return this.$route.params.mode == 'demon' ||
this.$route.params.mode == 'dp' ||
this.$route.params.mode == 'plan' ||
this.$route.params.mode == 'script' ||
!this.$route.params.mode;
},
pause() {
return this.$store.state.scriptRecord.simulationPause;
}
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
}
2020-05-18 11:04:39 +08:00
},
mounted() {
const initTime = this.$store.state.training.initTime;
2020-05-22 20:32:19 +08:00
this.top = this.offset;
this.xianRight = this.right;
if (this.$route.query.lineCode == 10 || this.$route.query.lineCode == 11) {
this.top = 35;
this.xianRight = this.$store.state.config.width - 340;
}
2020-05-18 11:04:39 +08:00
if (initTime > 0) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
}
2019-12-30 09:00:16 +08:00
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.display-card {
z-index: 9;
display: inline;
position: absolute;
}
.display-pause {
font-size: 21px;
font-weight: bold;
color: yellow;
}
.display-time{
padding: 3px 5px;
box-shadow: 0px 0px 5px #eee;
border-radius: 3px;
}
.display-card .el-row {
line-height: 32px !important;
}
</style>