|
|
@ -125,6 +125,12 @@ |
|
|
|
</div> |
|
|
|
<img :src="photoUrl" class="photo" v-else /> |
|
|
|
</div> |
|
|
|
<t-loading |
|
|
|
:loading="loadingVisible" |
|
|
|
text="识别中..." |
|
|
|
fullscreen |
|
|
|
size="large" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
@ -156,25 +162,27 @@ const station_core_id = ref('') |
|
|
|
|
|
|
|
const coreList = ref([]) |
|
|
|
|
|
|
|
const loadingVisible = ref(false) |
|
|
|
|
|
|
|
const handleSelectChange = async val => { |
|
|
|
const res = await getCameraConfig(val) |
|
|
|
if (res?.code == 200) { |
|
|
|
if (res?.data?.exposure) { |
|
|
|
exposure.value = res?.data?.exposure |
|
|
|
// 改变相机的exposure |
|
|
|
handleExposureTime(res?.data?.exposure) |
|
|
|
} else { |
|
|
|
exposure.value = 0 |
|
|
|
handleExposureTime(0) |
|
|
|
} |
|
|
|
if (res?.data?.brightness) { |
|
|
|
simulation_brightness.value = res?.data?.brightness |
|
|
|
// 改变相机的simulation_brightness |
|
|
|
handleSimulationBrightness(res?.data?.brightness) |
|
|
|
} else { |
|
|
|
simulation_brightness.value = 0 |
|
|
|
handleSimulationBrightness(0) |
|
|
|
} |
|
|
|
// if (res?.data?.exposure) { |
|
|
|
// exposure.value = res?.data?.exposure |
|
|
|
// // 改变相机的exposure |
|
|
|
// handleExposureTime(res?.data?.exposure) |
|
|
|
// } else { |
|
|
|
// exposure.value = 0 |
|
|
|
// handleExposureTime(0) |
|
|
|
// } |
|
|
|
// if (res?.data?.brightness) { |
|
|
|
// simulation_brightness.value = res?.data?.brightness |
|
|
|
// // 改变相机的simulation_brightness |
|
|
|
// handleSimulationBrightness(res?.data?.brightness) |
|
|
|
// } else { |
|
|
|
// simulation_brightness.value = 0 |
|
|
|
// handleSimulationBrightness(0) |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -183,6 +191,9 @@ onMounted(async () => { |
|
|
|
if (res?.code == 200) { |
|
|
|
coreList.value = res?.data?.list |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
websocketsend(openFlashLight) |
|
|
|
}, 2000) |
|
|
|
}) |
|
|
|
|
|
|
|
const onSubmit = async () => { |
|
|
@ -251,6 +262,7 @@ const handleStopCharacterRecognition = () => { |
|
|
|
const handleGetCharacterRecognitionResult = () => { |
|
|
|
if (isCameraOpen.value) { |
|
|
|
// 如果相机打开则发送拍照,如果相机关闭 则提醒用户 |
|
|
|
loadingVisible.value = true |
|
|
|
websocketsend(getCharacterRecognitionResult) |
|
|
|
} else { |
|
|
|
MessagePlugin('error', { content: '请先开启相机' }) |
|
|
@ -348,15 +360,22 @@ const websocketonmessage = e => { |
|
|
|
case 'getCharacterRecognitionResult': |
|
|
|
const { result } = data |
|
|
|
const { result: str, srcImagePath } = result || {} |
|
|
|
loadingVisible.value = false |
|
|
|
recognitionResult.value = `识别结果为${ |
|
|
|
str ? str : '空结果' |
|
|
|
}, 图片保存路径为${srcImagePath}` |
|
|
|
if (str) { |
|
|
|
MessagePlugin.success('识别结果为' + str) |
|
|
|
} else { |
|
|
|
MessagePlugin.error('识别失败,结果为空') |
|
|
|
} |
|
|
|
break |
|
|
|
default: |
|
|
|
break |
|
|
|
} |
|
|
|
} else { |
|
|
|
// MessagePlugin('error', { content: 'ws发送指令执行错误' }) |
|
|
|
loadingVisible.value = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -572,9 +591,9 @@ onUnmounted(() => { |
|
|
|
background: #ebebeb; |
|
|
|
} |
|
|
|
.photo { |
|
|
|
flex: 1; |
|
|
|
width: 100%; |
|
|
|
width: 835px; |
|
|
|
border-radius: 6px; |
|
|
|
object-fit: cover; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|