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

View File

@ -38,7 +38,6 @@ struct UserInfo {
@State dataList: Array<User> = []
@State list: Array<User> = []
@State param: VideoConfig = {
videoNum:'1',
spls: '',
faceFlag: false,
pztd: '2',
@ -59,9 +58,7 @@ 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;
@ -73,6 +70,7 @@ 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;
@ -82,13 +80,8 @@ 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
@ -135,39 +128,25 @@ struct UserInfo {
} else {
// this.getExaminationStudentInfoFn()
}
this.initSysset()
initJudgeUdp()
}
changeQkfn() {
this.qkFn()
}
//初始化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: ''
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
}
globalThis.statue=2
this.numCount=0
this.callBackFlag=false
globalThis.udpClient2.sendMsg(param, this.context)
}
async heartMsg(context) {
@ -232,7 +211,7 @@ struct UserInfo {
this.sfbdinterfaceFn()
}
}
//读卡器阅读
onReadCard(ret) {
console.info(`zzctest xx Read Card ret =${ret.status}`)
let thisVar = globalThis.indexComponent;
@ -440,11 +419,6 @@ 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);
@ -460,7 +434,24 @@ 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) {
@ -497,148 +488,11 @@ 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)
@ -883,12 +737,23 @@ struct UserInfo {
})
}
}
if (this.showFaceCompare) {
FaceCompare({ sfzh: this.currentUser.sfzmhm, firstImage:this.currentUser.kszp,faceCompareSucess: $faceCompareSucess,getqkFlag:$getqkFlag,faceCatchImg:$faceCatchImg,lsh:globalThis.lsh })
FaceCompare({
showFaceCompare: $showFaceCompare,
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)
@ -897,6 +762,7 @@ struct UserInfo {
.onClick(() => {
this.qkFlag = false
})
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(' 确 定 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
}
@ -906,14 +772,13 @@ 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%')