Compare commits

...

3 Commits

3 changed files with 17 additions and 16 deletions

View File

@ -25,7 +25,6 @@ import prompt from '@ohos.prompt'
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { getUDP } from './GlobalUdp'; import { getUDP } from './GlobalUdp';
import { dateFormat } from '../utils/tools' import { dateFormat } from '../utils/tools'
import { formatTime } from '../../../chengmai/ets/common/utils/tools';
export default class UdpClientByCenter { export default class UdpClientByCenter {
@ -369,13 +368,14 @@ export default class UdpClientByCenter {
console.log(TAG, 'plc udp信号丢失') console.log(TAG, 'plc udp信号丢失')
if (num == 3) { if (num == 3) {
getUDP(globalThis.context,true) getUDP(globalThis.context,true)
num = 0
}
globalThis.title='plc udp信号丢失' globalThis.title='plc udp信号丢失'
globalThis.type='3' globalThis.type='3'
if(!globalThis.dialogOpen){ if(!globalThis.dialogOpen){
AppStorage.SetOrCreate('errorMsg', 1); AppStorage.SetOrCreate('errorMsg', 1);
} }
num = 0
}
prompt.showToast({ prompt.showToast({
message: 'plc udp信号丢失', message: 'plc udp信号丢失',
duration: 2000 duration: 2000
@ -384,7 +384,7 @@ export default class UdpClientByCenter {
this.plcUdpError = true; this.plcUdpError = true;
}, 2000) }, 2000)
}, 3000) }, 2000)
} }
// initHeartSendMsg(param,context){ // initHeartSendMsg(param,context){

View File

@ -386,7 +386,7 @@ struct Index {
// const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) // const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
console.info('Index onPageShow'); console.info('Index onPageShow');
globalThis.lsh = '1111111111111'
} }
async createAlbum() { async createAlbum() {
@ -447,10 +447,11 @@ struct Index {
this.heartMsg() this.heartMsg()
} }
const data=AppStorage.Get('errorMsg'); // returns 47 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(data==1){
if(globalThis.type=='3'&&!globalThis.dialogOpen){ if(globalThis.type=='3'&&!globalThis.dialogOpen){
globalThis.dialogOpen=true globalThis.dialogOpen=true
this.errorDialog.open()
}else if(globalThis.type=='1'){ }else if(globalThis.type=='1'){
this.errorDialog.open() this.errorDialog.open()
} }

View File

@ -12,8 +12,8 @@ export default struct errorMsgDialog {
@Styles @Styles
commStyle(){ commStyle(){
.width(220 * globalThis.ratio * this.dialogRatio ) .width(220 * globalThis.ratio * this.dialogRatio *0.6)
.height(69 * globalThis.ratio * this.dialogRatio) .height(69 * globalThis.ratio * this.dialogRatio*0.6)
.backgroundImage($r('app.media.button_nor')) .backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
// .margin({ bottom: 12 * this.ratio }) // .margin({ bottom: 12 * this.ratio })
@ -44,9 +44,9 @@ export default struct errorMsgDialog {
Row() { Row() {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(' 取 消 ') Text(' 取 消 ')
.fontSize(24 * globalThis.ratio* this.dialogRatio ) .fontSize(24 * globalThis.ratio* this.dialogRatio*0.6 )
.fontColor('#fff') .fontColor('#fff')
.width(100 * globalThis.ratio* this.dialogRatio) .width(60 * globalThis.ratio* this.dialogRatio)
} }
.commStyle() .commStyle()
.onClick(() => { .onClick(() => {
@ -58,9 +58,9 @@ export default struct errorMsgDialog {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(' 确 定 ') Text(' 确 定 ')
.fontSize(24 * globalThis.ratio* this.dialogRatio) .fontSize(24 * globalThis.ratio* this.dialogRatio*0.6)
.fontColor('#fff') .fontColor('#fff')
.width(100 * globalThis.ratio* this.dialogRatio) .width(60 * globalThis.ratio* this.dialogRatio)
} }
.commStyle() .commStyle()
.onClick(() => { .onClick(() => {
@ -69,7 +69,7 @@ export default struct errorMsgDialog {
this.controller.close() this.controller.close()
} }
}) })
} }.padding({bottom:20})
} }
}.backgroundColor('#E6E3DF') }.backgroundColor('#E6E3DF')