|
|
@@ -20,6 +20,7 @@ import { AMAP_CONFIG } from '@/config/amapConfig'
|
|
|
import { Loading } from '@element-plus/icons-vue'
|
|
|
import fetchHttp from '@/config/axios/fetchHttp'
|
|
|
import { getAccessToken } from '@/utils/auth'
|
|
|
+import { amapReverseGeocode } from '@/utils/amapService'
|
|
|
|
|
|
interface Props {
|
|
|
elderId?: number | string
|
|
|
@@ -115,7 +116,7 @@ const initMap = (longitude: number, latitude: number) => {
|
|
|
}
|
|
|
|
|
|
// 添加标记
|
|
|
-const addMarker = (longitude: number, latitude: number) => {
|
|
|
+const addMarker = async (longitude: number, latitude: number) => {
|
|
|
if (!amap) return
|
|
|
|
|
|
try {
|
|
|
@@ -141,9 +142,11 @@ const addMarker = (longitude: number, latitude: number) => {
|
|
|
|
|
|
// 添加信息窗口(失败不影响)
|
|
|
try {
|
|
|
+ let addressInfo = await amapReverseGeocode(longitude, latitude)
|
|
|
const infoWindow = new AMap.InfoWindow({
|
|
|
- content: `<div style="padding: 10px; font-size: 12px;">
|
|
|
+ content: `<div style="padding: 10px; font-size: 12px;color:#000;width:300px">
|
|
|
<div style="margin-bottom: 5px;"><strong>长者位置</strong></div>
|
|
|
+ <div>地点: ${addressInfo}</div>
|
|
|
<div>经度: ${longitude.toFixed(6)}</div>
|
|
|
<div>纬度: ${latitude.toFixed(6)}</div>
|
|
|
</div>`,
|