From 0932ed3cd27f6ef22f74a8fed6ce00e0463a0f5d Mon Sep 17 00:00:00 2001 From: wxy <14293288+zysysys@user.noreply.gitee.com> Date: Sun, 29 Sep 2024 10:14:36 +0800 Subject: [PATCH 1/4] =?UTF-8?q?```=E8=B0=83=E6=95=B4fetchData=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=9A=84=E5=AE=9A=E6=97=B6=E5=99=A8=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E4=B8=BA2=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在`index.vue`的`created`钩子中,更新了定时器的间隔时间,从之前的10秒调整为2秒,以提高数据获取的频率。 ``` --- src/views/car/trajectory/index.vue | 36 +----------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/src/views/car/trajectory/index.vue b/src/views/car/trajectory/index.vue index 3c728e1..24c3833 100644 --- a/src/views/car/trajectory/index.vue +++ b/src/views/car/trajectory/index.vue @@ -76,7 +76,7 @@ export default { }, created() { // 创建定时器,每隔一定时间间隔调用fetchData方法 - this.intervalId = setInterval(this.fetchData, 1000); // 10000毫秒(10秒) + this.intervalId = setInterval(this.fetchData, 2000); // 10000毫秒(10秒) }, methods: { async fetchData() { @@ -128,40 +128,6 @@ export default { } }, }, - // methods: { - // fetchData() { - // getDataByRedis(this.carVin).then(res=>{ - // this.data = res.data - // }) - // }, - // initMap() { - // this.map = new AMap.Map('map', { - // center: [116.397428, 39.90923], // 初始化地图中心点 - // zoom: 13, // 地图缩放级别 - // }); - // - // // 初始化轨迹线 - // this.polyline = new AMap.Polyline({ - // map: this.map, - // path: [], // 初始路径为空 - // strokeColor: "#FF0000", // 轨迹线的颜色 - // strokeWeight: 5, // 轨迹线的宽度 - // }); - // - // // 模拟实时数据更新 - // setInterval(this.updateTrajectory, 1100); - // }, - // updateTrajectory() { - // // 替换为实际的经纬度数据获取逻辑 - // const newPoint = [this.data.longitude, this.data.latitude]; - // // 更新轨迹线 - // const path = this.polyline.getPath(); - // path.push(newPoint); - // this.polyline.setPath(path); - // // 调整地图视野 - // this.map.setCenter(newPoint); - // }, - // }, mounted() { this.initMap(); }, From 0a61d647fa35c962266d317bf9d75305c4baa8ba Mon Sep 17 00:00:00 2001 From: wxy <14293288+zysysys@user.noreply.gitee.com> Date: Sun, 29 Sep 2024 20:09:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=9C=A8HTML=E5=A4=B4=E9=83=A8=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E9=AB=98=E5=BE=B7=E5=9C=B0=E5=9B=BEAPI=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=9C=8D=E5=8A=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/index.html b/public/index.html index 99f7ed8..2fde61a 100644 --- a/public/index.html +++ b/public/index.html @@ -9,6 +9,8 @@