From 71ee2a79cb75d42cae937dd069f8303bec6d839b Mon Sep 17 00:00:00 2001 From: surenjun Date: Fri, 2 Aug 2024 11:28:09 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9AuserInfo=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/UserInfo.ets | 127 ++++++++++++-------------- 1 file changed, 59 insertions(+), 68 deletions(-) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 5828707f..05b9e4d7 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -23,11 +23,13 @@ import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; import { JudgeConfig } from '../config/judge'; import { judgeConfig } from './judgeSDK/utils/judgeConfig'; + @Entry @Component struct UserInfo { private filePhoto: FilePhoto private avPlayer + @State pageIndex: number = 0 @State ratio: number = 1700 / 960 @State index: number = 0 @@ -47,7 +49,7 @@ struct UserInfo { @State isFirstBoardPrePareSetPopupBtnShow: boolean = false @State isBoardPrePareSetPopupShow: boolean = false @State isLoadingPopupVisible:boolean = false; - @State loadingText:string = '正在生成考试记录,请稍后...' + @State loadingText:string = '正在认证监管信息,请稍后...' @State sczbkf:{xmdm:number,kfdm:string}[] = [] @State currentUser: User = EmptyCandidateObject @State dataList: Array = [] @@ -85,10 +87,7 @@ struct UserInfo { return photoBase64 } } - private filePhoto: FilePhoto - private avPlayer - private AccountTable = new AccountTable(() => { - }, USER); + private AccountTable = new AccountTable(() => {}, USER); private context = getContext(this) as common.UIAbilityContext; private labelBlocks = [ { label: '考生姓名', key: 'xm' }, @@ -513,62 +512,64 @@ struct UserInfo { }); } this.currentUser.id = '1' - //是否已经开始考试 - // if(!this.isExamStart){ - const code = await this.beginExam(); - if (code != 1) { - return - } - // } - await upDateTableByArray('USER', [this.currentUser]) - globalThis.statue = 4 - this.stepFlag = false - router.pushUrl({ - url: 'pages/Judge', - params: { - examItems: examItems?.getExaminationItemRsp?.body?.ykxx, - sczb: Number(this.isBoardPrePareSetPopupOpen), - kfdm: this.sczbkf + const avPlayer = this.avPlayer; + this.isLoadingPopupVisible = true + avPlayer.playAudio([`voice/监管通信中.mp3`],false,async ()=>{ + const code = await this.beginExam(); + if (code != 1) { + promptAction.showToast({ + message:'开始考试接口调用失败!', + duration:4000 + }) + return } - }, router.RouterMode.Single); - this.stopDeviceById() - this.stepFlag = false + await upDateTableByArray('USER', [this.currentUser]) + globalThis.statue = 4 + this.stepFlag = false + this.isLoadingPopupVisible = false + router.pushUrl({ + url: 'pages/Judge', + params: { + examItems: examItems?.getExaminationItemRsp?.body?.ykxx, + sczb: Number(this.isBoardPrePareSetPopupOpen), + kfdm: this.sczbkf + } + }, router.RouterMode.Single); + this.stopDeviceById() + this.stepFlag = false + }) } // 检测车门、熄火信号 async checkSignal(): Promise { const {isCheckFireOpen} = judgeConfig - return new Promise((resolve, reject) => { - if (isCheckFireOpen) { + return new Promise((resolve,reject)=>{ + if(isCheckFireOpen){ resolve(true) + // return + } + console.info('socketTag[PLC.UdpClient]', '注册udp回调') + let plcValue = globalThis.udpClient.getCurrentMessage(); + console.info('surenjun',plcValue) + const msgArr = plcValue.split(',') || '' + const mkg = msgArr[14]; + const fdjzs = msgArr[25]; + if(mkg == 1){ + this.avPlayer.playAudio(['voice/关门.mp3']) + promptAction.showToast({ + message:'请关闭车门', + duration:4000 + }) + reject(false) + } + if(fdjzs*1 > 0){ + this.avPlayer.playAudio(['voice/熄火.mp3']) + promptAction.showToast({ + message:'请熄火', + duration:4000 + }) + reject(false) } - globalThis.udpClient.onMessage_1(async (msg) => { - const msgArr = msg.split(',') - const mkg = msgArr[14]; - const fdjzs = msgArr[25]; - globalThis.udpClient.onMessage_1(() => { - }); - //TODO - console.info('surenjun mkg=>', mkg) - console.info('surenjun fdjzs=>', fdjzs) - if (mkg == 1) { - this.avPlayer.playAudio(['voice/关门.mp3']) - promptAction.showToast({ - message: '请关闭车门', - duration: 4000 - }) - reject(false) - } - if (fdjzs * 1 > 0) { - this.avPlayer.playAudio(['voice/熄火.mp3']) - promptAction.showToast({ - message: '请熄火', - duration: 4000 - }) - reject(false) - } - resolve(true) - }) }) } @@ -838,16 +839,7 @@ struct UserInfo { BoardPrePareSetPopup({ closePopup: (bool) => { this.isBoardPrePareSetPopupShow = false; - // if(!globalThis.singlePlay){ - // this.isFirstBoardPrePareSetPopupBtnShow = !bool; - // } }, - // endLoading:()=>{ - // this.isLoadingPopupVisible = false; - // this.faceCompareSucess = 0 - // this.numCount = 0 - // this.getExaminationStudentInfoFn() - // }, confirmMark: (kfdm) => { this.sczbkf = kfdm } @@ -855,12 +847,11 @@ struct UserInfo { } // loading - // if(this.isLoadingPopupVisible){ - // LoadingPopup({ - // title: this.loadingText, - // }) - // } - + if(this.isLoadingPopupVisible){ + LoadingPopup({ + title: this.loadingText, + }) + } } .height('100%') .width('100%') -- 2.43.0.windows.1