feat_surenjun #46

Merged
wangzhongjie merged 2 commits from feat_surenjun into main 2024-08-02 11:29:59 +08:00

View File

@ -23,11 +23,13 @@ import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { JudgeConfig } from '../config/judge'; import { JudgeConfig } from '../config/judge';
import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import { judgeConfig } from './judgeSDK/utils/judgeConfig';
@Entry @Entry
@Component @Component
struct UserInfo { struct UserInfo {
private filePhoto: FilePhoto private filePhoto: FilePhoto
private avPlayer private avPlayer
@State pageIndex: number = 0 @State pageIndex: number = 0
@State ratio: number = 1700 / 960 @State ratio: number = 1700 / 960
@State index: number = 0 @State index: number = 0
@ -47,7 +49,7 @@ struct UserInfo {
@State isFirstBoardPrePareSetPopupBtnShow: boolean = false @State isFirstBoardPrePareSetPopupBtnShow: boolean = false
@State isBoardPrePareSetPopupShow: boolean = false @State isBoardPrePareSetPopupShow: boolean = false
@State isLoadingPopupVisible:boolean = false; @State isLoadingPopupVisible:boolean = false;
@State loadingText:string = '正在生成考试记录,请稍后...' @State loadingText:string = '正在认证监管信息,请稍后...'
@State sczbkf:{xmdm:number,kfdm:string}[] = [] @State sczbkf:{xmdm:number,kfdm:string}[] = []
@State currentUser: User = EmptyCandidateObject @State currentUser: User = EmptyCandidateObject
@State dataList: Array<User> = [] @State dataList: Array<User> = []
@ -85,10 +87,7 @@ struct UserInfo {
return photoBase64 return photoBase64
} }
} }
private filePhoto: FilePhoto private AccountTable = new AccountTable(() => {}, USER);
private avPlayer
private AccountTable = new AccountTable(() => {
}, USER);
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private labelBlocks = [ private labelBlocks = [
{ label: '考生姓名', key: 'xm' }, { label: '考生姓名', key: 'xm' },
@ -513,62 +512,64 @@ struct UserInfo {
}); });
} }
this.currentUser.id = '1' this.currentUser.id = '1'
//是否已经开始考试 const avPlayer = this.avPlayer;
// if(!this.isExamStart){ this.isLoadingPopupVisible = true
const code = await this.beginExam(); avPlayer.playAudio([`voice/监管通信中.mp3`],false,async ()=>{
if (code != 1) { const code = await this.beginExam();
return if (code != 1) {
} promptAction.showToast({
// } message:'开始考试接口调用失败!',
await upDateTableByArray('USER', [this.currentUser]) duration:4000
globalThis.statue = 4 })
this.stepFlag = false return
router.pushUrl({
url: 'pages/Judge',
params: {
examItems: examItems?.getExaminationItemRsp?.body?.ykxx,
sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf
} }
}, router.RouterMode.Single); await upDateTableByArray('USER', [this.currentUser])
this.stopDeviceById() globalThis.statue = 4
this.stepFlag = false 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<boolean> { async checkSignal(): Promise<boolean> {
const {isCheckFireOpen} = judgeConfig const {isCheckFireOpen} = judgeConfig
return new Promise((resolve, reject) => { return new Promise((resolve,reject)=>{
if (isCheckFireOpen) { if(isCheckFireOpen){
resolve(true) 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({ BoardPrePareSetPopup({
closePopup: (bool) => { closePopup: (bool) => {
this.isBoardPrePareSetPopupShow = false; this.isBoardPrePareSetPopupShow = false;
// if(!globalThis.singlePlay){
// this.isFirstBoardPrePareSetPopupBtnShow = !bool;
// }
}, },
// endLoading:()=>{
// this.isLoadingPopupVisible = false;
// this.faceCompareSucess = 0
// this.numCount = 0
// this.getExaminationStudentInfoFn()
// },
confirmMark: (kfdm) => { confirmMark: (kfdm) => {
this.sczbkf = kfdm this.sczbkf = kfdm
} }
@ -855,12 +847,11 @@ struct UserInfo {
} }
// loading // loading
// if(this.isLoadingPopupVisible){ if(this.isLoadingPopupVisible){
// LoadingPopup({ LoadingPopup({
// title: this.loadingText, title: this.loadingText,
// }) })
// } }
} }
.height('100%') .height('100%')
.width('100%') .width('100%')