diff --git a/entry/src/main/ets/common/utils/UdpClientByCenter.ts b/entry/src/main/ets/common/utils/UdpClientByCenter.ts index 678dc210..8b337fb8 100644 --- a/entry/src/main/ets/common/utils/UdpClientByCenter.ts +++ b/entry/src/main/ets/common/utils/UdpClientByCenter.ts @@ -25,7 +25,6 @@ import prompt from '@ohos.prompt' import promptAction from '@ohos.promptAction'; import { getUDP } from './GlobalUdp'; import { dateFormat } from '../utils/tools' -import { formatTime } from '../../../chengmai/ets/common/utils/tools'; export default class UdpClientByCenter { @@ -369,13 +368,14 @@ export default class UdpClientByCenter { console.log(TAG, 'plc udp信号丢失') if (num == 3) { getUDP(globalThis.context,true) + globalThis.title='plc udp信号丢失' + globalThis.type='3' + if(!globalThis.dialogOpen){ + AppStorage.SetOrCreate('errorMsg', 1); + } num = 0 } - globalThis.title='plc udp信号丢失' - globalThis.type='3' - if(!globalThis.dialogOpen){ - AppStorage.SetOrCreate('errorMsg', 1); - } + prompt.showToast({ message: 'plc udp信号丢失', duration: 2000 @@ -384,7 +384,7 @@ export default class UdpClientByCenter { this.plcUdpError = true; }, 2000) - }, 3000) + }, 2000) } // initHeartSendMsg(param,context){ diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 771df50b..ab724f87 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -447,10 +447,11 @@ struct Index { this.heartMsg() } const data=AppStorage.Get('errorMsg'); // returns 47 - console.log('1123',data,globalThis.type) + console.log('1123',data,globalThis.type,globalThis.dialogOpen) if(data==1){ if(globalThis.type=='3'&&!globalThis.dialogOpen){ globalThis.dialogOpen=true + this.errorDialog.open() }else if(globalThis.type=='1'){ this.errorDialog.open() } diff --git a/entry/src/main/ets/pages/compontents/errorMsgDialog.ets b/entry/src/main/ets/pages/compontents/errorMsgDialog.ets index 24f9a866..5a4723e1 100644 --- a/entry/src/main/ets/pages/compontents/errorMsgDialog.ets +++ b/entry/src/main/ets/pages/compontents/errorMsgDialog.ets @@ -12,8 +12,8 @@ export default struct errorMsgDialog { @Styles commStyle(){ - .width(220 * globalThis.ratio * this.dialogRatio ) - .height(69 * globalThis.ratio * this.dialogRatio) + .width(220 * globalThis.ratio * this.dialogRatio *0.6) + .height(69 * globalThis.ratio * this.dialogRatio*0.6) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) // .margin({ bottom: 12 * this.ratio }) @@ -44,9 +44,9 @@ export default struct errorMsgDialog { Row() { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Text(' 取 消 ') - .fontSize(24 * globalThis.ratio* this.dialogRatio ) + .fontSize(24 * globalThis.ratio* this.dialogRatio*0.6 ) .fontColor('#fff') - .width(100 * globalThis.ratio* this.dialogRatio) + .width(60 * globalThis.ratio* this.dialogRatio) } .commStyle() .onClick(() => { @@ -58,9 +58,9 @@ export default struct errorMsgDialog { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Text(' 确 定 ') - .fontSize(24 * globalThis.ratio* this.dialogRatio) + .fontSize(24 * globalThis.ratio* this.dialogRatio*0.6) .fontColor('#fff') - .width(100 * globalThis.ratio* this.dialogRatio) + .width(60 * globalThis.ratio* this.dialogRatio) } .commStyle() .onClick(() => { @@ -69,7 +69,7 @@ export default struct errorMsgDialog { this.controller.close() } }) - } + }.padding({bottom:20}) } }.backgroundColor('#E6E3DF')