From ef724814a03026b8a8367986cc10d120bf4a2781 Mon Sep 17 00:00:00 2001 From: yang <2319498928@qq.com> Date: Mon, 2 Feb 2026 16:51:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A6=96=E9=A1=B5):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=99=BE=E5=BA=A6=E5=9C=B0=E5=9B=BE=E4=B8=BA3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/src/utils/map.js | 13 +- vue/src/views/bigScreen/indexs/center-map.vue | 248 +++++++++--------- vue/src/views/index.vue | 242 ++++++++--------- 3 files changed, 252 insertions(+), 251 deletions(-) diff --git a/vue/src/utils/map.js b/vue/src/utils/map.js index 7775907c..dfb02a71 100644 --- a/vue/src/utils/map.js +++ b/vue/src/utils/map.js @@ -18,11 +18,12 @@ export function loadBMap() { document.head.appendChild(meta) } // 引入百度地图 - let script = document.createElement('script') - script.type = 'text/javascript' - script.src = - 'http://api.map.baidu.com/api?v=2.0&ak='+ process.env.VUE_APP_BAI_DU_AK +'&s=1&__ec_v__=20190126&callback=onBMapCallback' - script.onerror = reject - document.head.appendChild(script) + const script = document.createElement('script'); + const ak = process.env.VUE_APP_BAI_DU_AK + script.type = 'text/javascript'; + script.src = `https://api.map.baidu.com/api?v=3.0&ak=${ak}&callback=onBMapCallback`; + script.onerror = reject; + document.head.appendChild(script); + }) } \ No newline at end of file diff --git a/vue/src/views/bigScreen/indexs/center-map.vue b/vue/src/views/bigScreen/indexs/center-map.vue index 2c0f2081..58755985 100644 --- a/vue/src/views/bigScreen/indexs/center-map.vue +++ b/vue/src/views/bigScreen/indexs/center-map.vue @@ -161,130 +161,130 @@ export default { zoom: 5, // 大屏用zomm缩放,导致地图缩放中心点会偏移 roam: 'move', - mapStyle: { - styleJson: [{ - featureType: 'water', - elementType: 'all', - stylers: { - color: '#3863db' - } - }, - { - featureType: 'land', - elementType: 'all', - stylers: { - color: '#0e2e87' - } - }, - { - featureType: 'railway', - elementType: 'all', - stylers: { - visibility: 'off' - } - }, - { - featureType: 'highway', - elementType: 'all', - stylers: { - visibility: 'off', - color: '#fdfdfd' - } - }, - { - featureType: 'highway', - elementType: 'labels', - stylers: { - visibility: 'off', - visibility: 'off' - } - }, - { - featureType: 'arterial', - elementType: 'geometry', - stylers: { - visibility: 'off', - color: '#fefefe' - } - }, - { - featureType: 'arterial', - elementType: 'geometry.fill', - stylers: { - visibility: 'off', - color: '#fefefe' - } - }, - { - featureType: 'poi', - elementType: 'all', - stylers: { - visibility: 'off', - visibility: 'off' - } - }, - { - featureType: 'green', - elementType: 'all', - stylers: { - visibility: 'off' - } - }, - { - featureType: 'subway', - elementType: 'all', - stylers: { - visibility: 'off' - } - }, - { - featureType: 'manmade', - elementType: 'all', - stylers: { - visibility: 'off', - color: '#d1d1d1' - } - }, - { - featureType: 'local', - elementType: 'all', - stylers: { - visibility: 'off', - color: '#d1d1d1' - } - }, - { - featureType: 'arterial', - elementType: 'labels', - stylers: { - visibility: 'off' - } - }, - { - featureType: 'boundary', - elementType: 'all', - stylers: { - color: '#23cdd8' - } - }, - { - featureType: 'building', - elementType: 'all', - stylers: { - visibility: 'off', - color: '#d1d1d1' - } - }, - { - featureType: 'label', - elementType: 'labels.text.fill', - stylers: { - color: '#264194', - visibility: 'off' - } - } - ] - } + // mapStyle: { + // styleJson: [{ + // featureType: 'water', + // elementType: 'all', + // stylers: { + // color: '#3863db' + // } + // }, + // { + // featureType: 'land', + // elementType: 'all', + // stylers: { + // color: '#0e2e87' + // } + // }, + // { + // featureType: 'railway', + // elementType: 'all', + // stylers: { + // visibility: 'off' + // } + // }, + // { + // featureType: 'highway', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // color: '#fdfdfd' + // } + // }, + // { + // featureType: 'highway', + // elementType: 'labels', + // stylers: { + // visibility: 'off', + // visibility: 'off' + // } + // }, + // { + // featureType: 'arterial', + // elementType: 'geometry', + // stylers: { + // visibility: 'off', + // color: '#fefefe' + // } + // }, + // { + // featureType: 'arterial', + // elementType: 'geometry.fill', + // stylers: { + // visibility: 'off', + // color: '#fefefe' + // } + // }, + // { + // featureType: 'poi', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // visibility: 'off' + // } + // }, + // { + // featureType: 'green', + // elementType: 'all', + // stylers: { + // visibility: 'off' + // } + // }, + // { + // featureType: 'subway', + // elementType: 'all', + // stylers: { + // visibility: 'off' + // } + // }, + // { + // featureType: 'manmade', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // color: '#d1d1d1' + // } + // }, + // { + // featureType: 'local', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // color: '#d1d1d1' + // } + // }, + // { + // featureType: 'arterial', + // elementType: 'labels', + // stylers: { + // visibility: 'off' + // } + // }, + // { + // featureType: 'boundary', + // elementType: 'all', + // stylers: { + // color: '#23cdd8' + // } + // }, + // { + // featureType: 'building', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // color: '#d1d1d1' + // } + // }, + // { + // featureType: 'label', + // elementType: 'labels.text.fill', + // stylers: { + // color: '#264194', + // visibility: 'off' + // } + // } + // ] + // } }, series: [{ type: 'scatter', diff --git a/vue/src/views/index.vue b/vue/src/views/index.vue index fd5cb95d..ebb4ade8 100644 --- a/vue/src/views/index.vue +++ b/vue/src/views/index.vue @@ -339,11 +339,11 @@ export default { }, /**加载地图*/ loadMap() { - this.$nextTick(() => { - loadBMap().then(() => { - this.getmap(); - }); - }); + loadBMap().then(() => { + setTimeout(() => { + this.getmap(); // 里面有 setOption + }, 500); + }) }, /** 查询服务器信息 */ getServer() { @@ -494,122 +494,122 @@ export default { center: [133, 38], zoom: 5, roam: true, - mapStyle: { - styleJson: [ - { - featureType: 'water', - elementType: 'all', - stylers: { - color: '#a0cfff', - }, - }, - { - featureType: 'land', - elementType: 'all', - stylers: { - color: '#fafafa', // #fffff8 淡黄色 - }, - }, - { - featureType: 'railway', - elementType: 'all', - stylers: { - visibility: 'off', - }, - }, - { - featureType: 'highway', - elementType: 'all', - stylers: { - color: '#fdfdfd', - }, - }, - { - featureType: 'highway', - elementType: 'labels', - stylers: { - visibility: 'off', - }, - }, - { - featureType: 'arterial', - elementType: 'geometry', - stylers: { - color: '#fefefe', - }, - }, - { - featureType: 'arterial', - elementType: 'geometry.fill', - stylers: { - color: '#fefefe', - }, - }, - { - featureType: 'poi', - elementType: 'all', - stylers: { - visibility: 'off', - }, - }, - { - featureType: 'green', - elementType: 'all', - stylers: { - visibility: 'off', - }, - }, - { - featureType: 'subway', - elementType: 'all', - stylers: { - visibility: 'off', - }, - }, - { - featureType: 'manmade', - elementType: 'all', - stylers: { - color: '#d1d1d1', - }, - }, - { - featureType: 'local', - elementType: 'all', - stylers: { - color: '#d1d1d1', - }, - }, - { - featureType: 'arterial', - elementType: 'labels', - stylers: { - visibility: 'off', - }, - }, - { - featureType: 'boundary', - elementType: 'all', - stylers: { - color: '#999999', - }, - }, - { - featureType: 'building', - elementType: 'all', - stylers: { - color: '#d1d1d1', - }, - }, - { - featureType: 'label', - elementType: 'labels.text.fill', - stylers: { - color: '#999999', - }, - }, - ], - }, + // mapStyle: { + // styleJson: [ + // { + // featureType: 'water', + // elementType: 'all', + // stylers: { + // color: '#a0cfff', + // }, + // }, + // { + // featureType: 'land', + // elementType: 'all', + // stylers: { + // color: '#fafafa', // #fffff8 淡黄色 + // }, + // }, + // { + // featureType: 'railway', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // }, + // }, + // { + // featureType: 'highway', + // elementType: 'all', + // stylers: { + // color: '#fdfdfd', + // }, + // }, + // { + // featureType: 'highway', + // elementType: 'labels', + // stylers: { + // visibility: 'off', + // }, + // }, + // { + // featureType: 'arterial', + // elementType: 'geometry', + // stylers: { + // color: '#fefefe', + // }, + // }, + // { + // featureType: 'arterial', + // elementType: 'geometry.fill', + // stylers: { + // color: '#fefefe', + // }, + // }, + // { + // featureType: 'poi', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // }, + // }, + // { + // featureType: 'green', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // }, + // }, + // { + // featureType: 'subway', + // elementType: 'all', + // stylers: { + // visibility: 'off', + // }, + // }, + // { + // featureType: 'manmade', + // elementType: 'all', + // stylers: { + // color: '#d1d1d1', + // }, + // }, + // { + // featureType: 'local', + // elementType: 'all', + // stylers: { + // color: '#d1d1d1', + // }, + // }, + // { + // featureType: 'arterial', + // elementType: 'labels', + // stylers: { + // visibility: 'off', + // }, + // }, + // { + // featureType: 'boundary', + // elementType: 'all', + // stylers: { + // color: '#999999', + // }, + // }, + // { + // featureType: 'building', + // elementType: 'all', + // stylers: { + // color: '#d1d1d1', + // }, + // }, + // { + // featureType: 'label', + // elementType: 'labels.text.fill', + // stylers: { + // color: '#999999', + // }, + // }, + // ], + // }, }, series: [ {