1305 lines
41 KiB
Plaintext
Raw Normal View History

2024-01-05 11:11:15 +08:00
import { getExaminationItem, getExaminationStudentInfo, examinationStuAbsent,getPhotosForOther } from '../api/userInfo'
2024-01-31 14:42:14 +08:00
import { voiceService } from '../common/service/voiceService'
2024-01-05 11:11:15 +08:00
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';
2024-01-31 14:35:16 +08:00
import { dateFormat,getCurrentTime } from '../common/utils/tools';
2024-01-05 11:11:15 +08:00
import MA_SYSSET from '../common//constants/MA_SYSSET';
import FaceCompare from './compontents/faceCompareByhaikang'
2024-01-31 14:42:14 +08:00
import ethernet from '@ohos.net.ethernet';
2024-01-05 11:11:15 +08:00
import prompt from '@ohos.prompt'
2024-01-31 14:35:16 +08:00
import {initJudgeUdp} from '../common/utils/UdpJudge'
2024-01-31 14:42:14 +08:00
// import testNapi from "@ohos.idcard";
import CommonEvent from '@ohos.commonEventManager';
2024-01-05 11:11:15 +08:00
// @ts-ignore
import {writeObjectOut} from '../api/judge'
import testNapi from "@ohos.idcard";
2024-01-31 14:42:14 +08:00
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import fs from '@ohos.file.fs'
2024-01-05 11:11:15 +08:00
import FileUtil from '../common/utils/File'
import common from '@ohos.app.ability.common';
2024-01-31 14:42:14 +08:00
import onvifclient from '@ohos.onvifclient';
import util from '@ohos.util';
2024-01-05 11:11:15 +08:00
import { VideoConfig } from './interfaces'
2024-01-31 14:35:16 +08:00
import WebRTCVoice from './webRTC/'
2024-01-05 11:11:15 +08:00
@Entry
@Component
struct Index {
@State pageIndex: number = 0
@State ratio: number = 850 / 960
@State index: number = 0
2024-01-31 14:35:16 +08:00
@State stepFlag: boolean = false;
2024-01-05 11:11:15 +08:00
@State errorMsg: string = ''
@State ksxtbh: string = ''
@State pic: string = ''
@State jkxlh: string = ''
@State @Watch('changefaceCompareSucess') faceCompareSucess: number = 0;
2024-01-31 14:35:16 +08:00
@State @Watch('changeQkfn') getqkFlag: boolean = false;
2024-01-05 11:11:15 +08:00
@State @Watch('outClick') outFlag: boolean = false;
@State showFaceCompare: boolean = false;
@State url: string = ''
@State lsh: string = ''
@State qkFlag: boolean = false
private vocObj = null;
@State currentUser: any = {
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
@State dataList: Array<any> = []
@State list: Array<any> = []
@State param: VideoConfig = {
spls: '',
faceFlag: false,
pztd: '2',
ljlx: '',
ip: '192.168.7.112',
port: '554',
userName: 'admin',
pwd: '12345qwe',
td1: '1',
td2: '2',
td3: '3',
td4: '4',
videoRecord1: false,
videoRecord2: false,
videoRecord3: false,
videoRecord4: false,
rlls:'1'
}
private AccountTable = new AccountTable(() => {
}, USER);
private context = getContext(this) as common.UIAbilityContext;
@State name: string = 'initName';
@State sex: string = '';
@State callBackFlag:boolean=false;
@State born?: string = '';
@State address: string = '';
@State nation: string = '';
@State idCard: string = '';
@State grantDept: string = '';
@State effectDate: string = '';
@State interval: any = null;
2024-01-31 14:35:16 +08:00
@State interval2: any = null;
2024-01-31 14:42:14 +08:00
@State interval3: any = null;
2024-01-31 14:35:16 +08:00
@State studentRefreshStatue: string = '0';
2024-01-05 11:11:15 +08:00
@State photo: string = 'data:image/bmp;base64,';
2024-01-31 14:35:16 +08:00
@State numCount: number = 0;
@State signNum: number = 0;
// @State examItems: string = '';
2024-01-05 11:11:15 +08:00
@State isCanClick: boolean = true;
subscriber;
@State faceCatchImg:string=''
private fileUtil: FileUtil
// that.sfzmhm = 'surenjun';
onPageShow() {
2024-01-31 14:35:16 +08:00
//语音功能
console.log('kkkkkk')
this.stepFlag=false
new WebRTCVoice(this.context);
2024-01-05 11:11:15 +08:00
this.faceCompareSucess=0
2024-01-31 14:35:16 +08:00
this.showFaceCompare=false
2024-01-05 11:11:15 +08:00
globalThis.indexComponent = this;
this.lsh='0000000000000'
this.callBackFlag=false
2024-01-31 14:35:16 +08:00
globalThis.lsh = this.lsh
2024-01-05 11:11:15 +08:00
this.currentUser= {
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
globalThis.statue=2
2024-01-31 14:35:16 +08:00
this.numCount=0
2024-01-05 11:11:15 +08:00
const fileUtil = new FileUtil(this.context)
this.fileUtil = fileUtil
2024-01-31 14:42:14 +08:00
2024-01-05 11:11:15 +08:00
globalThis.udpClient2&&globalThis.udpClient2.onMessage((val)=>{
2024-01-31 14:35:16 +08:00
console.log('valvaltotol2',val.id,val.body,val.length)
2024-01-05 11:11:15 +08:00
if(val.id=='32'){
2024-01-31 14:35:16 +08:00
globalThis.signNum=val.body[1]
console.log('qkqkqkqval.body1',val.id,val.body,val.length)
if(val.body[0]=='7'){
this.getqkFn()
this.signNum=val.body[1]
2024-01-05 11:11:15 +08:00
}
2024-01-31 14:35:16 +08:00
}else if(val.id=='48'){
2024-01-31 14:42:14 +08:00
console.log('valvalkkkk',val.body)
// if(val.body[13]=='1'){
// this.faceCompareSucess=1
// console.log('ttt111')
// // clearInterval(this.interval)
// this.facePass()
// }
2024-01-31 14:35:16 +08:00
}else if(val.id=='42'){
2024-01-31 14:42:14 +08:00
console.log('qkfnqkfn',val.body[0])
2024-01-31 14:35:16 +08:00
this.qkFn()
2024-01-31 14:42:14 +08:00
// this.getExaminationStudentInfoFn()
// const arr = [globalThis.signNum,1];
// let tmpList = [];
// tmpList.push(this.string2Bytes(arr[0], 1 * 8)[0])
// tmpList.push(this.string2Bytes(arr[1], 1 * 8)[0])
//
// const param= {id: 41,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId}
//
// globalThis.udpClient2.sendMsg(param, this.context)
2024-01-05 11:11:15 +08:00
}
})
// 应用启动时打开读卡设备
let ret = testNapi.OpenDevice();
console.log("zzctest Open Device ret = " + ret);
if (ret == 0) {
testNapi.StartReadCard(this.onReadCard);
} else {
console.error("zzctest Failed to Open Device");
}
2024-01-31 14:42:14 +08:00
// this.vocObj = new voiceService(async (status,val) => {
// if (status == 'idle') {
// if(val==='ksks.WAV'){
// router.pushUrl({
// url: 'pages/Judge',
// params:{examItems:this.examItems}
// }, router.RouterMode.Single);
// globalThis.statue=4
// this.vocObj&&this.vocObj.releasePlayer()
// }
// }
// });
2024-01-05 11:11:15 +08:00
if(globalThis.singlePlay){
this.list=[
{
sfzmhm: '342323199501470011',
xm: '测试学员1',
lsh: '0000000000001',
ksy1: '考试员1',
id: '001',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '341182199308155624',
xm: '测试学员2',
lsh: '0000000000002',
ksy1: '考试员2',
id: '002',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '3423231995014700003',
xm: '测试学员3',
lsh: '0000000000003',
ksy1: '考试员2',
id: '002',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '3423231995014700004',
xm: '测试学员4',
lsh: '0000000000004',
ksy1: '考试员2',
id: '002',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '3423231995014700005',
xm: '测试学员5',
lsh: '0000000000004',
ksy1: '考试员2',
id: '002',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '342323199501470016',
xm: '测试学员6',
lsh: '0000000000005',
ksy1: '考试员1',
id: '001',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '3423231995014700007',
xm: '测试学员7',
lsh: '0000000000007',
ksy1: '考试员2',
id: '002',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '3423231995014700008',
xm: '测试学员8',
lsh: '0000000000008',
ksy1: '考试员2',
id: '002',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '3423231995014700009',
xm: '测试学员9',
lsh: '0000000000009',
ksy1: '考试员2',
id: '002',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
},{
sfzmhm: '34232319950147000010',
xm: '测试学员10',
lsh: '002',
ksy1: '考试员2',
id: '0000000000010',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}]
this.pageIndex=0
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
this.currentUser=this.dataList[0]
this.lsh=this.currentUser.lsh
2024-01-31 14:35:16 +08:00
globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm
2024-01-05 11:11:15 +08:00
globalThis.lsh=this.lsh
return
}else{
this.getExaminationStudentInfoFn()
}
this.initSysset()
2024-01-31 14:35:16 +08:00
initJudgeUdp()
}
changeQkfn(){
console.log('userqk')
this.qkFn()
}
getqkFn(){
let tmpList = [];
2024-01-31 14:42:14 +08:00
tmpList.push(this.string2Bytes(globalThis.signNum, 1 * 8)[0])
2024-01-31 14:35:16 +08:00
const param= {id: 41,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId}
globalThis.udpClient2.sendMsg(param, this.context)
2024-01-05 11:11:15 +08:00
}
async heartMsg(context) {
let tmpList=[]
const str =globalThis.lsh
for (let i = 0;i < str.length; i++) {
2024-01-31 14:42:14 +08:00
tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
2024-01-05 11:11:15 +08:00
}
const param = { id: 46, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId,callback:()=>{
console.log('46send')
this.callBackFlag=true
}}
this.interval=setInterval(()=>{
if(this.callBackFlag){
2024-01-31 14:42:14 +08:00
console.log('validqqq333')
2024-01-05 11:11:15 +08:00
const param2 = { id: 47, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId }
globalThis.udpClient2&&globalThis.udpClient2.sendMsg(param2,this.context)
}
},1000)
2024-01-31 14:42:14 +08:00
// const param = { id: 31, list: tmpList, carNo: 489, placeId: 62 }
2024-01-05 11:11:15 +08:00
globalThis.udpClient2&&globalThis.udpClient2.sendMsg(param, this.context)
2024-01-31 14:42:14 +08:00
// return {id: 31,list:tmpList,carNo:489,placeId:62}
2024-01-05 11:11:15 +08:00
}
aboutToDisappear() {
clearInterval(this.interval)
2024-01-31 14:35:16 +08:00
clearInterval(this.interval2)
2024-01-05 11:11:15 +08:00
testNapi.StopReadCard();
2024-01-31 14:42:14 +08:00
// console.log("zzctest Close Device ret = " + testNapi.CloseDevice());
}
changeStudentStatue(val){
const arr = [globalThis.signNum||0, val]
let tmpList = [];
tmpList.push(this.string2Bytes(arr[0], 1 * 8)[0])
tmpList.push(this.string2Bytes(arr[1], 1 * 8)[0])
const str = globalThis.lsh
for (let i = 0;i < str.length; i++) {
tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
}
// const str ='1111160366580'
// for (let i = 0;i < str.length; i++) {
// tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
// }
// const param = { id: 46, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId,callback:()=>{
// const param = { id: 46, list: tmpList, carNo: 489, placeId: 62 }
const param= {id: 31,list:tmpList,carNo:globalThis.carInfo.carNo,placeId:globalThis.carInfo.examinationRoomId}
globalThis.udpClient2&&globalThis.udpClient2.sendMsg(param, this.context)
2024-01-05 11:11:15 +08:00
}
2024-01-31 14:35:16 +08:00
facePass(){
if(!this.stepFlag){
this.sfbdinterfaceFn()
2024-01-05 11:11:15 +08:00
}
}
onReadCard(ret) {
console.info(`zzctest xx Read Card ret =${ret.status}`)
let thisVar = globalThis.indexComponent;
if(ret.status == 0) { // status = 1 为读到身份证信息; status = 1 为身份证离开读卡器
// 收到身份证离开读卡器的事件通知,根据实际业务需要决定是否需要清空之前已读取的身份证信息。
// 如果身份证卡片离开读卡器时需要继续保留UI界面上已读取到的身份信息以下代码可以注释掉。
thisVar.name = "";
thisVar.sex = "";
thisVar.nation = "";
thisVar.born = "";
thisVar.address = "";
thisVar.idCard = "";
thisVar.photo = "";
return true;
}
if (ret.baseInfo.length > 2) {
// 收到身份证信息,填充页面
console.info(`zzctest Read Card 1`);
let subIndex = ret.baseInfo.indexOf(":")
let baseInfo: string = ret.baseInfo.substring(subIndex + 1, ret.baseInfo.length - 1);
console.info(`zzctest Read Card 2 baseInfo=${baseInfo}`);
let baseInfos: string[] = baseInfo.split("|");
thisVar.name = baseInfos[0];
thisVar.sex = baseInfos[1];
thisVar.nation = baseInfos[2];
thisVar.born = baseInfos[3];
thisVar.address = baseInfos[4];
thisVar.idCard = baseInfos[5];
setTimeout(()=>{
thisVar.getCurrentStudent(baseInfos[5])
},1000)
}
// 身份证照片数据处理
if (ret.photo instanceof ArrayBuffer) {
let dataView = new DataView(ret.photo)
console.info(`Read Card ret = length = ${dataView.byteLength}`)
let str = ""
for (let i = 0;i < dataView.byteLength; ++i) {
let c = String.fromCharCode(dataView.getUint8(i))
if (c !== "\n") {
str += c
}
}
thisVar.photo += str;
}
console.info(`zzctest Read Card end`);
return true;
}
async initSysset(){
const that = this;
const db = new AccountTable(()=>{},MA_SYSSET);
db.getRdbStore(()=>{
db.query('0', (syssetParams) => {
//TODO 监管接口序列号 目前环境没有
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901')
that.jkxlh = serialNumberArr?.[0]?.v_value || '1234567'
const ksxtbhArr = syssetParams.filter(sys => sys.v_no === '902')
that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222'
2024-01-31 14:35:16 +08:00
const studentRefreshParam=syssetParams.filter(sys => sys.v_no === '452')
that.studentRefreshStatue=studentRefreshParam?.[0]?.v_value || '0'
console.log('studentRefreshStatue',studentRefreshParam)
if(that.studentRefreshStatue=='2'){
clearInterval(that.interval2)
that.interval2=setInterval(()=>{
if(that.dataList.length==0&&that.numCount<3){
that.numCount++
console.log('2222211111')
that.getExaminationStudentInfoFn()
}
},5000)
}else if(that.studentRefreshStatue=='1'){
clearInterval(that.interval2)
that.interval2=setInterval(()=>{
if(that.dataList.length==0){
that.getExaminationStudentInfoFn()
}
},5000)
}
2024-01-05 11:11:15 +08:00
})
})
}
2024-01-31 14:42:14 +08:00
// async getVideoConfig(){
// const data = await this.fileUtil.readFile('/mnt/hmdfs/100/account/device_view/localfiles/files/logs/config/config3.txt');
// this.param=JSON.parse(data)
// }
2024-01-05 11:11:15 +08:00
changefaceCompareSucess() {
2024-01-31 14:42:14 +08:00
// globalThis.statue=3
console.log('this.faceCompareSuces',this.faceCompareSucess,JSON.stringify(this.currentUser))
// if(this.faceCompareSucess!=1){
// this.heartMsg(this.context)
// return
// }else{
// console.log('kkkk2')
// this.sfbdinterfaceFn()
//
// }
2024-01-31 14:35:16 +08:00
if(this.faceCompareSucess>0){
2024-01-05 11:11:15 +08:00
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)
}
getCurrentStudent(id){
let flag=false
this.pageIndex
this.list.map((res,index)=>{
if(res.sfzmhm==id){
flag=true
this.currentUser=res
this.lsh=this.currentUser.lsh
globalThis.lsh=this.currentUser.lsh
2024-01-31 14:35:16 +08:00
globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm
2024-01-31 14:42:14 +08:00
// this.currentUser.kszp=this.photo+res.kszp
// this.currentUser.ksmjzp=this.photo+this.currentUser.ksmjzp
2024-01-05 11:11:15 +08:00
if(globalThis.singlePlay){
testNapi.StopReadCard();
2024-01-31 14:42:14 +08:00
// globalThis.statue=4
2024-01-05 11:11:15 +08:00
router.pushUrl({
url: 'pages/Judge',
},router.RouterMode.Single);
return
}
this.showFaceCompare=true
this.pageIndex=Math.floor(index/4)
}
})
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
if(!flag){
prompt.showToast({
message: '未匹配到对应下载学员',
duration: 3000
});
}
}
getExaminationStudentInfoFn() {
if(globalThis.singlePlay){
return
}
2024-01-31 14:35:16 +08:00
console.log('tttttttttt')
2024-01-05 11:11:15 +08:00
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 => {
2024-01-31 14:35:16 +08:00
console.log('mmmmmmmmmmmm',JSON.stringify(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))
2024-01-05 11:11:15 +08:00
this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage)
return
}
let dataList = []
2024-01-31 14:35:16 +08:00
this.list=[]
2024-01-05 11:11:15 +08:00
for (let key in res.getExaminationStudentInfoRsp.body) {
const a = res.getExaminationStudentInfoRsp.body[key]
if(a instanceof Array){
dataList=a
}else{
dataList=[a]
}
}
2024-01-31 14:35:16 +08:00
if(dataList.length){
this.numCount=0
}
2024-01-05 11:11:15 +08:00
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
2024-01-31 14:35:16 +08:00
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: ''
}
}
2024-01-05 11:11:15 +08:00
this.lsh=this.currentUser.lsh
globalThis.lsh=this.lsh
2024-01-31 14:35:16 +08:00
globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm
2024-01-31 14:42:14 +08:00
// this.currentUser.kszp=this.photo+this.currentUser.kszp
// this.currentUser.ksmjzp=this.photo+this.currentUser.ksmjzp
// this.currentUser.kszp='data:image/jpg;base64,'+this.currentUser.kszp
// this.currentUser.ksmjzp='data:image/jpg;base64,'+this.currentUser.ksmjzp
// this.getPhotosForOtherFn(this.currentUser,1)
// this.getPhotosForOtherFn(this.currentUser,2)
// for (let i in this.currentUser) {
// this.currentUser[i] = decodeURI(this.currentUser[i])
// }
console.log('this.currentUse3' + JSON.stringify(this.currentUser))
2024-01-05 11:11:15 +08:00
this.pageIndex = 0
}).catch((error) => {
console.log('error12error' + error)
})
}
2024-01-31 14:42:14 +08:00
fillZero(str, len) {
str = str + '';
if (str.length > len || !len) {
return str
}
let num = len - str.length;
let zeroStr = '';
for (var i = 0; i < num; i++) {
zeroStr = zeroStr + '0'
}
return zeroStr + str;
}
string2Bytes(number, len) {
// console.log('string2Bytes == ', number)
let str = (+number).toString(2);
if(str.length > len) {
console.log('数据长度不对~~');
return
}
var byteString = this.fillZero(str, len);
var arrBytes = new Array();
for (var i = byteString.length; i > 0;) {
let j = i - 8;
if (j < 0) {
j = 0
}
var s = byteString.slice(j, i);
var v = parseInt(s, 2);
arrBytes.push(v);
i = i - 8
}
return arrBytes;
}
2024-01-05 11:11:15 +08:00
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() {
2024-01-31 14:35:16 +08:00
this.faceCompareSucess=0
2024-01-05 11:11:15 +08:00
if(globalThis.singlePlay){
this.qkFlag=false
return
}
2024-01-31 14:35:16 +08:00
// const param = { id: 46, list: tmpList, carNo: 489, placeId: 62 }
console.log('JsonJson',JSON.stringify(this.currentUser))
const param = `<?xml version="1.0" encoding="UTF-8" ?><examinationStuAbsentReq><body><carId>${globalThis.carInfo.carId}</carId><cardNo>${this.currentUser.sfzmhm}</cardNo><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName><lsh>${this.lsh}</lsh></body></examinationStuAbsentReq>`
console.log('carNo1111',param)
2024-01-05 11:11:15 +08:00
examinationStuAbsent(param).then(res => {
2024-01-31 14:35:16 +08:00
const arr = [this.signNum||0,1]
let tmpList = [];
2024-01-31 14:42:14 +08:00
tmpList.push(this.string2Bytes(arr[0], 1 * 8)[0])
tmpList.push(this.string2Bytes(arr[1], 1 * 8)[0])
2024-01-31 14:35:16 +08:00
2024-01-31 14:42:14 +08:00
// const str ='1111160366580'
// for (let i = 0;i < str.length; i++) {
// tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
// }
// const param = { id: 46, list: tmpList, carNo: 489, placeId: 62 }
console.log('globalThis.signNum',globalThis.signNum)
2024-01-31 14:35:16 +08:00
const param= {id: 43,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId}
globalThis.udpClient2.sendMsg(param, this.context)
2024-01-05 11:11:15 +08:00
if (res.examinationStuAbsentRsp.head.resultCode=='0') {
this.pageIndex = 0
this.qkFlag=false
2024-01-31 14:35:16 +08:00
this.currentUser={
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
2024-01-05 11:11:15 +08:00
this.getExaminationStudentInfoFn()
2024-01-31 14:42:14 +08:00
// this.errorMsg = decodeURI(res.examinationStuAbsentRsp.head.resultMessage)
2024-01-05 11:11:15 +08:00
return
}
// this.getExaminationStudentInfoFn()
}).catch((error) => {
console.log('error12error' + error)
})
}
Array2Byte(array) {
var buf = new ArrayBuffer(array.length);
var view = new Uint8Array(buf);
for (var i = 0; i != array.length; ++i)
{
view[i] = array[i] & 0xFF;
}
return view;
}
outClick(){
testNapi.StopReadCard();
2024-01-31 14:35:16 +08:00
// console.log("zzctest Close Device ret = " + testNapi.CloseDevice());
2024-01-05 11:11:15 +08:00
}
async sfbdinterfaceFn(){
2024-01-31 14:35:16 +08:00
this.stepFlag=true
console.info('surenjun',this.currentUser.lsh)
const carInfo = globalThis.carInfo;
const {carId,examinationRoomId} = carInfo;
const examItems = await getExaminationItem({
time:getCurrentTime(),
carId,
lsh:this.currentUser.lsh || '',
examinationRoomId
});
//获取已考项目
2024-01-05 11:11:15 +08:00
console.log('goroute')
const date = new Date()
2024-01-31 14:35:16 +08:00
this.showFaceCompare=false
2024-01-05 11:11:15 +08:00
const { examSubject,plateNo } = carInfo;
const drvexam = {
lsh: this.currentUser.lsh || '',
kskm: 2,
ksxtbh: this.ksxtbh || '222',
sfzmhm: this.currentUser.sfzmhm || '',
ksysfzmhm: this.currentUser.ksy1sfzmhm || '',
zp:encodeURIComponent(this.faceCatchImg ||''),
kssj: dateFormat(date) || '',
kchp:decodeURI(plateNo),
Ksy2sfzmhm: this.currentUser.Ksy2sfzmhm || ''
}
const param = {
drvexam: drvexam,
xtlb: '17',
//接口序列号
jkxlh: this.jkxlh || '1234567',
//接口标识
jkid: '17C51',
}
const code = await writeObjectOut(param);
2024-01-31 14:35:16 +08:00
// this.examItems=examItems?.getExaminationItemRsp?.body?.ykxx
console.log('codecode',code)
2024-01-05 11:11:15 +08:00
globalThis.lsh=this.currentUser.lsh
2024-01-31 14:35:16 +08:00
globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm
this.currentUser.id='1'
2024-01-05 11:11:15 +08:00
if (code) {
this.AccountTable.query('0', (result) => {
if (result.length == 0) {
this.AccountTable.insertData(this.currentUser, (id) => {
this.AccountTable.query('0', (result) => {
console.log(result)
globalThis.statue=4
2024-01-31 14:35:16 +08:00
this.stepFlag=false
// this.vocObj.playAudio({
// type: 1,
// name: 'ksks.WAV'
// })
2024-01-05 11:11:15 +08:00
router.pushUrl({
url: 'pages/Judge',
2024-01-31 14:35:16 +08:00
params:{examItems:examItems?.getExaminationItemRsp?.body?.ykxx}
2024-01-05 11:11:15 +08:00
}, router.RouterMode.Single);
testNapi.StopReadCard();
2024-01-31 14:35:16 +08:00
// console.log("zzctest Close Device ret = " + testNapi.CloseDevice());
2024-01-05 11:11:15 +08:00
})
})
} else {
this.AccountTable.updateData(this.currentUser, (id) => {
this.AccountTable.query('0', (result) => {
2024-01-31 14:35:16 +08:00
this.stepFlag=false
// this.vocObj.playAudio({
// type: 1,
// name: 'ksks.WAV'
// })
2024-01-05 11:11:15 +08:00
router.pushUrl({
url: 'pages/Judge',
2024-01-31 14:35:16 +08:00
params:{examItems:examItems?.getExaminationItemRsp?.body?.ykxx}
2024-01-05 11:11:15 +08:00
}, router.RouterMode.Single);
globalThis.statue=4
testNapi.StopReadCard();
2024-01-31 14:35:16 +08:00
// console.log("zzctest Close Device ret = " + testNapi.CloseDevice());
2024-01-05 11:11:15 +08:00
})
})
}
})
}else{
2024-01-31 14:35:16 +08:00
this.stepFlag=false
2024-01-05 11:11:15 +08:00
}
}
build() {
Column() {
TopLogo({outFlag:$outFlag}).margin({ bottom: 10 })
Row() {
Row() {
ForEach(this.dataList, (item, index) => {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Column() {
Text(item.lsh)
.fontSize(16 * this.ratio)
.lineHeight(30 * this.ratio)
.fontWeight(500)
.fontColor(item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000')
Text(decodeURIComponent(item.xm))
.fontSize(16 * this.ratio)
.lineHeight(30 * this.ratio)
.fontWeight(500)
.fontColor(item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000')
}
}
.width(165 * this.ratio)
.height(85 * this.ratio)
.backgroundImage(item.sfzmhm != this.currentUser.sfzmhm? $r('app.media.userbox2') : $r('app.media.userboxbg'))
.backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
this.currentUser = item
// this.getPhotosForOtherFn(item,1)
// this.getPhotosForOtherFn(item,2)
// this.index = index
})
})
}.width(640 * this.ratio).margin({ left: 30 * this.ratio })
Image($r('app.media.dk_prev'))
.width(90 * this.ratio)
.height(70 * this.ratio)
.margin({ left: 65 * this.ratio, right:10 * this.ratio })
.onClick(() => {
this.prevClick()
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
})
Image($r('app.media.dk_next')).width(90 * this.ratio).height(70 * this.ratio).onClick(() => {
this.nextClick()
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
})
}.margin({ top: 40 * this.ratio, bottom: 10 * this.ratio })
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() {
Column() {
2024-01-31 14:35:16 +08:00
if(this.currentUser['kszp']){
Image(this.currentUser['kszp']?this.currentUser['kszp']:'')
.width(93 * this.ratio)
.height(130.5 * this.ratio)
.margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio })
}else{
Image('')
.width(93 * this.ratio)
.height(130.5 * this.ratio)
.margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio })
}
if(this.currentUser['ksmjzp']){
Image(this.currentUser['ksmjzp']?this.currentUser['ksmjzp']:'')
.width(93 * this.ratio)
.height(130.5 * this.ratio)
.margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio })
}else{
Image('')
.width(93 * this.ratio)
.height(130.5 * this.ratio)
.margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio })
}
2024-01-05 11:11:15 +08:00
}
Column() {
Row() {
2024-01-31 14:35:16 +08:00
Text('考生姓名').fontSize(16 * this.ratio).fontColor('#99948A')
2024-01-05 11:11:15 +08:00
Row() {
Text(this.currentUser['xm']).fontColor('#fff').textAlign(TextAlign.Center).width('100%')
}
.width(280 * this.ratio)
2024-01-31 14:35:16 +08:00
.height(35 * this.ratio)
2024-01-05 11:11:15 +08:00
.backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImage($r('app.media.userbox'))
.margin({ left: 8 * this.ratio })
.align(Alignment.Center)
}.margin({ bottom: 10 * this.ratio })
Row() {
2024-01-31 14:35:16 +08:00
Text('身份证号').fontSize(16 * this.ratio).fontColor('#99948A')
2024-01-05 11:11:15 +08:00
Row() {
Text(this.currentUser['sfzmhm']).fontColor('#fff').textAlign(TextAlign.Center).width('100%')
}
.width(280 * this.ratio)
2024-01-31 14:35:16 +08:00
.height(35 * this.ratio)
2024-01-05 11:11:15 +08:00
.backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImage($r('app.media.userbox'))
.margin({ left: 8 * this.ratio })
.align(Alignment.Center)
}.margin({ bottom: 10 * this.ratio })
Row() {
2024-01-31 14:35:16 +08:00
Text(' 流 水 号 ').fontSize(16 * this.ratio).fontColor('#99948A')
2024-01-05 11:11:15 +08:00
Row() {
Text(this.currentUser['lsh']).fontColor('#fff').textAlign(TextAlign.Center).width('100%')
}
.width(280 * this.ratio)
2024-01-31 14:35:16 +08:00
.height(35 * this.ratio)
2024-01-05 11:11:15 +08:00
.backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImage($r('app.media.userbox'))
.margin({ left: 8 * this.ratio })
.align(Alignment.Center)
}.margin({ bottom: 10 * this.ratio })
Row() {
2024-01-31 14:35:16 +08:00
Text('考试路线').fontSize(16 * this.ratio).fontColor('#99948A')
2024-01-05 11:11:15 +08:00
Row() {
Text(this.currentUser['kslx']).fontColor('#fff').textAlign(TextAlign.Center).width('100%')
}
.width(280 * this.ratio)
2024-01-31 14:35:16 +08:00
.height(35 * this.ratio)
.backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImage($r('app.media.userbox'))
.margin({ left: 8 * this.ratio })
.align(Alignment.Center)
}.margin({ bottom: 10 * this.ratio })
Row() {
Text('待考次数').fontSize(16 * this.ratio).fontColor('#99948A')
Row() {
Text(this.currentUser['kssycs']).fontColor('#fff').textAlign(TextAlign.Center).width('100%')
}
.width(280 * this.ratio)
.height(35 * this.ratio)
2024-01-05 11:11:15 +08:00
.backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImage($r('app.media.userbox'))
.margin({ left: 8 * this.ratio })
.align(Alignment.Center)
}.margin({ bottom: 10 * this.ratio })
Row() {
2024-01-31 14:35:16 +08:00
Text('考官姓名').fontSize(16 * this.ratio).fontColor('#99948A')
2024-01-05 11:11:15 +08:00
Row() {
Text(this.currentUser['ksy1']).fontColor('#fff').textAlign(TextAlign.Center).width('100%')
}
.width(280 * this.ratio)
2024-01-31 14:35:16 +08:00
.height(35 * this.ratio)
2024-01-05 11:11:15 +08:00
.backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImage($r('app.media.userbox'))
.margin({ left: 8 * this.ratio })
.align(Alignment.Center)
}
}
}
.width(664 * this.ratio)
.height(339 * this.ratio)
.backgroundImage($r('app.media.dkbg'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ left: 53 * this.ratio })
Column() {
2024-01-31 14:42:14 +08:00
// Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
// Image($r('app.media.yydj')).width(45 * this.ratio).height(45 * this.ratio)
// Text('语音对讲').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
// }
2024-01-05 11:11:15 +08:00
Image($r('app.media.yydj_btn'))
.width(220 * this.ratio)
.height(69 * this.ratio)
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 12 * this.ratio }).onClick(()=>{
2024-01-31 14:42:14 +08:00
// this.getCurrentStudent('3423231995014700007')
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
2024-01-05 11:11:15 +08:00
})
2024-01-31 14:42:14 +08:00
// Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
// Image($r('app.media.gx')).width(45 * this.ratio).height(45 * this.ratio)
// Text(' 更 新 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
// }
2024-01-05 11:11:15 +08:00
Image($r('app.media.gx_btn'))
.width(220 * this.ratio)
.height(69 * this.ratio)
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 12 * this.ratio }).onClick(()=>{
2024-01-31 14:35:16 +08:00
this.faceCompareSucess=0
this.numCount=0
2024-01-05 11:11:15 +08:00
this.getExaminationStudentInfoFn()
2024-01-31 14:42:14 +08:00
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
2024-01-05 11:11:15 +08:00
})
2024-01-31 14:42:14 +08:00
// Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
// Image($r('app.media.qk')).width(45 * this.ratio).height(45 * this.ratio)
// Text(' 缺 考 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
// }
2024-01-05 11:11:15 +08:00
Image($r('app.media.qk_btn'))
.width(220 * this.ratio)
.height(69 * this.ratio)
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 12 * this.ratio })
.onClick(() => {
// this.qkFn()
this.qkFlag=true
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
})
// Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
// Text('开始考试').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
// }
Image($r('app.media.ksks_btn'))
.width(220 * this.ratio)
.height(69 * this.ratio)
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 12 * this.ratio })
.onClick(() => {
this.faceCompareSucess=0
2024-01-31 14:35:16 +08:00
globalThis.statue=2
2024-01-05 11:11:15 +08:00
if(!this.currentUser.xm){
return
}
if(globalThis.singlePlay){
this.AccountTable.query('0', (result) => {
if (result.length == 0) {
this.AccountTable.insertData(this.currentUser, (id) => {
this.AccountTable.query('0', (result) => {
console.log(result)
router.pushUrl({
url: 'pages/Judge',
},router.RouterMode.Single);
testNapi.StopReadCard();
2024-01-31 14:35:16 +08:00
// console.log("zzctest Close Device ret = " + testNapi.CloseDevice());
2024-01-05 11:11:15 +08:00
})
})
} else {
this.AccountTable.updateData(this.currentUser, (id) => {
this.AccountTable.query('0', (result) => {
router.pushUrl({
url: 'pages/Judge',
},router.RouterMode.Single);
testNapi.StopReadCard();
2024-01-31 14:35:16 +08:00
// console.log("zzctest Close Device ret = " + testNapi.CloseDevice());
2024-01-05 11:11:15 +08:00
})
})
}
})
return
}
this.showFaceCompare=true
2024-01-31 14:35:16 +08:00
// this.sfbdinterfaceFn()
// return
2024-01-05 11:11:15 +08:00
})
}
}
if(this.showFaceCompare) {
2024-01-31 14:35:16 +08:00
FaceCompare({ showFaceCompare: $showFaceCompare, sfzh: this.currentUser.sfzmhm, firstImage:this.currentUser.kszp,faceCompareSucess: $faceCompareSucess,getqkFlag:$getqkFlag,faceCatchImg:$faceCatchImg,lsh:globalThis.lsh })
2024-01-05 11:11:15 +08:00
}
if(this.qkFlag){
Column(){
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)
}
.width(220 * this.ratio)
.height(69 * this.ratio)
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 12 * this.ratio }).onClick(()=>{
this.qkFlag=false
})
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(' 确 定 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
}
.width(220 * this.ratio)
.height(69 * this.ratio)
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 12 * this.ratio }).onClick(()=>{
this.qkFn()
})
}.position({y:265*this.ratio,x:115*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%')
.backgroundImage($r('app.media.bg'))
.backgroundImageSize({ width: '100%', height: '100%' })
}
}