diff --git a/.env b/.env
index 66792ea..27ea5c2 100644
--- a/.env
+++ b/.env
@@ -5,8 +5,14 @@
# VITE_HOST_URL=http://192.168.1.194:8081/
-VITE_BASE_URL=http://127.0.0.1:8899
-VITE_WEBSOCKET_JAVA_URL=ws://127.0.0.1:8899/websocket/nuclear
+# VITE_BASE_URL=http://127.0.0.1:8899
+# VITE_WEBSOCKET_JAVA_URL=ws://127.0.0.1:8899/websocket/nuclear
+# # VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8899/websocket/nuclear
+# VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8081/ws/cmd
+# VITE_HOST_URL=http://127.0.0.1:8081/
+
+VITE_BASE_URL=http://192.168.1.111:8899
+VITE_WEBSOCKET_JAVA_URL=ws://192.168.1.111:8899/websocket/nuclear
# VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8899/websocket/nuclear
-VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8081/ws/cmd
-VITE_HOST_URL=http://127.0.0.1:8081/
\ No newline at end of file
+VITE_WEBSOCKET_CAMERA_URL=ws://192.168.1.111:8081/ws/cmd
+VITE_HOST_URL=http://192.168.1.111:8081/
\ No newline at end of file
diff --git a/src/command/index.js b/src/command/index.js
index 0ae434f..2473708 100644
--- a/src/command/index.js
+++ b/src/command/index.js
@@ -49,7 +49,7 @@ export const takePhoto = transformToString({
export const takeAndSavePhoto = transformToString({
command: 'takeAndSavePhoto',
filePrefix: 'nuclear/iflytop',
- messageId: uuidv4(),
+ messageId: 'takeAndSavePhoto',
need_receipt: true,
})
@@ -101,7 +101,7 @@ export const getCharacterRecognitionResultSimple = transformToString({
// 机械臂控制接口 获取机械臂 连接信息 x y 位置
export const getMechanicalArmState = transformToString({
command: 'getMechanicalArmState',
- messageId: uuidv4(),
+ messageId: 'getMechanicalArmState',
need_receipt: true,
})
diff --git a/src/components/Debug.vue b/src/components/Debug.vue
index a5a9774..2680f58 100644
--- a/src/components/Debug.vue
+++ b/src/components/Debug.vue
@@ -48,6 +48,7 @@
v-model="simulation_brightness"
:min="0"
:max="65535"
+ :disabled="!isCameraOpen"
@change="handleSimulationBrightness"
/>
{{ simulation_brightness }}
@@ -56,6 +57,7 @@
曝光时间
-
识别结果
+
结果
{{ recognitionResult }}
@@ -123,7 +125,7 @@ import {
import { MessagePlugin } from 'tdesign-vue-next'
const photoUrl = ref('')
-const recognitionResult = ref({})
+const recognitionResult = ref('')
setInterval(
() => {
@@ -171,10 +173,20 @@ const handleStopCharacterRecognition = () => {
websocketsend(stopCharacterRecognition)
}
const handleGetCharacterRecognitionResult = () => {
- websocketsend(getCharacterRecognitionResult)
+ if (isCameraOpen.value) {
+ // 如果相机打开则发送拍照,如果相机关闭 则提醒用户
+ websocketsend(getCharacterRecognitionResult)
+ } else {
+ MessagePlugin('error', { content: '请先开启相机' })
+ }
}
const handleGetMechanicalArmState = () => {
- websocketsend(getMechanicalArmState)
+ if (isCameraOpen.value) {
+ // 如果相机打开则发送拍照,如果相机关闭 则提醒用户
+ websocketsend(getMechanicalArmState)
+ } else {
+ MessagePlugin('error', { content: '请先开启相机' })
+ }
}
const handleOpenFlashLight = () => {
@@ -243,6 +255,16 @@ const websocketonmessage = e => {
const { isOpen } = cameraState
isCameraOpen.value = isOpen
break
+ case 'getMechanicalArmState':
+ const { state } = data
+ const { x, y } = state || {}
+ recognitionResult.value = `机械臂坐标x:${x}, y: ${y}`
+ break
+ case 'takeAndSavePhoto':
+ const { photoInfo } = data
+ const { path } = photoInfo
+ recognitionResult.value = `图片保存路径为${path}`
+ break
case 'getCameraParametersInteger':
const { value } = data
exposure.value = value
@@ -259,7 +281,10 @@ const websocketonmessage = e => {
break
case 'getCharacterRecognitionResult':
const { result } = data
- recognitionResult.value = result
+ const { result: str, srcImagePath } = result || {}
+ recognitionResult.value = `识别结果为${
+ str ? str : '空结果'
+ }, 图片保存路径为${srcImagePath}`
break
default:
break
diff --git a/src/components/Nuclear.vue b/src/components/Nuclear.vue
index 383154d..ede40d1 100644
--- a/src/components/Nuclear.vue
+++ b/src/components/Nuclear.vue
@@ -249,6 +249,8 @@ export default {
this.coreVisible = false
this.getCoreList()
}
+ } else {
+ this.$message.error(res?.msg)
}
} else {
this.$message.warning(firstError)
diff --git a/src/components/Task.vue b/src/components/Task.vue
index 2f8fdd9..6d675f8 100644
--- a/src/components/Task.vue
+++ b/src/components/Task.vue
@@ -491,6 +491,9 @@ export default {
},
updateOper(taskId) {
this.operTaskId = taskId
+ if (this.role == 'ROLE_ADMIN') {
+ this.getAllOperator()
+ }
this.updateOperVisible = true
},
operClose() {
@@ -607,9 +610,6 @@ export default {
},
mounted() {
this.getTaskList()
- if (this.role == 'USER_ADMIN') {
- this.getAllOperator()
- }
},
}