This commit is contained in:
ywb
2026-06-04 16:15:16 +08:00
parent 525025a5f7
commit decfc44e89
6 changed files with 40 additions and 12 deletions
+17 -1
View File
@@ -8,8 +8,9 @@ createApp({
progress: 0,
tasks: [],
report: null,
armCameraOpened: false,
agvPreviewUrl: API + '/api/camera/preview',
armPreviewUrl: API + '/api/camera/arm_preview',
armPreviewUrl: '',
polling: null,
logs: [],
showQrModal: false,
@@ -52,15 +53,28 @@ createApp({
},
mounted() {
this.poll()
this.checkArmCamera()
},
beforeUnmount() {
if (this.polling) clearInterval(this.polling)
},
methods: {
async checkArmCamera() {
try {
const res = await fetch(API + '/api/status')
const data = await res.json()
if (!this.armCameraOpened) {
this.armPreviewUrl = ''
} else if (!this.armPreviewUrl) {
this.armPreviewUrl = API + '/api/camera/arm_preview'
}
} catch (e) {}
},
poll() {
this.refresh()
this.pollLogs()
this.polling = setInterval(() => {
this.checkArmCamera()
this.refresh()
this.pollLogs()
}, 2000)
@@ -79,6 +93,7 @@ createApp({
if (data.grid) this.missionGrid = data.grid
if (data.point_status) this.pointStatus = data.point_status
if (data.machine_status) this.machineStatus = data.machine_status
this.armCameraOpened = data.arm_camera_opened
// 错误弹窗
if (data.waiting_error) {
@@ -139,6 +154,7 @@ createApp({
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
arm_init: this.qrScanEnabled || this.frontPhotoEnabled || this.backPhotoEnabled,
agv_move: this.agvMoveEnabled,
qr_scan: this.qrScanEnabled,
front_photo: this.frontPhotoEnabled,