From b8838d2171fc6cfefcd018fb8c03efc60fc99ce8 Mon Sep 17 00:00:00 2001 From: liuye Date: Thu, 17 Aug 2023 15:21:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppSessionArchive/components/Detail.vue | 19 +++++++++++++------ .../components/Detail.vue | 15 +++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/project/pidu/app/AppSessionArchive/components/Detail.vue b/project/pidu/app/AppSessionArchive/components/Detail.vue index 5822e32e..8d791be5 100644 --- a/project/pidu/app/AppSessionArchive/components/Detail.vue +++ b/project/pidu/app/AppSessionArchive/components/Detail.vue @@ -229,7 +229,7 @@ />
-
+

{{ item.title }}

{{ item.address }}

@@ -578,9 +578,9 @@ export default { }, ]; } - if (item.msgType == "location") { - this.initMap(item.lng, item.lat, item.zoom, index); - } + // if (item.msgType == "location") { + // this.initMap(item.lng, item.lat, item.zoom, index); + // } if (item.msgType == "image") { var image = new Image(); image.crossOrigin = ''; @@ -596,6 +596,13 @@ export default { this.msgCurrent > 1 ? [...res.data.records, ...this.msgList] : res.data.records; + + this.msgList.map((item, index) => { + if (item.msgType == "location") { + item.mapId = `map${index}` + this.initMap(item.lng, item.lat, item.zoom, item.mapId); + } + }) this.msgPages = res.data.pages || 2; this.$nextTick(() => { if (this.msgCurrent == 1) { @@ -630,12 +637,12 @@ export default { return dataURL; }, - initMap(lng, lat, zoom, index) { + initMap(lng, lat, zoom, mapId) { AMapLoader.load({ key: "54a02a43d9828a8f9cd4f26fe281e74e", version: "2.0", }).then((AMap) => { - this.map = new AMap.Map(`map${index}`, { + this.map = new AMap.Map(mapId, { resizeEnable: true, zooms: [6, 20], center: [lng, lat], diff --git a/project/pidu/app/AppSessionArchiveWechat/components/Detail.vue b/project/pidu/app/AppSessionArchiveWechat/components/Detail.vue index a68a640d..58d34816 100644 --- a/project/pidu/app/AppSessionArchiveWechat/components/Detail.vue +++ b/project/pidu/app/AppSessionArchiveWechat/components/Detail.vue @@ -229,7 +229,7 @@ />
-
+

{{ item.title }}

{{ item.address }}

@@ -578,9 +578,6 @@ export default { }, ]; } - if (item.msgType == "location") { - this.initMap(item.lng, item.lat, item.zoom, index); - } if (item.msgType == "image") { var image = new Image(); image.crossOrigin = ''; @@ -596,6 +593,12 @@ export default { this.msgCurrent > 1 ? [...res.data.records, ...this.msgList] : res.data.records; + this.msgList.map((item, index) => { + if (item.msgType == "location") { + item.mapId = `map${index}` + this.initMap(item.lng, item.lat, item.zoom, item.mapId); + } + }) this.msgPages = res.data.pages || 2; this.$nextTick(() => { if (this.msgCurrent == 1) { @@ -630,12 +633,12 @@ export default { return dataURL; }, - initMap(lng, lat, zoom, index) { + initMap(lng, lat, zoom, mapId) { AMapLoader.load({ key: "54a02a43d9828a8f9cd4f26fe281e74e", version: "2.0", }).then((AMap) => { - this.map = new AMap.Map(`map${index}`, { + this.map = new AMap.Map(mapId, { resizeEnable: true, zooms: [6, 20], center: [lng, lat],