下载考生重连
This commit is contained in:
		
							parent
							
								
									6f76677c3e
								
							
						
					
					
						commit
						af31e5436e
					
				| @ -96,7 +96,7 @@ export default async function tempRequest<T>(req: any): Promise<T> { | ||||
|         }).catch(Error => { | ||||
|         console.info('test-error0' + url + ' error:resp: ' + JSON.stringify(Error.message)) | ||||
|         Prompt.showToast({ | ||||
|           message: Error?.message, | ||||
|           message: Error?.message=='Failure when receiving data from the peer'?'网络异常,请重试':Error?.message, | ||||
|           duration: 5000 | ||||
|         }); | ||||
|         reject(Error) | ||||
| @ -111,7 +111,7 @@ export default async function tempRequest<T>(req: any): Promise<T> { | ||||
|         }) | ||||
|       } | ||||
|       Prompt.showToast({ | ||||
|         message: e?.message, | ||||
|         message: e?.message=='Failure when receiving data from the peer'?'网络异常,请重试':e?.message, | ||||
|         duration: 5000 | ||||
|       }); | ||||
|       reject({ | ||||
|  | ||||
| @ -2,8 +2,6 @@ import { examinationStuAbsent, getExaminationItem, getExaminationStudentInfo } f | ||||
| import router from '@ohos.router'; | ||||
| import TopLogo from './compontents/TopLogo'; | ||||
| import Md5 from '../common/utils/md5'; | ||||
| import AccountTable from '../common/database/tables/AccountTable'; | ||||
| import USER from '../common/constants/USER'; | ||||
| import { dateFormat, getCurrentHourTime, getCurrentTime, string2Bytes } from '../common/utils/tools'; | ||||
| import FaceCompare from './compontents/FaceCompare'; | ||||
| // import { initJudgeUdp } from '../common/utils/UdpJudge' | ||||
| @ -67,6 +65,7 @@ struct UserInfo { | ||||
|   //是否已经开始考试 | ||||
|   @State isExamStart: boolean = false; | ||||
|   @State effectDate: string = ''; | ||||
|   @State errorNum: number = 0; | ||||
|   @State interval: any = null; | ||||
|   @State studentRefreshStatue: string = '0'; | ||||
|   @State photo: string = 'data:image/bmp;base64,'; | ||||
| @ -167,8 +166,6 @@ struct UserInfo { | ||||
|   ) | ||||
|   private filePhoto: FilePhoto | ||||
|   private avPlayer | ||||
|   private AccountTable = new AccountTable(() => { | ||||
|   }, USER); | ||||
|   private context = getContext(this) as common.UIAbilityContext; | ||||
|   private labelBlocks = [ | ||||
|     { label: '考生姓名', key: 'xm' }, | ||||
| @ -588,14 +585,7 @@ struct UserInfo { | ||||
|         // this.getExaminationItemFn() | ||||
|       } | ||||
|     }) | ||||
|     // const db = new AccountTable(() => { | ||||
|     // }, MA_SYSSET); | ||||
|     // db.getRdbStore(() => { | ||||
|     //   db.query('0', (syssetParams) => { | ||||
|     // | ||||
|     // | ||||
|     //   }) | ||||
|     // }) | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   //人脸比对窗口关闭 | ||||
| @ -644,149 +634,129 @@ struct UserInfo { | ||||
|     // await upDateTableByArray('USERLIST', []) | ||||
|     // await DB.clearTable('USER') | ||||
|     // await DB.clearTable('USERLIST') | ||||
|     this.type = '2' | ||||
|     this.errorDialog.open() | ||||
| 
 | ||||
|     // this.type = '2' | ||||
|     // this.errorDialog.open() | ||||
|     this.updateTimeLimit = true | ||||
|     const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + | ||||
|     globalThis.carInfo.examinationRoomId + | ||||
|     globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName><sfzmhm></sfzmhm></body></getExaminationStudentInfoReq>` | ||||
|     try { | ||||
|       getExaminationStudentInfo(param).then(async (res) => { | ||||
|         console.log("temp log ", JSON.stringify(res)) | ||||
|         await DB.clearTable('USER') | ||||
|         await DB.clearTable('USERLIST') | ||||
|         this.errorDialog.close() | ||||
|         setTimeout(() => { | ||||
|           this.updateTimeLimit = false | ||||
|         }, 3000) | ||||
|         // @ts-ignore | ||||
|         if (!res || res?.getExaminationStudentInfoRsp?.head?.resultCode == '1') { | ||||
|           this.dataList = [] | ||||
|           this.list = [] | ||||
|           return | ||||
|         } | ||||
|         let dataList = [] | ||||
|         this.list = [] | ||||
| 
 | ||||
|         // @ts-ignore | ||||
|         for (let key in res.getExaminationStudentInfoRsp.body) { | ||||
|           // @ts-ignore | ||||
|           const a = res.getExaminationStudentInfoRsp.body[key] | ||||
|           if (a instanceof Array) { | ||||
|             dataList = a | ||||
|           } else { | ||||
|             dataList = [a] | ||||
|           } | ||||
|         } | ||||
|         if (dataList.length) { | ||||
|           this.numCount = 0 | ||||
|         } | ||||
| 
 | ||||
|         this.list = JSON.parse(JSON.stringify(dataList)) | ||||
| 
 | ||||
|         console.log("temp list", JSON.stringify(this.list)) | ||||
|         this.list.forEach((listData, index) => { | ||||
|           //考过一次不允许切换学员 | ||||
|           if (listData.kssycs == '1') { | ||||
| 
 | ||||
|             this.startExam = true | ||||
|           } | ||||
|           listData.id = index.toString() | ||||
|           for (let i in listData) { | ||||
|             listData[i] = decodeURI(listData[i]) | ||||
|           } | ||||
|           if (this.systemParam.Param828Str == '1' || this.systemParam.Param828Str == '2') { | ||||
|             // listData.ksy2=listData.ksy1; | ||||
|             listData.ksy2 = globalThis.kgxm | ||||
|           } else { | ||||
|             // listData.ksy2=listData.ksy2; | ||||
|             listData.ksy2 = globalThis.kgxm | ||||
|           } | ||||
|           listData.kszp = this.photo + listData.kszp | ||||
|           listData.ksmjzp = this.photo + listData.ksmjzp | ||||
|         }) | ||||
| 
 | ||||
|         // await upDateTableByArray('USERLIST', this.list || []) | ||||
|         console.log("temp list", JSON.stringify(this.list)) | ||||
| 
 | ||||
|         await sqlInsertCommonFn("USERLIST", this.list || []) | ||||
|         dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list; | ||||
| 
 | ||||
|         this.dataList = dataList | ||||
|         console.log("temp list", JSON.stringify(this.dataList)) | ||||
| 
 | ||||
|         const user = this.dataList.filter(res => { | ||||
|           return res.kssycs == '1' | ||||
|         }) | ||||
|         if (this.dataList.length) { | ||||
|           if (user.length) { | ||||
|             setTimeout(() => { | ||||
|               this.currentUser = user[0] | ||||
|               this.currentUser.ksy2 = globalThis.kgxm | ||||
|               globalThis.lsh = this.currentUser.lsh | ||||
|               globalThis.ksyh = this.currentUser.ksy1sfzmhm | ||||
|             }, 200) | ||||
|           } else { | ||||
|             setTimeout(() => { | ||||
|               this.currentUser = this.dataList[0] | ||||
|               this.currentUser.ksy2 = globalThis.kgxm | ||||
|               globalThis.ksyh = this.currentUser.ksy1sfzmhm | ||||
|               globalThis.lsh = this.currentUser.lsh | ||||
|             }, 200) | ||||
|           } | ||||
|         } else { | ||||
|           this.currentUser = EmptyCandidateObject | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         // const flag=dataList.filter((res)=>{ | ||||
|         //    return res.sfzmhm==this.currentUser.sfzmhm | ||||
|         // }).length?true:false | ||||
|         // if(!this.currentUser.sfzmhm||this.currentUser.kssycs=='0'||!flag){ | ||||
|         //   if (this.dataList.length) { | ||||
|         //     setTimeout(()=>{ | ||||
|         //       this.currentUser = this.dataList[0] | ||||
|         //       this.currentUser.ksy2= globalThis.kgxm | ||||
|         //       globalThis.lsh=this.currentUser.lsh | ||||
|         //     },200) | ||||
|         //     console.log('this.currentUser1',JSON.stringify(this.currentUser)) | ||||
|         //   } else { | ||||
|         //     this.currentUser = EmptyCandidateObject | ||||
|         //   } | ||||
|         // } | ||||
| 
 | ||||
| 
 | ||||
|         // this.lsh = this.currentUser.lsh | ||||
|         // globalThis.lsh = this.lsh | ||||
|         // globalThis.ksyh = this.currentUser.ksy1sfzmhm | ||||
| 
 | ||||
|         //364	绕车一周评判时机(1-开始考试后判 2-开始考试前判) | ||||
|         if (this.systemParam.Param364 == '2') { | ||||
|           this.isBoardPrePareSetPopupOpen = true; | ||||
|           this.isFirstBoardPrePareSetPopupBtnShow = false; | ||||
|         } | ||||
| 
 | ||||
|         //398参数为1 第二场考试上车准备不考 | ||||
|         if (this.systemParam.Param398 == '1') { | ||||
|           this.isSecondBoardPrePareSetPopupOpen = true; | ||||
|         } | ||||
| 
 | ||||
|         this.pageIndex = 0 | ||||
|         getSyncData('USER').then(data => { | ||||
|           if (data?.[0]) { | ||||
|             this.getCurrentStudent(data[0].sfzmhm) | ||||
|           } | ||||
|         }) | ||||
|       }).catch((error) => { | ||||
|         this.updateTimeLimit = false | ||||
|         this.errorDialog.close() | ||||
|         console.log('error12error' + error) | ||||
|       }) | ||||
|     } catch (error) { | ||||
|       this.updateTimeLimit = false | ||||
|     getExaminationStudentInfo(param).then(async (res) => { | ||||
|       this.errorNum=0 | ||||
|       console.log("temp log ", JSON.stringify(res)) | ||||
|       await DB.clearTable('USER') | ||||
|       await DB.clearTable('USERLIST') | ||||
|       this.errorDialog.close() | ||||
|       console.log('error14error' + error) | ||||
|     } | ||||
|       setTimeout(() => { | ||||
|         this.updateTimeLimit = false | ||||
|       }, 3000) | ||||
|       // @ts-ignore | ||||
|       if (!res || res?.getExaminationStudentInfoRsp?.head?.resultCode == '1') { | ||||
|         this.dataList = [] | ||||
|         this.list = [] | ||||
|         return | ||||
|       } | ||||
|       let dataList = [] | ||||
|       this.list = [] | ||||
| 
 | ||||
|       // @ts-ignore | ||||
|       for (let key in res.getExaminationStudentInfoRsp.body) { | ||||
|         // @ts-ignore | ||||
|         const a = res.getExaminationStudentInfoRsp.body[key] | ||||
|         if (a instanceof Array) { | ||||
|           dataList = a | ||||
|         } else { | ||||
|           dataList = [a] | ||||
|         } | ||||
|       } | ||||
|       if (dataList.length) { | ||||
|         this.numCount = 0 | ||||
|       } | ||||
| 
 | ||||
|       this.list = JSON.parse(JSON.stringify(dataList)) | ||||
| 
 | ||||
|       console.log("temp list", JSON.stringify(this.list)) | ||||
|       this.list.forEach((listData, index) => { | ||||
|         //考过一次不允许切换学员 | ||||
|         if (listData.kssycs == '1') { | ||||
| 
 | ||||
|           this.startExam = true | ||||
|         } | ||||
|         listData.id = index.toString() | ||||
|         for (let i in listData) { | ||||
|           listData[i] = decodeURI(listData[i]) | ||||
|         } | ||||
|         if (this.systemParam.Param828Str == '1' || this.systemParam.Param828Str == '2') { | ||||
|           // listData.ksy2=listData.ksy1; | ||||
|           listData.ksy2 = globalThis.kgxm | ||||
|         } else { | ||||
|           // listData.ksy2=listData.ksy2; | ||||
|           listData.ksy2 = globalThis.kgxm | ||||
|         } | ||||
|         listData.kszp = this.photo + listData.kszp | ||||
|         listData.ksmjzp = this.photo + listData.ksmjzp | ||||
|       }) | ||||
| 
 | ||||
|       // await upDateTableByArray('USERLIST', this.list || []) | ||||
|       console.log("temp list", JSON.stringify(this.list)) | ||||
| 
 | ||||
|       await sqlInsertCommonFn("USERLIST", this.list || []) | ||||
|       dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list; | ||||
| 
 | ||||
|       this.dataList = dataList | ||||
|       console.log("temp list", JSON.stringify(this.dataList)) | ||||
| 
 | ||||
|       const user = this.dataList.filter(res => { | ||||
|         return res.kssycs == '1' | ||||
|       }) | ||||
|       if (this.dataList.length) { | ||||
|         if (user.length) { | ||||
|           setTimeout(() => { | ||||
|             this.currentUser = user[0] | ||||
|             this.currentUser.ksy2 = globalThis.kgxm | ||||
|             globalThis.lsh = this.currentUser.lsh | ||||
|             globalThis.ksyh = this.currentUser.ksy1sfzmhm | ||||
|           }, 200) | ||||
|         } else { | ||||
|           setTimeout(() => { | ||||
|             this.currentUser = this.dataList[0] | ||||
|             this.currentUser.ksy2 = globalThis.kgxm | ||||
|             globalThis.ksyh = this.currentUser.ksy1sfzmhm | ||||
|             globalThis.lsh = this.currentUser.lsh | ||||
|           }, 200) | ||||
|         } | ||||
|       } else { | ||||
|         this.currentUser = EmptyCandidateObject | ||||
|       } | ||||
| 
 | ||||
| 
 | ||||
|       //364	绕车一周评判时机(1-开始考试后判 2-开始考试前判) | ||||
|       if (this.systemParam.Param364 == '2') { | ||||
|         this.isBoardPrePareSetPopupOpen = true; | ||||
|         this.isFirstBoardPrePareSetPopupBtnShow = false; | ||||
|       } | ||||
| 
 | ||||
|       //398参数为1 第二场考试上车准备不考 | ||||
|       if (this.systemParam.Param398 == '1') { | ||||
|         this.isSecondBoardPrePareSetPopupOpen = true; | ||||
|       } | ||||
| 
 | ||||
|       this.pageIndex = 0 | ||||
|       // getSyncData('USER').then(data => { | ||||
|       //   if (data?.[0]) { | ||||
|       //     this.getCurrentStudent(data[0].sfzmhm) | ||||
|       //   } | ||||
|       // }) | ||||
|     }).catch((error) => { | ||||
|       this.updateTimeLimit = false | ||||
|       // this.errorDialog.close() | ||||
|       this.errorNum++ | ||||
|       if (this.errorNum < 2) { | ||||
|         this.getExaminationStudentInfoFn() | ||||
|       } | ||||
|       console.log('error12error' + error) | ||||
|     }) | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   qkFn() { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user