From 55a6bd93ad7934b3abd9848dfa507645699cd31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Wed, 24 May 2023 12:58:20 +0000 Subject: [PATCH] =?UTF-8?q?!159=20=E5=9C=B0=E5=9B=BE=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8D=AB=E6=98=9F=E5=9C=B0=E5=9B=BE=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=20Merge=20pull=20request=20!159=20from=20tanhao/feat-?= =?UTF-8?q?map-theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/components/Charts/Maps/MapAmap/config.ts | 3 ++- .../components/Charts/Maps/MapAmap/config.vue | 4 ++++ src/packages/components/Charts/Maps/MapAmap/index.vue | 11 +++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/packages/components/Charts/Maps/MapAmap/config.ts b/src/packages/components/Charts/Maps/MapAmap/config.ts index 97bf903c..a7ba4ac9 100644 --- a/src/packages/components/Charts/Maps/MapAmap/config.ts +++ b/src/packages/components/Charts/Maps/MapAmap/config.ts @@ -16,7 +16,8 @@ export enum ThemeEnum { MACARON = 'macaron', BLUE = 'blue', DARKBLUE = 'darkblue', - WINE = 'wine' + WINE = 'wine', + WEIXIN = 'tileLayer' } export enum LangEnum { diff --git a/src/packages/components/Charts/Maps/MapAmap/config.vue b/src/packages/components/Charts/Maps/MapAmap/config.vue index be3864bc..8d8936b5 100644 --- a/src/packages/components/Charts/Maps/MapAmap/config.vue +++ b/src/packages/components/Charts/Maps/MapAmap/config.vue @@ -134,6 +134,10 @@ const themeOptions = [ { value: ThemeEnum.WINE, label: '酱籽' + }, + { + value: ThemeEnum.WEIXIN, + label: '卫星' } ] diff --git a/src/packages/components/Charts/Maps/MapAmap/index.vue b/src/packages/components/Charts/Maps/MapAmap/index.vue index 741013cb..6e678634 100644 --- a/src/packages/components/Charts/Maps/MapAmap/index.vue +++ b/src/packages/components/Charts/Maps/MapAmap/index.vue @@ -8,7 +8,7 @@ import AMapLoader from '@amap/amap-jsapi-loader' import { CreateComponentType } from '@/packages/index.d' import { useChartDataFetch } from '@/hooks' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' -import { MarkerEnum } from './config' +import { MarkerEnum, ThemeEnum } from './config' import { isArray } from '@/utils' const props = defineProps({ @@ -51,7 +51,6 @@ const initMap = (newData: any) => { resizeEnable: true, zoom: amapZindex.value, // 地图显示的缩放级别 center: [amapLon.value, amapLat.value], - mapStyle: `amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}`, //自定义地图的显示样式 lang: lang.value, features: features.value, pitch: pitch.value, // 地图俯仰角度,有效范围 0 度- 83 度 @@ -60,6 +59,14 @@ const initMap = (newData: any) => { willReadFrequently: true }) dataHandle(props.chartConfig.option.dataset) + let satellite = new AMap.TileLayer.Satellite() + let roadNet = new AMap.TileLayer.RoadNet() + if (newData.amapStyleKey === ThemeEnum.WEIXIN) { + mapIns.add([satellite, roadNet]) + } else { + mapIns.remove([satellite, roadNet]) + mapIns.setMapStyle(`amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}`) + } }) .catch(e => {}) }