This commit is contained in:
wangzhongjie 2024-02-23 10:06:19 +08:00
commit 38d48e778b

View File

@ -38,6 +38,7 @@ struct UserInfo {
@State dataList: Array<User> = []
@State list: Array<User> = []
@State param: VideoConfig = {
videoNum:'1',
spls: '',
faceFlag: false,
pztd: '2',
@ -58,7 +59,9 @@ struct UserInfo {
}
private AccountTable = new AccountTable(() => {
}, USER);
private context = getContext(this) as common.UIAbilityContext;
@State name: string = 'initName';
@State sex: string = '';
@State callBackFlag:boolean=false;
@ -70,7 +73,6 @@ struct UserInfo {
@State effectDate: string = '';
@State interval: any = null;
@State interval2: any = null;
@State interval3: any = null;
@State studentRefreshStatue: string = '0';
@State photo: string = 'data:image/bmp;base64,';
@State numCount: number = 0;
@ -80,8 +82,13 @@ struct UserInfo {
@State faceCatchImg:string=''
onPageShow() {
//打开读卡器
this.openChuankouDeviceFn()
//语音功能
this.stepFlag=false
this.initData()
this.initSysset()
initJudgeUdp()
new WebRTCVoice(this.context);
this.faceCompareSucess = 0
this.showFaceCompare = false
@ -128,25 +135,39 @@ struct UserInfo {
}else{
// this.getExaminationStudentInfoFn()
}
this.initSysset()
initJudgeUdp()
}
changeQkfn() {
this.qkFn()
}
getqkFn() {
let tmpList = [];
tmpList.push(this.string2Bytes(globalThis.signNum, 1 * 8)[0])
const param = {
id: 41,
list: tmpList,
carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId
//初始化reset data
initData(){
this.lsh='0000000000000'
this.faceCompareSucess=0
this.showFaceCompare=false
globalThis.lsh = this.lsh
this.currentUser= {
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
globalThis.udpClient2.sendMsg(param, this.context)
globalThis.statue=2
this.numCount=0
this.callBackFlag=false
}
async heartMsg(context) {
@ -211,7 +232,7 @@ struct UserInfo {
this.sfbdinterfaceFn()
}
}
//读卡器阅读
onReadCard(ret) {
console.info(`zzctest xx Read Card ret =${ret.status}`)
let thisVar = globalThis.indexComponent;
@ -419,6 +440,11 @@ struct UserInfo {
const zeroStr = '0'.repeat(num);
return zeroStr + str;
}
//考点端查询缺考指令内容消息请求
getqkFn(){
let tmpList = [];
tmpList.push(string2Bytes(globalThis.signNum, 1 * 8)[0])
const param= {id: 41,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId}
string2Bytes(number, len) {
const str = (+number).toString(2);
@ -434,24 +460,7 @@ struct UserInfo {
});
return arrBytes;
}
getPhotosForOtherFn(data, type) {
const date = new Date()
const param = {
time: dateFormat(date),
ksrq: dateFormat(date).split(' ')[0],
sfzmhm: data.sfzmhm,
zptype: type
}
getPhotosForOther(param).then(res => {
if (type == '1') {
this.currentUser.kszp = 'data:image/jpg;base64,' + res.getBmzpRsp.body.kszp
} else {
this.currentUser.ksmjzp = 'data:image/jpg;base64,' + res.getBmzpRsp.body.ksmjzp
}
})
}
//车载端学员缺考
qkFn() {
this.faceCompareSucess = 0
if (globalThis.singlePlay) {
@ -488,11 +497,148 @@ struct UserInfo {
})
}
async heartMsg(context) {
let tmpList=[]
const str =globalThis.lsh
for (let i = 0;i < str.length; i++) {
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
}
outClick() {
testNapi.StopReadCard();
}
facePass(){
if(!this.stepFlag){
this.sfbdinterfaceFn()
}
}
changefaceCompareSucess() {
if(this.faceCompareSucess>0){
this.sfbdinterfaceFn()
}
}
nextClick() {
if (this.list.length <= 4||this.pageIndex==Math.floor(this.list.length/4)) {
return
}
this.pageIndex++;
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
}
prevClick() {
if (this.list.length <= 4||this.pageIndex==0) {
return
}
this.pageIndex--;
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
}
//获取下载学员接口
getExaminationStudentInfoFn() {
if(globalThis.singlePlay){
return
}
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></body></getExaminationStudentInfoReq>`
getExaminationStudentInfo(param).then(res => {
if (!res) {
this.dataList=[]
this.currentUser={
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
console.log('currentUser',JSON.stringify(this.currentUser))
this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage)
return
}
let dataList = []
this.list=[]
for (let key in res.getExaminationStudentInfoRsp.body) {
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))
if (dataList.length > 4) {
dataList = dataList.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
} else {
dataList = dataList
}
dataList.forEach(listData=>{
for(let i in listData){
listData[i]= decodeURI(listData[i])
}
listData.kszp=this.photo+listData.kszp
listData.ksmjzp=this.photo+listData.ksmjzp
})
this.dataList = dataList
if(this.dataList.length){
this.currentUser = this.dataList[0]
}else{
this.currentUser={
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
}
this.lsh=this.currentUser.lsh
globalThis.lsh=this.lsh
globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm
console.log('this.currentUse3' + JSON.stringify(this.currentUser))
this.pageIndex = 0
}).catch((error) => {
console.log('error12error' + error)
})
}
//身份比对
async sfbdinterfaceFn(){
this.stepFlag=true
console.info('surenjun',this.currentUser.lsh)
@ -737,23 +883,12 @@ struct UserInfo {
})
}
}
if(this.showFaceCompare) {
FaceCompare({
showFaceCompare: $showFaceCompare,
sfzh: this.currentUser.sfzmhm,
firstImage: this.currentUser.kszp,
faceCompareSucess: $faceCompareSucess,
getqkFlag: $getqkFlag,
faceCatchImg: $faceCatchImg,
lsh: globalThis.lsh
})
FaceCompare({ sfzh: this.currentUser.sfzmhm, firstImage:this.currentUser.kszp,faceCompareSucess: $faceCompareSucess,getqkFlag:$getqkFlag,faceCatchImg:$faceCatchImg,lsh:globalThis.lsh })
}
if(this.qkFlag){
Column(){
Text('确认考生:' + this.currentUser.xm + '是否缺考')
.fontSize(28 * this.ratio)
.position({ x: 160 * this.ratio, y: 122 * this.ratio })
Text('确认考生:'+this.currentUser.xm+'是否缺考').fontSize(28*this.ratio).position({x:160*this.ratio,y:122*this.ratio})
Row(){
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(' 取 消 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
@ -762,7 +897,6 @@ struct UserInfo {
.onClick(() => {
this.qkFlag = false
})
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(' 确 定 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
}
@ -772,13 +906,14 @@ struct UserInfo {
})
}.position({y:265*this.ratio,x:115*this.ratio})
}
.width(660 * this.ratio)
}.width(660 * this.ratio)
.height(360 * this.ratio)
.position({ x: 150 * this.ratio, y: 98 * this.ratio })
.backgroundColor('#E6E3DF')
.borderRadius(19 * this.ratio)
}
}
.height('100%')
.width('100%')