From 3b121ed5b24d3913807c314bc0d66d14e7d700b0 Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Wed, 14 Aug 2024 13:15:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E6=AE=BC=E5=84=AA=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/utils/TcpClient.ts | 13 +++++++++++++ entry/src/main/ets/pages/Index.ets | 11 ++++++----- .../src/main/ets/pages/compontents/FaceCompare.ets | 6 +++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index ad2e7a25..79c8d7cd 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -152,6 +152,7 @@ export default class TcpClient { onMessage(callback?) { this.tcp.on('message', value => { console.log(TAG, 'Tcponmessage', value.length, value) + globalThis.tcpUdpError = false // console.log('messageLengt',,value.message.length)) console.log('testTagtcpmsg') @@ -165,6 +166,18 @@ export default class TcpClient { } else { callback && callback('') } + setTimeout(async () => { + //程序断开 + if (globalThis.tcpUdpError) { + this.num++ + console.log(TAG,'tcp信号丢失') + if(this.num==3){ + getTCP() + this.num=0 + } + } + globalThis.tcpUdpError = true; + }, 2000) // callback(value.message) }); } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 35a73430..919fee2b 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -319,6 +319,7 @@ struct Index { } async onPageShow() { + this.userAuth(); this.vocObj = new voiceService(async (status, val, next) => { }); @@ -332,7 +333,6 @@ struct Index { } this.isSingle = globalThis.singlePlay this.loading = false - this.userAuth(); this.createAlbum() this.num=0 @@ -385,13 +385,14 @@ struct Index { } async initParams() { + //设置plc udp 同步requesthost + await getUDP(this.context,false) this.loading = false takePhotoFn(this.context) await getDeviceInfo(this.context) - await getCarInfo() - await getUDP(this.context,false) - await getUDP2(this.context,false) - getTCP() + // await getCarInfo() + // await getUDP2(this.context,false) + // getTCP() this.deviceId= globalThis.carInfo.carNo await setCurrentTime(); this.carNum = globalThis.carInfo.plateNo; diff --git a/entry/src/main/ets/pages/compontents/FaceCompare.ets b/entry/src/main/ets/pages/compontents/FaceCompare.ets index 232a38d7..ae138df9 100644 --- a/entry/src/main/ets/pages/compontents/FaceCompare.ets +++ b/entry/src/main/ets/pages/compontents/FaceCompare.ets @@ -45,7 +45,7 @@ export default struct FaceCompare { Column() { Column() { Text('照片比对') - .lineHeight('16%') + // .lineHeight('16%') .height('16%') .fontWeight(FontWeight.Bold) .fontSize(24) @@ -78,11 +78,11 @@ export default struct FaceCompare { .height('100%') } .width('88.9%') - .height('53.2%') + .height('52%') .justifyContent(FlexAlign.SpaceBetween) Text('正在等待拍照…') - .lineHeight('16%') + // .lineHeight('16%') .height('16%') .fontWeight(FontWeight.Bold) .fontColor('#CC7E00')