彈框
This commit is contained in:
		
							parent
							
								
									86a905e949
								
							
						
					
					
						commit
						4e4d357f7a
					
				| @ -338,6 +338,8 @@ export async function getEsCarModel(context) { | |||||||
| 
 | 
 | ||||||
| export async function upDataZhongxinginitialization(param) { | export async function upDataZhongxinginitialization(param) { | ||||||
|   return new Promise(async(resolve, reject) => { |   return new Promise(async(resolve, reject) => { | ||||||
|  |     console.log('teststet00',JSON.stringify(param)) | ||||||
|  | 
 | ||||||
|     if (!param.carId) { |     if (!param.carId) { | ||||||
|       resolve(false) |       resolve(false) | ||||||
|       return |       return | ||||||
| @ -352,6 +354,8 @@ export async function upDataZhongxinginitialization(param) { | |||||||
|        const result=await sqlInsertCommonFn(tableList[i], JSON.parse(data) || [], param.context) |        const result=await sqlInsertCommonFn(tableList[i], JSON.parse(data) || [], param.context) | ||||||
|        result?(flag=true):(flag=false) |        result?(flag=true):(flag=false) | ||||||
|      } |      } | ||||||
|  |       console.log('teststet1',JSON.stringify(param)) | ||||||
|  | 
 | ||||||
|       if(!flag){ |       if(!flag){ | ||||||
|         prompt.showToast({ |         prompt.showToast({ | ||||||
|           message: '本地文件初始化数据库失败', |           message: '本地文件初始化数据库失败', | ||||||
|  | |||||||
| @ -25,6 +25,8 @@ 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 { getSyncData } from '../service/initable'; | ||||||
|  | import VoiceAnnounce from '../../pages/judgeSDK/utils/voiceAnnouncements'; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| export default class UdpClientByCenter { | export default class UdpClientByCenter { | ||||||
| @ -41,6 +43,7 @@ export default class UdpClientByCenter { | |||||||
|   private lsh: string = null |   private lsh: string = null | ||||||
|   private context |   private context | ||||||
|   private stashFn: StashFunction |   private stashFn: StashFunction | ||||||
|  |   private errorStep: number=0 | ||||||
|   private interval |   private interval | ||||||
|   private headLenth: number = 9 |   private headLenth: number = 9 | ||||||
|   //消息头长度
 |   //消息头长度
 | ||||||
| @ -49,6 +52,7 @@ export default class UdpClientByCenter { | |||||||
|   private initParam |   private initParam | ||||||
|   private onMessage_1Callback:Function = ()=>{} |   private onMessage_1Callback:Function = ()=>{} | ||||||
|   public  currentValue:string = '' |   public  currentValue:string = '' | ||||||
|  |   private avPlayer | ||||||
| 
 | 
 | ||||||
|   constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) { |   constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) { | ||||||
|     this.localIp = udplocalIp |     this.localIp = udplocalIp | ||||||
| @ -57,6 +61,7 @@ export default class UdpClientByCenter { | |||||||
|     this.oppositeIpPort = udpOppositeIpPort |     this.oppositeIpPort = udpOppositeIpPort | ||||||
|     this.stashFn = () => { |     this.stashFn = () => { | ||||||
|     } |     } | ||||||
|  |     this.avPlayer = new VoiceAnnounce(); | ||||||
|     this.udp = socket.constructUDPSocketInstance(); |     this.udp = socket.constructUDPSocketInstance(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -316,12 +321,36 @@ export default class UdpClientByCenter { | |||||||
|       if(strachArr[83]!='4'){ |       if(strachArr[83]!='4'){ | ||||||
|         this.chafenFlag++ |         this.chafenFlag++ | ||||||
|         if(this.chafenFlag>=15&&!globalThis.dialogOpen){ |         if(this.chafenFlag>=15&&!globalThis.dialogOpen){ | ||||||
|           getUDP(globalThis.context,true) |           // getUDP(globalThis.context,true)
 | ||||||
|           globalThis.title='差分状态异常' |           globalThis.title='差分状态异常' | ||||||
|           globalThis.type='3' |           globalThis.type='3' | ||||||
|           AppStorage.SetOrCreate('errorMsg', 1); |           AppStorage.SetOrCreate('errorMsg', 1); | ||||||
|  |           if(this.errorStep!=1){ | ||||||
|  |             this.errorStep=1 | ||||||
|  |             this.avPlayer.playAudio(['voice/差分状态异常.wav']) | ||||||
|  |             getSyncData('MA_SYSSET').then(syssetParams => { | ||||||
|  |               // @ts-ignore
 | ||||||
|  |               syssetParams.forEach(sys => { | ||||||
|  |                 // 差分长时间是SINGLE状态报考车故障,停止考试(0-否 1-是)
 | ||||||
|  |                 if (sys.v_no === '424'&&sys.v_value==1){ | ||||||
|  |                   //plc差分丢失
 | ||||||
|  |                   console.log('sys.v_valuesys.v_valuesys.v_value',sys.v_value) | ||||||
|  |                   AppStorage.SetOrCreate('errorCode', 0); | ||||||
|  |                   AppStorage.SetOrCreate('errorCodeFlage', true); | ||||||
|  | 
 | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |               // const errorParam = syssetParams.filter(sys => sys.v_no === '424') //
 | ||||||
|  |               // that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0'
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |             }); | ||||||
|  |           } | ||||||
|         } |         } | ||||||
|       }else{ |       }else{ | ||||||
|  |         AppStorage.SetOrCreate('errorCode', -1); | ||||||
|  |         AppStorage.SetOrCreate('errorCodeFlage', false); | ||||||
|  |         this.errorStep=0 | ||||||
|         globalThis.dialogOpen=false |         globalThis.dialogOpen=false | ||||||
|       } |       } | ||||||
|       this.chafenFlag=0 |       this.chafenFlag=0 | ||||||
| @ -373,6 +402,29 @@ export default class UdpClientByCenter { | |||||||
|             globalThis.type='3' |             globalThis.type='3' | ||||||
|             if(!globalThis.dialogOpen){ |             if(!globalThis.dialogOpen){ | ||||||
|               AppStorage.SetOrCreate('errorMsg', 1); |               AppStorage.SetOrCreate('errorMsg', 1); | ||||||
|  |               if(this.errorStep!=1){ | ||||||
|  |                 console.log('sys.v_valuesys.v_valuesys.v_value11221') | ||||||
|  | 
 | ||||||
|  |                 this.errorStep=1 | ||||||
|  |                 this.avPlayer.playAudio(['voice/差分状态异常.wav']) | ||||||
|  |                 getSyncData('MA_SYSSET').then(syssetParams => { | ||||||
|  |                   console.log('sys.v_valuesys.v_valuesys.v_value11221',JSON.stringify(syssetParams)) | ||||||
|  |                   // @ts-ignore
 | ||||||
|  |                   syssetParams.forEach(sys => { | ||||||
|  |                     // 差分长时间是SINGLE状态报考车故障,停止考试(0-否 1-是)
 | ||||||
|  |                     if (sys.v_no === '424'&&sys.v_value==1){ | ||||||
|  |                       //plc差分丢失
 | ||||||
|  |                       AppStorage.SetOrCreate('errorCode', 0); | ||||||
|  |                       AppStorage.SetOrCreate('errorCodeFlage', true); | ||||||
|  | 
 | ||||||
|  |                     } | ||||||
|  |                   }) | ||||||
|  |                   // const errorParam = syssetParams.filter(sys => sys.v_no === '424') //
 | ||||||
|  |                   // that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0'
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |                 }); | ||||||
|  |               } | ||||||
|             } |             } | ||||||
|             num = 0 |             num = 0 | ||||||
|           } |           } | ||||||
|  | |||||||
| @ -28,10 +28,10 @@ export default class EntryAbility extends UIAbility { | |||||||
|         globalThis.examinerInfo = {} |         globalThis.examinerInfo = {} | ||||||
|         globalThis.deviceNo = ''; |         globalThis.deviceNo = ''; | ||||||
|         globalThis.hasAuth = false |         globalThis.hasAuth = false | ||||||
|         globalThis.version = '2022.08.13.01'//洛阳
 |         // globalThis.version = '2022.08.13.01'//洛阳
 | ||||||
|  |         // globalThis.judgeVersion = '2022.12.05.1'
 | ||||||
|         globalThis.judgeVersion = '2022.12.05.1' |         globalThis.judgeVersion = '2022.12.05.1' | ||||||
|         // globalThis.version = '2022.12.05.1'
 |         globalThis.version = '2022.08.13.01' | ||||||
|         // globalThis.judgeVersion = '2022.08.13.01'
 |  | ||||||
|         // globalThis.version = '2024.11.22.14'//济南
 |         // globalThis.version = '2024.11.22.14'//济南
 | ||||||
|         // globalThis.judgeVersion = '2024.11.22.14'
 |         // globalThis.judgeVersion = '2024.11.22.14'
 | ||||||
|         globalThis.videoVersion= '1.0' |         globalThis.videoVersion= '1.0' | ||||||
|  | |||||||
| @ -76,7 +76,6 @@ struct Index { | |||||||
|                 if (this.loading) { |                 if (this.loading) { | ||||||
|                   return |                   return | ||||||
|                 } |                 } | ||||||
| 
 |  | ||||||
|                 router.pushUrl({ |                 router.pushUrl({ | ||||||
|                   url: 'pages/Settings', |                   url: 'pages/Settings', | ||||||
|                 }, router.RouterMode.Single); |                 }, router.RouterMode.Single); | ||||||
| @ -102,6 +101,13 @@ struct Index { | |||||||
|                 if (this.loading) { |                 if (this.loading) { | ||||||
|                   return |                   return | ||||||
|                 } |                 } | ||||||
|  |                 const data=AppStorage.Get('errorCode'); // returns 47 | ||||||
|  |                 if(data==0){ | ||||||
|  |                   globalThis.title='差分状态异常' | ||||||
|  |                   globalThis.type='3' | ||||||
|  |                   AppStorage.SetOrCreate('errorMsg', 1); | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|                 setTimeout(() => { |                 setTimeout(() => { | ||||||
|                   this.angle = 360 |                   this.angle = 360 | ||||||
|                 }, 1000) |                 }, 1000) | ||||||
| @ -150,7 +156,6 @@ struct Index { | |||||||
|                       url: 'pages/UserInfo', |                       url: 'pages/UserInfo', | ||||||
|                     }, router.RouterMode.Single) |                     }, router.RouterMode.Single) | ||||||
|                   } else { |                   } else { | ||||||
|                     this.loading = true |  | ||||||
|                     this.testXMLToJSONInWorker() |                     this.testXMLToJSONInWorker() | ||||||
|                   } |                   } | ||||||
|                 }); |                 }); | ||||||
| @ -437,7 +442,7 @@ struct Index { | |||||||
|       if (this.num >= 3) { |       if (this.num >= 3) { | ||||||
|         this.heartMsg() |         this.heartMsg() | ||||||
|       } |       } | ||||||
|       const data=AppStorage.Get('errorMsg'); // returns 47 |       const data=AppStorage.Get('errorMsg'); | ||||||
|       console.log('1123',data,globalThis.type,globalThis.dialogOpen) |       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){ | ||||||
|  | |||||||
| @ -376,7 +376,7 @@ struct UserInfo { | |||||||
|         that.jkxlh = serialNumberArr?.[0]?.v_value || '1234567' |         that.jkxlh = serialNumberArr?.[0]?.v_value || '1234567' | ||||||
|         const ksxtbhArr = syssetParams.filter(sys => sys.v_no === '902') |         const ksxtbhArr = syssetParams.filter(sys => sys.v_no === '902') | ||||||
|         that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222' |         that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222' | ||||||
|         const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') |         const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') //判断自动更新 | ||||||
|         that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' |         that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' | ||||||
|         const openCheckFlagParam = syssetParams.filter(sys => sys.v_no == '17') |         const openCheckFlagParam = syssetParams.filter(sys => sys.v_no == '17') | ||||||
|         const openCheckFlag = openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0' |         const openCheckFlag = openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0' | ||||||
| @ -402,25 +402,29 @@ struct UserInfo { | |||||||
|             that.openDeviceByIDCard() |             that.openDeviceByIDCard() | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|         if (that.list.length) { | 
 | ||||||
|           return |  | ||||||
|         } |  | ||||||
|         //0不自动更新 1自动更新(不限次数) 2没有考生更新2次 |         //0不自动更新 1自动更新(不限次数) 2没有考生更新2次 | ||||||
|         if (that.studentRefreshStatue == '2') { |         if (that.studentRefreshStatue == '2') { | ||||||
|           clearInterval(that.interval) |           if(that.list.length == 0){ | ||||||
|           that.interval = setInterval(() => { |             clearInterval(that.interval) | ||||||
|             if (that.list.length == 0 && that.numCount < 3) { |             that.interval = setInterval(() => { | ||||||
|               that.numCount++ |               if (that.numCount < 3) { | ||||||
|               that.getExaminationStudentInfoFn() |                 that.numCount++ | ||||||
|             } |                 that.getExaminationStudentInfoFn() | ||||||
|           }, 5000) |               } | ||||||
|  |             }, 5000) | ||||||
|  |           }else{ | ||||||
|  |             that.getExaminationStudentInfoFn() | ||||||
|  |           } | ||||||
|         } else if (that.studentRefreshStatue == '1') { |         } else if (that.studentRefreshStatue == '1') { | ||||||
|           clearInterval(that.interval) |           if(that.list.length == 0){ | ||||||
|           that.interval = setInterval(() => { |             clearInterval(that.interval) | ||||||
|             if (that.list.length == 0) { |             that.interval = setInterval(() => { | ||||||
|               that.getExaminationStudentInfoFn() |                 that.getExaminationStudentInfoFn() | ||||||
|             } |             }, 5000) | ||||||
|           }, 5000) |           }else{ | ||||||
|  |             that.getExaminationStudentInfoFn() | ||||||
|  |           } | ||||||
|         } else { |         } else { | ||||||
|           // this.getExaminationItemFn() |           // this.getExaminationItemFn() | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -1,3 +1,5 @@ | |||||||
|  | import router from '@ohos.router'; | ||||||
|  | 
 | ||||||
| @CustomDialog | @CustomDialog | ||||||
| export default struct errorMsgDialog { | export default struct errorMsgDialog { | ||||||
|   private controller?: CustomDialogController |   private controller?: CustomDialogController | ||||||
| @ -5,15 +7,15 @@ export default struct errorMsgDialog { | |||||||
|   } |   } | ||||||
|   confirm: () => void = () => { |   confirm: () => void = () => { | ||||||
|   } |   } | ||||||
|   dialogRatio:number=0.8 |   dialogRatio: number = 0.8 | ||||||
|   title?: string |   title?: string | ||||||
|   type: string //1 tip 2loading 3Dialog |   type: string //1 tip 2loading 3Dialog | ||||||
|   @State angle: number = 0 |   @State angle: number = 0 | ||||||
| 
 | 
 | ||||||
|   @Styles |   @Styles | ||||||
|   commStyle(){ |   commStyle(){ | ||||||
|     .width(220 * globalThis.ratio * this.dialogRatio *0.6) |     .width(220 * globalThis.ratio * this.dialogRatio * 0.6) | ||||||
|     .height(69 * globalThis.ratio * this.dialogRatio*0.6) |     .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 }) | ||||||
| @ -21,12 +23,12 @@ export default struct errorMsgDialog { | |||||||
| 
 | 
 | ||||||
|   build() { |   build() { | ||||||
|     Column() { |     Column() { | ||||||
|       if(this.title){ |       if (this.title) { | ||||||
|         Text(this.title) |         Text(this.title) | ||||||
|           .fontSize(30* this.dialogRatio) |           .fontSize(30 * this.dialogRatio) | ||||||
|           .margin(120* this.dialogRatio) |           .margin(120 * this.dialogRatio) | ||||||
|       } |       } | ||||||
|       if (this.type=='2') { |       if (this.type == '2') { | ||||||
|         Image($r('app.media.open_loading')) |         Image($r('app.media.open_loading')) | ||||||
|           .width(200) |           .width(200) | ||||||
|           .rotate({ angle: this.angle }) |           .rotate({ angle: this.angle }) | ||||||
| @ -40,7 +42,7 @@ export default struct errorMsgDialog { | |||||||
|           }) |           }) | ||||||
|           .margin(50) |           .margin(50) | ||||||
|       } |       } | ||||||
|       if (this.type=='3') { |       if (this.type == '3') { | ||||||
|         Row() { |         Row() { | ||||||
|           Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { |           Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { | ||||||
|             Text('  取   消  ') |             Text('  取   消  ') | ||||||
| @ -51,6 +53,16 @@ export default struct errorMsgDialog { | |||||||
|           .commStyle() |           .commStyle() | ||||||
|           .onClick(() => { |           .onClick(() => { | ||||||
|             if (this.controller != undefined) { |             if (this.controller != undefined) { | ||||||
|  |               const errorCode=AppStorage.Get('errorMsg'); | ||||||
|  |               const errorCodeFlage=AppStorage.Get('errorCodeFlage'); | ||||||
|  |               console.log('errorCode',errorCode,errorCodeFlage) | ||||||
|  |               if(errorCode==0&&errorCodeFlage){ | ||||||
|  |                 router.replaceUrl({ | ||||||
|  |                   url: 'pages/Index', | ||||||
|  |                 }, router.RouterMode.Single); | ||||||
|  |                 router.clear(); | ||||||
|  | 
 | ||||||
|  |               } | ||||||
|               this.cancel() |               this.cancel() | ||||||
|               this.controller.close() |               this.controller.close() | ||||||
|             } |             } | ||||||
| @ -64,35 +76,54 @@ export default struct errorMsgDialog { | |||||||
|           } |           } | ||||||
|           .commStyle() |           .commStyle() | ||||||
|           .onClick(() => { |           .onClick(() => { | ||||||
|  |                const errorCode=AppStorage.Get('errorMsg'); | ||||||
|  |               const errorCodeFlage=AppStorage.Get('errorCodeFlage'); | ||||||
|  |               console.log('errorCode',errorCode,errorCodeFlage) | ||||||
|  |               if(errorCode==0&&errorCodeFlage){ | ||||||
|  |                 router.replaceUrl({ | ||||||
|  |                   url: 'pages/Index', | ||||||
|  |                 }, router.RouterMode.Single); | ||||||
|  |                 router.clear(); | ||||||
|  | 
 | ||||||
|  |               } | ||||||
|  |              console.log('errorCode',errorCode,errorCodeFlage) | ||||||
|  | 
 | ||||||
|             if (this.controller != undefined){ |             if (this.controller != undefined){ | ||||||
|               this.confirm() |               this.confirm() | ||||||
|               this.controller.close() |               this.controller.close() | ||||||
|             } |             } | ||||||
|           }) |  | ||||||
|         }.padding({bottom:20}) |  | ||||||
| 
 |  | ||||||
|       } |  | ||||||
|     }.backgroundColor('#E6E3DF') |  | ||||||
|     .borderRadius(19 * globalThis.ratio) |  | ||||||
|     .constraintSize({ minWidth: 520 }) |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   aboutToAppear() { |  | ||||||
|     AppStorage.SetOrCreate('errorMsg', 0); |  | ||||||
|     setTimeout(() => { |  | ||||||
|       console.log('this.type',this.type,this.angle) |  | ||||||
|       if (this.type=='2') { |  | ||||||
|         this.angle = 360 |  | ||||||
|       } |  | ||||||
|     },1000) |  | ||||||
|     if(this.type=='1'){ |  | ||||||
|       setTimeout(()=>{ |  | ||||||
|         this.controller.close() |  | ||||||
|       },2000) |  | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     ) | ||||||
|   } |   } | ||||||
|   aboutToDisappear() { | 
 | ||||||
|     this.title='' |   .padding({bottom:20}) | ||||||
|     this.angle = 0 | } | ||||||
|  | } | ||||||
|  | . | ||||||
|  | backgroundColor('#E6E3DF') | ||||||
|  |   .borderRadius(19 * globalThis.ratio) | ||||||
|  |   .constraintSize({ minWidth: 520 }) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | aboutToAppear() { | ||||||
|  |   AppStorage.SetOrCreate('errorMsg', 0); | ||||||
|  |   setTimeout(() => { | ||||||
|  |     console.log('this.type', this.type, this.angle) | ||||||
|  |     if (this.type == '2') { | ||||||
|  |       this.angle = 360 | ||||||
|  |     } | ||||||
|  |   }, 1000) | ||||||
|  |   if (this.type == '1') { | ||||||
|  |     setTimeout(() => { | ||||||
|  |       this.controller.close() | ||||||
|  |     }, 2000) | ||||||
|   } |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | aboutToDisappear() { | ||||||
|  |   this.title = '' | ||||||
|  |   this.angle = 0 | ||||||
|  |   AppStorage.SetOrCreate('errorCodeFlage', false); | ||||||
|  | } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user