This commit is contained in:
2025-10-31 10:06:20 +08:00
parent 023aa4d3dc
commit 4e105e7127
2 changed files with 9 additions and 4 deletions

View File

@@ -68,6 +68,7 @@ export default {
updateThrottle: 50, // 数据更新节流间隔(ms) updateThrottle: 50, // 数据更新节流间隔(ms)
lastUpdateTime: 0, lastUpdateTime: 0,
// resizeHandler: null // 存储resize事件处理函数 // resizeHandler: null // 存储resize事件处理函数
hasYellowDot: false,
yellowDotSprite: null, yellowDotSprite: null,
yellowDotInitialPos: null yellowDotInitialPos: null
} }
@@ -221,6 +222,8 @@ export default {
}); });
}, },
createYellowDot(initialX, initialY) { createYellowDot(initialX, initialY) {
if (this.hasYellowDot) return
this.hasYellowDot = true
// 存储初始位置(后续不更新) // 存储初始位置(后续不更新)
this.yellowDotInitialPos = { x: initialX, y: initialY }; this.yellowDotInitialPos = { x: initialX, y: initialY };
@@ -584,6 +587,7 @@ export default {
if (this.reconnectTimer) clearTimeout(this.reconnectTimer) if (this.reconnectTimer) clearTimeout(this.reconnectTimer)
const pointData = JSON.parse(event.data) const pointData = JSON.parse(event.data)
this.updatePointCloud(pointData.globalData) this.updatePointCloud(pointData.globalData)
this.createYellowDot(this.carPosition.x, this.carPosition.y)
} catch (error) { } catch (error) {
console.error('解析点云数据失败:', error) console.error('解析点云数据失败:', error)
} }
@@ -612,7 +616,6 @@ export default {
}, },
init() { init() {
this.initWebSocket() this.initWebSocket()
this.createYellowDot(this.carPosition.x, this.carPosition.y)
// this.isLoading = false; // this.isLoading = false;
// const pointData = points.data // const pointData = points.data
// this.updatePointCloud(pointData); // this.updatePointCloud(pointData);

View File

@@ -248,9 +248,11 @@ export default {
if (res && res.code === 200) { if (res && res.code === 200) {
this.message = this.$t('carbuildingmap') this.message = this.$t('carbuildingmap')
this.error = false this.error = false
this.$nextTick(() => { setTimeout(() => {
this.$refs.glMap.init() this.$nextTick(() => {
}) this.$refs.glMap.init()
})
}, 2000)
} }
this.loading.close() this.loading.close()
} catch (e) { } catch (e) {