From c94eddf30898f378ac506e2a006e0291ac0e4127 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Sat, 30 Jul 2022 00:41:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(H5=20map):=20=E6=94=AF=E6=8C=81=E9=AB=98?= =?UTF-8?q?=E5=BE=B7=E5=9C=B0=E5=9C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/platforms/h5/helpers/location.js | 30 ++- .../h5/view/components/map/index.vue | 231 +++++++++++++----- .../h5/view/components/map/map-marker.js | 145 ++++++++--- .../h5/view/components/map/maps/callout.js | 121 ++++++--- .../h5/view/components/map/maps/index.js | 30 ++- 5 files changed, 426 insertions(+), 131 deletions(-) diff --git a/src/platforms/h5/helpers/location.js b/src/platforms/h5/helpers/location.js index ab61ef7dd..5c8476dd5 100644 --- a/src/platforms/h5/helpers/location.js +++ b/src/platforms/h5/helpers/location.js @@ -6,21 +6,33 @@ export const ICON_PATH_TARGET = export const MapType = { QQ: 'qq', GOOGLE: 'google', + AMAP: 'AMap', UNKNOWN: '' } export function getMapInfo () { - let type = MapType.UNKNOWN - let key = '' if (__uniConfig.qqMapKey) { - type = MapType.QQ - key = __uniConfig.qqMapKey - } else if (__uniConfig.googleMapKey) { - type = MapType.GOOGLE - key = __uniConfig.googleMapKey + return { + type: MapType.QQ, + key: __uniConfig.qqMapKey + } + } + if (__uniConfig.googleMapKey) { + return { + type: MapType.GOOGLE, + key: __uniConfig.googleMapKey + } + } + if (__uniConfig.sdkConfigs.maps.AMap && __uniConfig.sdkConfigs.maps.AMap.key) { + return { + type: MapType.AMAP, + key: __uniConfig.sdkConfigs.maps.AMap.key, + securityJsCode: __uniConfig.sdkConfigs.maps.AMap.securityJsCode, + serviceHost: __uniConfig.sdkConfigs.maps.AMap.serviceHost + } } return { - type, - key + type: MapType.UNKNOWN, + key: '' } } diff --git a/src/platforms/h5/view/components/map/index.vue b/src/platforms/h5/view/components/map/index.vue index 6cb7368c6..0a111eff9 100644 --- a/src/platforms/h5/view/components/map/index.vue +++ b/src/platforms/h5/view/components/map/index.vue @@ -1,7 +1,9 @@