From dbda3d702d8c787ee48ae6764105e13ae695a935 Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Mon, 28 Jul 2025 14:36:38 +0800 Subject: [PATCH] bug --- src/pages/modules/map.vue | 11 +++++------ src/pages/shells/index.vue | 6 +++--- src/vuex/modules/com.js | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/pages/modules/map.vue b/src/pages/modules/map.vue index 2e02137..e638522 100644 --- a/src/pages/modules/map.vue +++ b/src/pages/modules/map.vue @@ -107,12 +107,11 @@ export default { computed: { ...mapGetters(['agvObj']), carData () { - try { - return JSON.parse(this.agvObj) - } catch (error) { - console.error('解析 JSON 时出错:', error) - return {} + let res = '' + if (this.agvObj !== '') { + res = JSON.parse(this.agvObj) } + return res } }, mixins: [canvasZoomDrag], @@ -124,7 +123,7 @@ export default { this.carPositionWatcher = this.$watch( () => this.carData, (newVal) => { - if (newVal && newVal.x !== undefined && newVal.y !== undefined) { + if (newVal !== '') { this.redrawCanvas() } }, diff --git a/src/pages/shells/index.vue b/src/pages/shells/index.vue index 5e90985..719aa57 100644 --- a/src/pages/shells/index.vue +++ b/src/pages/shells/index.vue @@ -70,8 +70,8 @@ export default { // state: '未知状态', // 车辆状态 // stateId: 7, // 车辆状态ID // theta: 0.9073792099952698, // 车辆航向角 - // x: -4.030919075012207, // 车辆x坐标 - // y: -1.6574244499206543 // 车辆y坐标 + // x: 0.004027, // 车辆x坐标 + // y: -0.001812 // 车辆y坐标 // }, loginVisible: false, configVisible: false @@ -141,7 +141,7 @@ export default { wsMessage (res) { clearTimeout(this.timer) this.topInfo = res.data - this.$store.dispatch('setAgvObj', this.topInfo) + this.$store.dispatch('setAgvObj', JSON.stringify(this.topInfo)) }, wsErr () { this.timer = setTimeout(() => { diff --git a/src/vuex/modules/com.js b/src/vuex/modules/com.js index a300898..5a5050f 100644 --- a/src/vuex/modules/com.js +++ b/src/vuex/modules/com.js @@ -1,7 +1,7 @@ import * as types from '../types' import { getStore, setStore } from '@config/utils.js' -const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.10.50:8011' : 'http://localhost:8011' +const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.10.62:8011' : 'http://localhost:8011' const setTime = '5000' const username = 'user' const password = '123456'