From 1415388ac1dd6d693c1a6a012f6b56417e90a010 Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Mon, 25 Aug 2025 09:23:30 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/http/request.js | 2 +-
.../home/components/control-deck-new.vue | 62 ++++++++++++-------
src/views/home/components/control-deck.vue | 59 +++++++++++-------
.../modal-content/add-or-edit-marker-form.vue | 47 +++++++++-----
.../home/components/right-two/taps-three.vue | 50 ++++++++++++++-
5 files changed, 152 insertions(+), 68 deletions(-)
diff --git a/src/http/request.js b/src/http/request.js
index 01bd70b..e451fa5 100644
--- a/src/http/request.js
+++ b/src/http/request.js
@@ -12,7 +12,7 @@ import { set } from 'lodash'
const { message } = createDiscreteApi(['message'])
let baseApiURL = import.meta.env.VITE_APP_baseApiURL //api原始链接
-const timeout = 30000 //api请求超时时间
+const timeout = 60000 //api请求超时时间
export const service = axios.create({
//可创建多个 axios实例
diff --git a/src/views/home/components/control-deck-new.vue b/src/views/home/components/control-deck-new.vue
index 26000b7..9234d50 100644
--- a/src/views/home/components/control-deck-new.vue
+++ b/src/views/home/components/control-deck-new.vue
@@ -41,7 +41,7 @@
-
-
+
@@ -318,9 +318,9 @@
回桩充电
-
+
+
-
+
结束喊话
-
+ -->
@@ -818,28 +818,42 @@ const onHandleOpenOrCloseMK = async (type) => {
// 先判断当前设备有没有开启MK
try {
// 请求麦克风权限并检查状态
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
+ // const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
- // 检查麦克风是否真的在接收声音(可选)
- const audioTracks = stream.getAudioTracks()
- if (audioTracks.length > 0) {
- audioTracks.forEach((track) => track.stop())
+ // // 检查麦克风是否真的在接收声音(可选)
+ // const audioTracks = stream.getAudioTracks()
+ // if (audioTracks.length > 0) {
+ // audioTracks.forEach((track) => track.stop())
- // 调用麦克风开启接口
- const { data: res } = await openDeviceMKApi({
- token: deviceToken.value,
- puId: robotData.robotInfo?.puId,
- idx: 0,
- })
+ // // 调用麦克风开启接口
+ // const { data: res } = await openDeviceMKApi({
+ // token: deviceToken.value,
+ // puId: robotData.robotInfo?.puId,
+ // idx: 0,
+ // })
- if (res.code == 200) {
- message.success('麦克风开启成功')
- isOpenMK.value = true
- } else {
- message.error('麦克风开启失败')
- }
+ // if (res.code == 200) {
+ // message.success('麦克风开启成功')
+ // isOpenMK.value = true
+ // } else {
+ // message.error('麦克风开启失败')
+ // }
+ // } else {
+ // message.error('未检测到音频输入设备')
+ // }
+
+ // 调用麦克风开启接口
+ const { data: res } = await openDeviceMKApi({
+ token: deviceToken.value,
+ puid: robotData.robotInfo?.puId,
+ idx: 0,
+ })
+
+ if (res.code == 200) {
+ message.success('麦克风开启成功')
+ isOpenMK.value = true
} else {
- message.error('未检测到音频输入设备')
+ message.error('麦克风开启失败')
}
} catch (error) {
message.error('麦克风访问被拒绝或不可用,请检查麦克风权限')
diff --git a/src/views/home/components/control-deck.vue b/src/views/home/components/control-deck.vue
index d3ac64b..e8177b0 100644
--- a/src/views/home/components/control-deck.vue
+++ b/src/views/home/components/control-deck.vue
@@ -41,7 +41,7 @@
-
-
+
@@ -318,7 +318,7 @@
回桩充电
-
+
@@ -749,29 +749,40 @@ const onHandleOpenOrCloseMK = async (type) => {
if (type === 1) {
// 先判断当前设备有没有开启MK
try {
- // 请求麦克风权限并检查状态
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
+ // // 请求麦克风权限并检查状态
+ // const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
+ // // 检查麦克风是否真的在接收声音(可选)
+ // const audioTracks = stream.getAudioTracks()
+ // if (audioTracks.length > 0) {
+ // audioTracks.forEach((track) => track.stop())
+ // // 调用麦克风开启接口
+ // const { data: res } = await openDeviceMKApi({
+ // token: deviceToken.value,
+ // puId: robotData.robotInfo?.puId,
+ // idx: 0,
+ // })
+ // if (res.code == 200) {
+ // message.success('麦克风开启成功')
+ // isOpenMK.value = true
+ // } else {
+ // message.error('麦克风开启失败')
+ // }
+ // } else {
+ // message.error('未检测到音频输入设备')
+ // }
- // 检查麦克风是否真的在接收声音(可选)
- const audioTracks = stream.getAudioTracks()
- if (audioTracks.length > 0) {
- audioTracks.forEach((track) => track.stop())
+ // 调用麦克风开启接口
+ const { data: res } = await openDeviceMKApi({
+ token: deviceToken.value,
+ puid: robotData.robotInfo?.puId,
+ idx: 0,
+ })
- // 调用麦克风开启接口
- const { data: res } = await openDeviceMKApi({
- token: deviceToken.value,
- puId: robotData.robotInfo?.puId,
- idx: 0,
- })
-
- if (res.code == 200) {
- message.success('麦克风开启成功')
- isOpenMK.value = true
- } else {
- message.error('麦克风开启失败')
- }
+ if (res.code == 200) {
+ message.success('麦克风开启成功')
+ isOpenMK.value = true
} else {
- message.error('未检测到音频输入设备')
+ message.error('麦克风开启失败')
}
} catch (error) {
message.error('麦克风访问被拒绝或不可用,请检查麦克风权限')
diff --git a/src/views/home/components/modal-content/add-or-edit-marker-form.vue b/src/views/home/components/modal-content/add-or-edit-marker-form.vue
index 0a20f26..1cab8d3 100644
--- a/src/views/home/components/modal-content/add-or-edit-marker-form.vue
+++ b/src/views/home/components/modal-content/add-or-edit-marker-form.vue
@@ -11,6 +11,7 @@
label-width="140"
label-placement="left"
ref="addOrEditFormRef"
+ :model="markerParams"
style="margin-top: 10px"
require-mark-placement="left"
:rules="addOrEditMarkerFormRules"
@@ -160,9 +161,6 @@ const addOrEditFormRef = ref(null)
const dialog = useDialog()
const emits = defineEmits(['onHandleCloseAddMarkerModal', 'onHandleConfirm'])
-const addOrEditMarkerFormRules = ref({
- markerName: [{ required: true, message: '请输入点位名称', trigger: 'blur' }],
-})
const cameraNode = ref({
token: '',
puid: '',
@@ -201,6 +199,10 @@ const markerParams = ref({
PTZ_y: '',
id: '',
})
+
+const addOrEditMarkerFormRules = ref({
+ markerName: [{ required: true, message: '请输入点位名称' }],
+})
const props = defineProps({
markerInfo: {
type: Object,
@@ -213,7 +215,9 @@ const onHandleCloseAddModal = () => {
// 根据X 和 Y 指令机器人去指定位置
const handleRobotAction = async (x, y, puId) => {
- console.log(x, y, puId, 'x, y, puId')
+ // console.log(x, y, puId, 'x, y, puId')
+
+ console.log('机器人去往指定点位参数', x, y, puId, markerParams.value.markerAngle)
const { data: res } = await handleRobotActionApi({
x,
y,
@@ -223,6 +227,8 @@ const handleRobotAction = async (x, y, puId) => {
theta: markerParams.value.markerAngle,
})
+ console.log('res机器人正在去往指定地点返回结果', res)
+
if (res.code == 200) {
isCurrentPosition.value = setInterval(async () => {
// 判断两个位置是否一致 如误差在10个像素内 则认为到达指定位置
@@ -241,7 +247,7 @@ const handleRobotAction = async (x, y, puId) => {
clearInterval(isCurrentPosition.value)
}
- }, 2000)
+ }, 3000)
}
// console.log(res, 'res机器人正在去往指定地点')
@@ -273,7 +279,7 @@ const addOrEditMarker = async (isCurrentPosition) => {
markerParams.value.yCount = Robot_y
markerParams.value.PTZ_x = PTZ_x
markerParams.value.PTZ_y = PTZ_y
- markerParams.value.markerAngle = Robot_theta
+ // markerParams.value.markerAngle = Robot_theta
markerParams.value.PTZ_zoom = PTZ_zoom
const addMarkerParams = {
@@ -310,20 +316,19 @@ const onHandleConfirm = () => {
}).then(async (res) => {
const { Robot_x, Robot_y, PTZ_x, PTZ_y, PTZ_zoom, Robot_theta } = res?.data.data
- const isCurrentPosition = {
- Robot_x,
- Robot_y,
- PTZ_x,
- PTZ_y,
- PTZ_zoom,
- Robot_theta,
- }
-
// 判断当前点位和机器人位置是否一致
if (
Math.abs(Robot_x - markerParams.value.xCount) > 2 ||
Math.abs(Robot_y - markerParams.value.yCount) > 2
) {
+ const Position = {
+ Robot_x: markerParams.value.xCount,
+ Robot_y: markerParams.value.yCount,
+ PTZ_x: '0',
+ PTZ_y: '0',
+ PTZ_zoom: '100',
+ Robot_theta: markerParams.value.markerAngle,
+ }
if (markerParams.value.type === '修改') {
dialog.warning({
title: '温馨提示',
@@ -335,7 +340,7 @@ const onHandleConfirm = () => {
onHandleGoToPoint()
},
onNegativeClick: async () => {
- addOrEditMarker(isCurrentPosition)
+ addOrEditMarker(Position)
},
})
} else {
@@ -345,12 +350,20 @@ const onHandleConfirm = () => {
positiveText: '确定新增',
negativeText: '取消',
onPositiveClick: async () => {
- addOrEditMarker(isCurrentPosition)
+ addOrEditMarker(Position)
},
onNegativeClick: () => {},
})
}
} else {
+ const isCurrentPosition = {
+ Robot_x,
+ Robot_y,
+ PTZ_x,
+ PTZ_y,
+ PTZ_zoom,
+ Robot_theta,
+ }
addOrEditMarker(isCurrentPosition)
}
})
diff --git a/src/views/home/components/right-two/taps-three.vue b/src/views/home/components/right-two/taps-three.vue
index 49bb8fb..227fdec 100644
--- a/src/views/home/components/right-two/taps-three.vue
+++ b/src/views/home/components/right-two/taps-three.vue
@@ -49,6 +49,35 @@
v-model:page-size="queryParams.pageSize"
/>
+
+
+
+
+
+
@@ -56,8 +85,13 @@
import { ref } from 'vue'
import { NImage } from 'naive-ui'
import { getImagePageListApi } from '@/api/home'
+import DialogModal from '@/components/DialogModal/index.vue'
const total = ref(0)
+const imageModalVisible = ref(false)
const tableData = ref([])
+
+const startImage = ref('')
+const endImage = ref('')
const imgPreviewUrl = import.meta.env.VITE_APP_imgPreviewUrl
const queryParams = ref({
pageNum: 1,
@@ -102,8 +136,14 @@ const columns = ref([
return h(NImage, {
width: '48px',
height: '48px',
- src: imgPreviewUrl + row.image,
fit: 'cover',
+ previewDisabled: true,
+ src: imgPreviewUrl + row.image,
+ onClick: () => {
+ startImage.value = row.image
+ endImage.value = row.lastImage
+ imageModalVisible.value = true
+ },
})
} else {
return '-'
@@ -119,8 +159,14 @@ const columns = ref([
return h(NImage, {
width: '48px',
height: '48px',
- src: imgPreviewUrl + row.lastImage,
fit: 'cover',
+ previewDisabled: true,
+ src: imgPreviewUrl + row.lastImage,
+ onClick: () => {
+ startImage.value = row.image
+ endImage.value = row.lastImage
+ imageModalVisible.value = true
+ },
})
} else {
return '-'