Compare commits
2 Commits
618be7bf0c
...
5dd78c1166
| Author | SHA1 | Date |
|---|---|---|
|
|
5dd78c1166 | |
|
|
d6b503931c |
|
|
@ -5,85 +5,134 @@ const robotData = useRobotDataStore()
|
|||
|
||||
// 获取机器人token
|
||||
export const getRobotTokenFn = async () => {
|
||||
if (!robotData.tokenInfo.deviceToken) {
|
||||
const loginParams = {
|
||||
address: '112.31.70.193',
|
||||
port: '9988',
|
||||
user: 'bns3',
|
||||
password: 'Bns@admin**',
|
||||
epid: 'system',
|
||||
bfix: 1,
|
||||
}
|
||||
const res = await initLoginApi(loginParams)
|
||||
robotData.setTokenInfo({
|
||||
deviceToken: res.data.token,
|
||||
})
|
||||
return res.data.token
|
||||
} else {
|
||||
return robotData.tokenInfo.deviceToken
|
||||
// if (!robotData.tokenInfo.deviceToken) {
|
||||
// const loginParams = {
|
||||
// address: '112.31.70.193',
|
||||
// port: '9988',
|
||||
// user: 'bns3',
|
||||
// password: 'Bns@admin**',
|
||||
// epid: 'system',
|
||||
// bfix: 1,
|
||||
// }
|
||||
// const res = await initLoginApi(loginParams)
|
||||
// robotData.setTokenInfo({
|
||||
// deviceToken: res.data.token,
|
||||
// })
|
||||
// return res.data.token
|
||||
// } else {
|
||||
// return robotData.tokenInfo.deviceToken
|
||||
// }
|
||||
|
||||
const loginParams = {
|
||||
address: '112.31.70.193',
|
||||
port: '9988',
|
||||
user: 'bns3',
|
||||
password: 'Bns@admin**',
|
||||
epid: 'system',
|
||||
bfix: 1,
|
||||
}
|
||||
const res = await initLoginApi(loginParams)
|
||||
return res.data.token
|
||||
}
|
||||
|
||||
// 获取设备信息
|
||||
export const getRobotDeviceListFn = async () => {
|
||||
if (!robotData.robotInfo.puId) {
|
||||
const { data: res } = await getDeviceInfoApi()
|
||||
if (res?.data?.length > 0) {
|
||||
const deviceInfo = res.data[0]
|
||||
robotData.setRobotInfo({
|
||||
devName: deviceInfo.devName,
|
||||
puId: deviceInfo.puId,
|
||||
})
|
||||
// if (!robotData.robotInfo.puId) {
|
||||
// const { data: res } = await getDeviceInfoApi()
|
||||
// if (res?.data?.length > 0) {
|
||||
// const deviceInfo = res.data[0]
|
||||
// robotData.setRobotInfo({
|
||||
// devName: deviceInfo.devName,
|
||||
// puId: deviceInfo.puId,
|
||||
// })
|
||||
|
||||
return {
|
||||
devName: deviceInfo.devName,
|
||||
puId: deviceInfo.puId,
|
||||
}
|
||||
// return {
|
||||
// devName: deviceInfo.devName,
|
||||
// puId: deviceInfo.puId,
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// return robotData.robotInfo
|
||||
// }
|
||||
|
||||
const { data: res } = await getDeviceInfoApi()
|
||||
if (res?.data?.length > 0) {
|
||||
const deviceInfo = res.data[0]
|
||||
return {
|
||||
devName: deviceInfo.devName,
|
||||
puId: deviceInfo.puId,
|
||||
}
|
||||
} else {
|
||||
return robotData.robotInfo
|
||||
}
|
||||
}
|
||||
|
||||
// 获取地图信息
|
||||
export const getRobotMapInfoFn = async (puId) => {
|
||||
if (!robotData.mapInfo.mapBase64) {
|
||||
const { data: res } = await handleRobotActionApi({
|
||||
puId,
|
||||
type: 4,
|
||||
})
|
||||
if (res.code === 200) {
|
||||
const { Data, Height, Width, MapId, Name } = res.data
|
||||
const mapInfo = {
|
||||
mapBase64: 'data:image/png;base64,' + Data,
|
||||
mapWidth: Width,
|
||||
mapHeight: Height,
|
||||
mapName: Name,
|
||||
mapId: MapId,
|
||||
}
|
||||
robotData.setMapInfo(mapInfo)
|
||||
return mapInfo
|
||||
// if (!robotData.mapInfo.mapBase64) {
|
||||
// const { data: res } = await handleRobotActionApi({
|
||||
// puId,
|
||||
// type: 4,
|
||||
// })
|
||||
// if (res.code === 200) {
|
||||
// const { Data, Height, Width, MapId, Name } = res.data
|
||||
// const mapInfo = {
|
||||
// mapBase64: 'data:image/png;base64,' + Data,
|
||||
// mapWidth: Width,
|
||||
// mapHeight: Height,
|
||||
// mapName: Name,
|
||||
// mapId: MapId,
|
||||
// }
|
||||
// robotData.setMapInfo(mapInfo)
|
||||
// return mapInfo
|
||||
// }
|
||||
// } else {
|
||||
// return robotData.mapInfo
|
||||
// }
|
||||
|
||||
const { data: res } = await handleRobotActionApi({
|
||||
puId,
|
||||
type: 4,
|
||||
})
|
||||
if (res.code === 200) {
|
||||
const { Data, Height, Width, MapId, Name } = res.data
|
||||
const mapInfo = {
|
||||
mapBase64: 'data:image/png;base64,' + Data,
|
||||
mapWidth: Width,
|
||||
mapHeight: Height,
|
||||
mapName: Name,
|
||||
mapId: MapId,
|
||||
}
|
||||
} else {
|
||||
return robotData.mapInfo
|
||||
|
||||
return mapInfo
|
||||
}
|
||||
}
|
||||
// 获取机器人实时定位信息
|
||||
export const getRobotPointsInfoFn = async (puId) => {
|
||||
if (!robotData.robotPoints.Robot_x && !robotData.robotPoints.Robot_y) {
|
||||
const { data: res } = await handleRobotActionApi({
|
||||
puId,
|
||||
type: 2,
|
||||
})
|
||||
if (res.code === 200) {
|
||||
const pointsInfo = {
|
||||
Robot_x: res?.data?.Robot_x,
|
||||
Robot_y: res?.data?.Robot_y,
|
||||
}
|
||||
robotData.setRobotPoints(pointsInfo)
|
||||
return pointsInfo
|
||||
// if (!robotData.robotPoints.Robot_x && !robotData.robotPoints.Robot_y) {
|
||||
// const { data: res } = await handleRobotActionApi({
|
||||
// puId,
|
||||
// type: 2,
|
||||
// })
|
||||
// if (res.code === 200) {
|
||||
// const pointsInfo = {
|
||||
// Robot_x: res?.data?.Robot_x,
|
||||
// Robot_y: res?.data?.Robot_y,
|
||||
// }
|
||||
// robotData.setRobotPoints(pointsInfo)
|
||||
// return pointsInfo
|
||||
// }
|
||||
// } else {
|
||||
// return robotData.robotPoints
|
||||
// }
|
||||
|
||||
const { data: res } = await handleRobotActionApi({
|
||||
puId,
|
||||
type: 2,
|
||||
})
|
||||
if (res.code === 200) {
|
||||
const pointsInfo = {
|
||||
Robot_x: res?.data?.Robot_x,
|
||||
Robot_y: res?.data?.Robot_y,
|
||||
}
|
||||
} else {
|
||||
return robotData.robotPoints
|
||||
return pointsInfo
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -563,6 +563,11 @@ const handleModifyPoint = () => {
|
|||
id: point.id,
|
||||
isAdd: point.isAdd,
|
||||
}
|
||||
|
||||
if (point.markerAngle === null) {
|
||||
message.warning('请先选择角度')
|
||||
return
|
||||
}
|
||||
emits('onHandleAddMarker', markerInfo)
|
||||
}
|
||||
closeContextMenu()
|
||||
|
|
@ -597,7 +602,7 @@ const addDevicePoint = (x, y, y1) => {
|
|||
markerY: y, // 直接存储逻辑坐标
|
||||
markerY1: y1, // 直接存储逻辑坐标
|
||||
markerName: '',
|
||||
markerAngle: '', // 角度
|
||||
markerAngle: null, // 角度
|
||||
markerPreset: '', // 摄像头预置位
|
||||
isAdd: true,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue