This commit is contained in:
parent
b13b33203d
commit
1415388ac1
|
|
@ -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实例
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
<!-- 第二行 -->
|
||||
<n-grid :cols="24">
|
||||
<n-grid-item :span="9">
|
||||
<div class="row-2-item">
|
||||
<div class="row-2-item" v-show="false">
|
||||
<div>速度</div>
|
||||
<div>30</div>
|
||||
</div>
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
</n-grid-item>
|
||||
<n-grid-item :span="9">
|
||||
<div class="row-2-item">
|
||||
<div class="row-2-item" v-show="false">
|
||||
<div>速度</div>
|
||||
<div>30</div>
|
||||
</div>
|
||||
|
|
@ -318,9 +318,9 @@
|
|||
<n-grid-item :span="4">
|
||||
<div class="row-6-item" @click="handleChangeRobot(10)">回桩充电</div>
|
||||
</n-grid-item>
|
||||
<n-grid-item :span="3">
|
||||
<!-- <n-grid-item :span="3">
|
||||
<div class="row-6-item-1">
|
||||
<!-- 开启麦克风 -->
|
||||
|
||||
<img
|
||||
alt=""
|
||||
v-if="!isOpenMK"
|
||||
|
|
@ -328,12 +328,12 @@
|
|||
src="@/assets/home-imgs/control-3-mk.png"
|
||||
/>
|
||||
|
||||
<!-- 关闭麦克风 -->
|
||||
|
||||
<span v-else style="cursor: pointer" @click="onHandleOpenOrCloseMK(2)"
|
||||
>结束喊话</span
|
||||
>
|
||||
</div>
|
||||
</n-grid-item>
|
||||
</n-grid-item> -->
|
||||
</n-grid>
|
||||
</div>
|
||||
|
||||
|
|
@ -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('麦克风访问被拒绝或不可用,请检查麦克风权限')
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
<!-- 第二行 -->
|
||||
<n-grid :cols="24">
|
||||
<n-grid-item :span="9">
|
||||
<div class="row-2-item">
|
||||
<div class="row-2-item" v-show="false">
|
||||
<div>速度</div>
|
||||
<div>30</div>
|
||||
</div>
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
</n-grid-item>
|
||||
<n-grid-item :span="9">
|
||||
<div class="row-2-item">
|
||||
<div class="row-2-item" v-show="false">
|
||||
<div>速度</div>
|
||||
<div>30</div>
|
||||
</div>
|
||||
|
|
@ -318,7 +318,7 @@
|
|||
<n-grid-item :span="4">
|
||||
<div class="row-6-item" @click="handleChangeRobot(10)">回桩充电</div>
|
||||
</n-grid-item>
|
||||
<n-grid-item :span="3">
|
||||
<!-- <n-grid-item :span="3">
|
||||
<div class="row-6-item-1">
|
||||
<img
|
||||
alt=""
|
||||
|
|
@ -330,7 +330,7 @@
|
|||
结束喊话
|
||||
</span>
|
||||
</div>
|
||||
</n-grid-item>
|
||||
</n-grid-item> -->
|
||||
</n-grid>
|
||||
</div>
|
||||
|
||||
|
|
@ -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('麦克风访问被拒绝或不可用,请检查麦克风权限')
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -49,6 +49,35 @@
|
|||
v-model:page-size="queryParams.pageSize"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<n-modal v-model:show="imageModalVisible">
|
||||
<DialogModal
|
||||
:width="`30vw`"
|
||||
modalTitle="比对图片"
|
||||
@onHandleCloseModal="imageModalVisible = false"
|
||||
>
|
||||
<div style="display: flex; justify-content: space-around">
|
||||
<div>
|
||||
<div style="margin-bottom: 10px; color: #fff">第一张巡检照片</div>
|
||||
<n-image
|
||||
width="100%"
|
||||
height="100%"
|
||||
fit="cover"
|
||||
:src="imgPreviewUrl + startImage"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div style="color: #fff">上一次巡检照片</div>
|
||||
<n-image
|
||||
width="100%"
|
||||
height="100%"
|
||||
fit="cover"
|
||||
:src="imgPreviewUrl + endImage"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</DialogModal>
|
||||
</n-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -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 '-'
|
||||
|
|
|
|||
Loading…
Reference in New Issue