From ad29ed889034f6fa4ca7f2bc3cb1c6a64c696514 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Thu, 27 Aug 2020 16:43:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=80=83=E8=AF=95=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=8A=A0=E8=BD=BD=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/map.js | 17 ++++++++++++----- src/views/newMap/displayNew/exam/index.vue | 4 ++-- .../newMap/displayNew/exam/tipExamList.vue | 6 +++--- src/views/newMap/displayNew/index.vue | 6 +++--- src/views/newMap/jlmapNew/index.vue | 7 +++++-- .../newMap/mapsystemNew/plugin/trainingtip.vue | 1 - 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 486ad6c73..6fdca3673 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -169,11 +169,18 @@ class Jlmap { } setCenter(deviceCode) { - const device = this.mapDevice[deviceCode]; - if (device && device.instance) { - var rect = createBoundingRect(device.instance); - var dcenter = calculateDCenter(rect, { width: this.$zr.getWidth(), height: this.$zr.getHeight() }); - this.setOptions(dcenter); + const arr = Object.keys(this.mapDevice); + if (arr.length != 0) { + const device = this.mapDevice[deviceCode]; + if (device && device.instance) { + var rect = createBoundingRect(device.instance); + var dcenter = calculateDCenter(rect, { width: this.$zr.getWidth(), height: this.$zr.getHeight() }); + this.setOptions(dcenter); + } + } else { + setTimeout(() => { + this.setCenter(deviceCode); + }, 60); } } setRevoverBigScreen() { diff --git a/src/views/newMap/displayNew/exam/index.vue b/src/views/newMap/displayNew/exam/index.vue index 29133391f..af4803ab1 100644 --- a/src/views/newMap/displayNew/exam/index.vue +++ b/src/views/newMap/displayNew/exam/index.vue @@ -23,7 +23,7 @@ import { Notification } from 'element-ui'; import { startTrainingNew } from '@/api/jmap/training'; import { timeFormat } from '@/utils/date'; import { refreshExamList, finishOneExamQuestion } from '@/api/management/userexam'; -import { launchFullscreen } from '@/utils/screen'; +// import { launchFullscreen } from '@/utils/screen'; export default { name: 'MenuExam', @@ -154,7 +154,7 @@ export default { }); }, init() { - launchFullscreen(); + // launchFullscreen(); // 刷新考试列表 refreshExamList(this.$route.query.userExamId).then(response => { this.$store.dispatch('exam/setUsedTime', response.data.usedTime); diff --git a/src/views/newMap/displayNew/exam/tipExamList.vue b/src/views/newMap/displayNew/exam/tipExamList.vue index 2c40e95ba..63af43bb4 100644 --- a/src/views/newMap/displayNew/exam/tipExamList.vue +++ b/src/views/newMap/displayNew/exam/tipExamList.vue @@ -23,7 +23,7 @@ highlight-current @node-click="getTrainDetail" > - +  {{ trainingList.indexOf(data)+1 }}.{{ data.trainingName }} @@ -131,7 +131,7 @@ export default { } }, watch: { - '$store.state.map.mapViewLoadedCount': function() { + '$store.state.map.mapViewLoadedCount': function() { // 地图视图加载完成标识 this.$store.dispatch('exam/stopCountTime'); this.loadInitData(); this.$store.dispatch('exam/countUsedTime'); @@ -165,7 +165,7 @@ export default { minDuration: res.data.minDuration, updateTime: res.data.updateTime }; - this.$store.dispatch('exam/setCenter', res.data.locateDeviceCode); + // this.$store.dispatch('exam/setCenter', res.data.locateDeviceCode); }).catch(error => { this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message); }); diff --git a/src/views/newMap/displayNew/index.vue b/src/views/newMap/displayNew/index.vue index e5a894c98..c15da3d4b 100644 --- a/src/views/newMap/displayNew/index.vue +++ b/src/views/newMap/displayNew/index.vue @@ -230,9 +230,9 @@ export default { this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`)); this.$store.dispatch('training/countTime'); this.planRunning = resp.data.planRunning; - if (!this.planRunning) { - this.$store.dispatch('training/over'); - } + // if (!this.planRunning) { + // this.$store.dispatch('training/over'); + // } if (this.isDemon) { this.$refs.menuDemon.initPlannedDriving(this.planRunning); // 是否正在按计划行车 } else if (this.isScript) { diff --git a/src/views/newMap/jlmapNew/index.vue b/src/views/newMap/jlmapNew/index.vue index efa7649e7..338bb50e0 100644 --- a/src/views/newMap/jlmapNew/index.vue +++ b/src/views/newMap/jlmapNew/index.vue @@ -139,7 +139,10 @@ export default { }); } } - this.setCenter(code); + code && this.setCenter(code); + }, + '$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识 开始加载默认状态 + this.$store.state.exam.deviceCode && this.setCenter(this.$store.state.exam.deviceCode); }, '$store.state.config.canvasSizeCount': function (val) { this.resetSize(); @@ -352,7 +355,7 @@ export default { async simulationReset() { await this.$store.dispatch('map/clearJlmapTrainView'); await this.$store.dispatch('map/setTrainWindowShow', false); - await this.$store.dispatch('training/over'); + // await this.$store.dispatch('training/over'); await this.$store.dispatch('socket/setSimulationReset'); // 清空 await this.$store.dispatch('socket/setSimulationStart'); await this.$store.dispatch('training/setMapDefaultState'); diff --git a/src/views/newMap/mapsystemNew/plugin/trainingtip.vue b/src/views/newMap/mapsystemNew/plugin/trainingtip.vue index 766b94f1d..074fbfc3d 100644 --- a/src/views/newMap/mapsystemNew/plugin/trainingtip.vue +++ b/src/views/newMap/mapsystemNew/plugin/trainingtip.vue @@ -38,7 +38,6 @@ export default { methods: { tipInit() { this.$nextTick(() => { - console.log('tipInit',); this.$store.dispatch('training/isTeachMode').then(() => { this.tipShow = true; const offset = this.$store.state.config.canvasOffset;