From 7e10635a22ade945fbff287c3e840a2e2efde92a Mon Sep 17 00:00:00 2001 From: wangzhongjie Date: Wed, 21 Feb 2024 14:51:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E4=BB=B6=E5=90=8D=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-profile.json5 | 4 +- .../{TeminalInfos.ets => TerminalInfo.ets} | 0 entry/src/main/ets/pages/UserInfo.ets | 507 ++++++++++-------- .../resources/base/profile/main_pages.json | 2 +- 4 files changed, 285 insertions(+), 228 deletions(-) rename entry/src/main/ets/pages/{TeminalInfos.ets => TerminalInfo.ets} (100%) diff --git a/build-profile.json5 b/build-profile.json5 index 10af8c6..80164f4 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -5,9 +5,9 @@ "name": "default", "material": { "certpath": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.cer", - "storePassword": "0000001A3E7D97C4BC5819BCBC0470AB1397AAD09AC6E70069CFC6FD7D21A58A50AA6EE3FEBCDA027D71", + "storePassword": "0000001AAD87A2F96608A7CC63E6F839F8911407DD89270AAF9DE1E71573F9635276984E1FAF888B3B65", "keyAlias": "debugKey", - "keyPassword": "0000001A764ACBDC861BE169BE8B85E333F52659116CD5B8F12254C0F8F893E26884787B99199D49B10C", + "keyPassword": "0000001A4B890623B78CD2603888F1077C048A19AD5577A34A4A2C54492F54091134D30F5FC8DB4D2E1F", "profile": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p7b", "signAlg": "SHA256withECDSA", "storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p12" diff --git a/entry/src/main/ets/pages/TeminalInfos.ets b/entry/src/main/ets/pages/TerminalInfo.ets similarity index 100% rename from entry/src/main/ets/pages/TeminalInfos.ets rename to entry/src/main/ets/pages/TerminalInfo.ets diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index d32ced4..5456506 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -1,4 +1,4 @@ -import { getExaminationItem, getExaminationStudentInfo, examinationStuAbsent,getPhotosForOther } from '../api/userInfo' +import { getExaminationItem, getExaminationStudentInfo, examinationStuAbsent, getPhotosForOther } from '../api/userInfo' import { voiceService } from '../common/service/voiceService' import router from '@ohos.router' @@ -6,18 +6,19 @@ 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,getCurrentTime } from '../common/utils/tools'; +import { dateFormat, getCurrentTime } from '../common/utils/tools'; import MA_SYSSET from '../common//constants/MA_SYSSET'; import FaceCompare from './compontents/faceCompareByhaikang' import ethernet from '@ohos.net.ethernet'; import prompt from '@ohos.prompt' -import {initJudgeUdp} from '../common/utils/UdpJudge' +import { initJudgeUdp } from '../common/utils/UdpJudge' -import {writeObjectOut} from '../api/judge' +import { writeObjectOut } from '../api/judge' import testNapi from "@ohos.idcard"; import common from '@ohos.app.ability.common'; import { VideoConfig } from './interfaces' import WebRTCVoice from './webRTC/' + @Entry @Component struct Index { @@ -78,16 +79,14 @@ struct Index { videoRecord2: false, videoRecord3: false, videoRecord4: false, - rlls:'1' + 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 callBackFlag: boolean = false; @State born?: string = ''; @State address: string = ''; @State nation: string = ''; @@ -104,21 +103,22 @@ struct Index { // @State examItems: string = ''; @State isCanClick: boolean = true; subscriber; - @State faceCatchImg:string='' -// private fileUtil: FileUtil + @State faceCatchImg: string = '' + + // private fileUtil: FileUtil // that.sfzmhm = 'surenjun'; onPageShow() { //语音功能 - this.stepFlag=false + this.stepFlag = false new WebRTCVoice(this.context); - this.faceCompareSucess=0 - this.showFaceCompare=false + this.faceCompareSucess = 0 + this.showFaceCompare = false globalThis.indexComponent = this; - this.lsh='0000000000000' - this.callBackFlag=false + this.lsh = '0000000000000' + this.callBackFlag = false globalThis.lsh = this.lsh - this.currentUser= { + this.currentUser = { sfzmhm: '', xm: '', lsh: '', @@ -140,30 +140,29 @@ struct Index { xldm: '', yycs: '' } - globalThis.statue=2 - this.numCount=0 + globalThis.statue = 2 + this.numCount = 0 + globalThis.udpClient2 && globalThis.udpClient2.onMessage((val) => { + console.log('valvaltotol2', val.id, val.body, val.length) - globalThis.udpClient2&&globalThis.udpClient2.onMessage((val)=>{ - console.log('valvaltotol2',val.id,val.body,val.length) - - if(val.id=='32'){ - globalThis.signNum=val.body[1] - if(val.body[0]=='7'){ + if (val.id == '32') { + globalThis.signNum = val.body[1] + if (val.body[0] == '7') { this.getqkFn() - this.signNum=val.body[1] + this.signNum = val.body[1] } - }else if(val.id=='48'){ - console.log('valvalkkkk',val.body) + } else if (val.id == '48') { + console.log('valvalkkkk', val.body) // if(val.body[13]=='1'){ // this.faceCompareSucess=1 // console.log('ttt111') // // clearInterval(this.interval) // this.facePass() // } - }else if(val.id=='42'){ - console.log('qkfnqkfn',val.body[0]) + } else if (val.id == '42') { + console.log('qkfnqkfn', val.body[0]) this.qkFn() // this.getExaminationStudentInfoFn() // const arr = [globalThis.signNum,1]; @@ -196,8 +195,8 @@ struct Index { // } // }); - if(globalThis.singlePlay){ - this.list=[ + if (globalThis.singlePlay) { + this.list = [ { sfzmhm: '342323199501470011', xm: '测试学员1', @@ -219,7 +218,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '341182199308155624', xm: '测试学员2', lsh: '0000000000002', @@ -240,7 +239,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '3423231995014700003', xm: '测试学员3', lsh: '0000000000003', @@ -261,7 +260,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '3423231995014700004', xm: '测试学员4', lsh: '0000000000004', @@ -282,7 +281,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '3423231995014700005', xm: '测试学员5', lsh: '0000000000004', @@ -303,7 +302,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '342323199501470016', xm: '测试学员6', lsh: '0000000000005', @@ -324,7 +323,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '3423231995014700007', xm: '测试学员7', lsh: '0000000000007', @@ -345,7 +344,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '3423231995014700008', xm: '测试学员8', lsh: '0000000000008', @@ -366,7 +365,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '3423231995014700009', xm: '测试学员9', lsh: '0000000000009', @@ -387,7 +386,7 @@ struct Index { xh: '', xldm: '', yycs: '' - },{ + }, { sfzmhm: '34232319950147000010', xm: '测试学员10', lsh: '002', @@ -409,66 +408,87 @@ struct Index { xldm: '', yycs: '' }] - this.pageIndex=0 + 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 - globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm - globalThis.lsh=this.lsh + this.currentUser = this.dataList[0] + this.lsh = this.currentUser.lsh + globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm + globalThis.lsh = this.lsh return - }else{ -// this.getExaminationStudentInfoFn() + } else { + // this.getExaminationStudentInfoFn() } this.initSysset() initJudgeUdp() } - changeQkfn(){ + + changeQkfn() { this.qkFn() } - getqkFn(){ + + 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} + const param = { + id: 41, + list: tmpList, + carNo: globalThis.carInfo.carNo, + placeId: globalThis.carInfo.examinationRoomId + } globalThis.udpClient2.sendMsg(param, this.context) } + async heartMsg(context) { - let tmpList=[] - const str =globalThis.lsh - for (let i = 0;i < str.length; i++) { + let tmpList = [] + const str = globalThis.lsh + 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:()=>{ - console.log('46send') - this.callBackFlag=true - }} - this.interval=setInterval(()=>{ - if(this.callBackFlag){ - console.log('validqqq333') - const param2 = { id: 47, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId } - globalThis.udpClient2&&globalThis.udpClient2.sendMsg(param2,this.context) + const param = { + id: 46, + list: tmpList, + carNo: globalThis.carInfo.carNo, + placeId: globalThis.carInfo.examinationRoomId, + callback: () => { + console.log('46send') + this.callBackFlag = true } - },1000) + } + this.interval = setInterval(() => { + if (this.callBackFlag) { + console.log('validqqq333') + const param2 = { + id: 47, + list: tmpList, + carNo: globalThis.carInfo.carNo, + placeId: globalThis.carInfo.examinationRoomId + } + globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param2, this.context) + } + }, 1000) // const param = { id: 31, list: tmpList, carNo: 489, placeId: 62 } - globalThis.udpClient2&&globalThis.udpClient2.sendMsg(param, this.context) + globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param, this.context) // return {id: 31,list:tmpList,carNo:489,placeId:62} } + aboutToDisappear() { clearInterval(this.interval) clearInterval(this.interval2) testNapi.StopReadCard(); // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); } - changeStudentStatue(val){ - const arr = [globalThis.signNum||0, val] + + 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++) { + for (let i = 0; i < str.length; i++) { tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0]) } // const str ='1111160366580' @@ -478,20 +498,27 @@ struct Index { // 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} + const param = { + id: 31, + list: tmpList, + carNo: globalThis.carInfo.carNo, + placeId: globalThis.carInfo.examinationRoomId + } - globalThis.udpClient2&&globalThis.udpClient2.sendMsg(param, this.context) + globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param, this.context) } - facePass(){ - if(!this.stepFlag){ + + facePass() { + if (!this.stepFlag) { this.sfbdinterfaceFn() } } + onReadCard(ret) { console.info(`zzctest xx Read Card ret =${ret.status}`) let thisVar = globalThis.indexComponent; - if(ret.status == 0) { // status = 1 为读到身份证信息; status = 1 为身份证离开读卡器 + if (ret.status == 0) { // status = 1 为读到身份证信息; status = 1 为身份证离开读卡器 // 收到身份证离开读卡器的事件通知,根据实际业务需要决定是否需要清空之前已读取的身份证信息。 // 如果身份证卡片离开读卡器时,需要继续保留UI界面上已读取到的身份信息,以下代码可以注释掉。 thisVar.name = ""; @@ -518,9 +545,9 @@ struct Index { thisVar.born = baseInfos[3]; thisVar.address = baseInfos[4]; thisVar.idCard = baseInfos[5]; - setTimeout(()=>{ + setTimeout(() => { thisVar.getCurrentStudent(baseInfos[5]) - },1000) + }, 1000) } // 身份证照片数据处理 @@ -528,7 +555,7 @@ struct Index { let dataView = new DataView(ret.photo) console.info(`Read Card ret = length = ${dataView.byteLength}`) let str = "" - for (let i = 0;i < dataView.byteLength; ++i) { + for (let i = 0; i < dataView.byteLength; ++i) { let c = String.fromCharCode(dataView.getUint8(i)) if (c !== "\n") { str += c @@ -539,45 +566,48 @@ struct Index { console.info(`zzctest Read Card end`); return true; } - async initSysset(){ + + async initSysset() { const that = this; - const db = new AccountTable(()=>{},MA_SYSSET); - db.getRdbStore(()=>{ + const db = new AccountTable(() => { + }, MA_SYSSET); + db.getRdbStore(() => { db.query('0', (syssetParams) => { 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' - const studentRefreshParam=syssetParams.filter(sys => sys.v_no === '452') - that.studentRefreshStatue=studentRefreshParam?.[0]?.v_value || '0' + const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') + that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' //0不自动更新 1自动更新(不限次数) 2没有考生更新2次 - if(that.studentRefreshStatue=='2'){ + if (that.studentRefreshStatue == '2') { clearInterval(that.interval2) - that.interval2=setInterval(()=>{ - if(that.dataList.length==0&&that.numCount<3){ + that.interval2 = setInterval(() => { + if (that.dataList.length == 0 && that.numCount < 3) { that.numCount++ that.getExaminationStudentInfoFn() } - },5000) - }else if(that.studentRefreshStatue=='1'){ + }, 5000) + } else if (that.studentRefreshStatue == '1') { clearInterval(that.interval2) - that.interval2=setInterval(()=>{ - if(that.dataList.length==0){ + that.interval2 = setInterval(() => { + if (that.dataList.length == 0) { that.getExaminationStudentInfoFn() } - },5000) + }, 5000) } }) }) } + // 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) // } changefaceCompareSucess() { // globalThis.statue=3 - console.log('this.faceCompareSuces',this.faceCompareSucess,JSON.stringify(this.currentUser)) + console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser)) // if(this.faceCompareSucess!=1){ // this.heartMsg(this.context) // return @@ -586,13 +616,13 @@ struct Index { // this.sfbdinterfaceFn() // // } - if(this.faceCompareSucess>0){ + if (this.faceCompareSucess > 0) { this.sfbdinterfaceFn() } } nextClick() { - if (this.list.length <= 4||this.pageIndex==Math.floor(this.list.length/4)) { + if (this.list.length <= 4 || this.pageIndex == Math.floor(this.list.length / 4)) { return } this.pageIndex++; @@ -600,57 +630,59 @@ struct Index { } prevClick() { - if (this.list.length <= 4||this.pageIndex==0) { + 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 + + 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 - globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm + this.list.map((res, index) => { + if (res.sfzmhm == id) { + flag = true + this.currentUser = res + this.lsh = this.currentUser.lsh + globalThis.lsh = this.currentUser.lsh + globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm // this.currentUser.kszp=this.photo+res.kszp // this.currentUser.ksmjzp=this.photo+this.currentUser.ksmjzp - if(globalThis.singlePlay){ + if (globalThis.singlePlay) { testNapi.StopReadCard(); // globalThis.statue=4 router.pushUrl({ url: 'pages/Judge', - },router.RouterMode.Single); + }, router.RouterMode.Single); return } - this.showFaceCompare=true - this.pageIndex=Math.floor(index/4) + this.showFaceCompare = true + this.pageIndex = Math.floor(index / 4) } }) this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) - if(!flag){ + if (!flag) { prompt.showToast({ message: '未匹配到对应下载学员', duration: 3000 }); } } + getExaminationStudentInfoFn() { - if(globalThis.singlePlay){ + if (globalThis.singlePlay) { return } console.log('tttttttttt') const param = `${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}${globalThis.carInfo.carId}${globalThis.carInfo.examinationRoomId}${globalThis.username}` getExaminationStudentInfo(param).then(res => { - console.log('mmmmmmmmmmmm',JSON.stringify(res)) + console.log('mmmmmmmmmmmm', JSON.stringify(res)) if (!res) { - this.dataList=[] - this.currentUser={ + this.dataList = [] + this.currentUser = { sfzmhm: '', xm: '', lsh: '', @@ -672,43 +704,43 @@ struct Index { xldm: '', yycs: '' } - console.log('currentUser',JSON.stringify(this.currentUser)) + console.log('currentUser', JSON.stringify(this.currentUser)) this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage) return } let dataList = [] - this.list=[] + 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 (a instanceof Array) { + dataList = a + } else { + dataList = [a] } } - if(dataList.length){ - this.numCount=0 + if (dataList.length) { + this.numCount = 0 } - this.list=JSON.parse(JSON.stringify(dataList)) + 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]) + 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 + listData.kszp = this.photo + listData.kszp + listData.ksmjzp = this.photo + listData.ksmjzp }) this.dataList = dataList - if(this.dataList.length){ + if (this.dataList.length) { this.currentUser = this.dataList[0] - }else{ - this.currentUser={ + } else { + this.currentUser = { sfzmhm: '', xm: '', lsh: '', @@ -732,9 +764,9 @@ struct Index { } } - this.lsh=this.currentUser.lsh - globalThis.lsh=this.lsh - globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm + this.lsh = this.currentUser.lsh + globalThis.lsh = this.lsh + globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm // this.currentUser.kszp=this.photo+this.currentUser.kszp // this.currentUser.ksmjzp=this.photo+this.currentUser.ksmjzp @@ -751,6 +783,7 @@ struct Index { console.log('error12error' + error) }) } + fillZero(str, len) { str = str + ''; if (str.length > len || !len) { @@ -765,17 +798,18 @@ struct Index { return zeroStr + str; } + string2Bytes(number, len) { // console.log('string2Bytes == ', number) - let str = (+number).toString(2); - if(str.length > len) { + 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;) { + for (var i = byteString.length; i > 0; ) { let j = i - 8; if (j < 0) { j = 0 @@ -788,36 +822,38 @@ struct Index { } return arrBytes; } - getPhotosForOtherFn(data,type){ - const date=new Date() - const param={ - time:dateFormat(date), - ksrq:dateFormat(date).split(' ')[0], - sfzmhm:data.sfzmhm, - zptype:type + + 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 + 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){ - this.qkFlag=false + qkFn() { + this.faceCompareSucess = 0 + + if (globalThis.singlePlay) { + this.qkFlag = false return } // const param = { id: 46, list: tmpList, carNo: 489, placeId: 62 } - console.log('JsonJson',JSON.stringify(this.currentUser)) + console.log('JsonJson', JSON.stringify(this.currentUser)) const param = `${globalThis.carInfo.carId}${this.currentUser.sfzmhm}${globalThis.carInfo.examinationRoomId}${globalThis.username}${this.lsh}` - console.log('carNo1111',param) + console.log('carNo1111', param) examinationStuAbsent(param).then(res => { - const arr = [this.signNum||0,1] + const arr = [this.signNum || 0, 1] let tmpList = []; tmpList.push(this.string2Bytes(arr[0], 1 * 8)[0]) tmpList.push(this.string2Bytes(arr[1], 1 * 8)[0]) @@ -827,14 +863,19 @@ struct Index { // 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) - const param= {id: 43,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId} + console.log('globalThis.signNum', globalThis.signNum) + const param = { + id: 43, + list: tmpList, + carNo: globalThis.carInfo.carNo, + placeId: globalThis.carInfo.examinationRoomId + } globalThis.udpClient2.sendMsg(param, this.context) - if (res.examinationStuAbsentRsp.head.resultCode=='0') { + if (res.examinationStuAbsentRsp.head.resultCode == '0') { this.pageIndex = 0 - this.qkFlag=false - this.currentUser={ + this.qkFlag = false + this.currentUser = { sfzmhm: '', xm: '', lsh: '', @@ -867,28 +908,28 @@ struct Index { }) } - outClick(){ + + outClick() { testNapi.StopReadCard(); // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); } - - async sfbdinterfaceFn(){ - this.stepFlag=true - console.info('surenjun',this.currentUser.lsh) + async sfbdinterfaceFn() { + this.stepFlag = true + console.info('surenjun', this.currentUser.lsh) const carInfo = globalThis.carInfo; const {carId,examinationRoomId} = carInfo; const examItems = await getExaminationItem({ - time:getCurrentTime(), + time: getCurrentTime(), carId, - lsh:this.currentUser.lsh || '', + lsh: this.currentUser.lsh || '', examinationRoomId }); //获取已考项目 console.log('goroute') const date = new Date() - this.showFaceCompare=false + this.showFaceCompare = false const { examSubject,plateNo } = carInfo; const drvexam = { lsh: this.currentUser.lsh || '', @@ -896,9 +937,9 @@ struct Index { ksxtbh: this.ksxtbh || '222', sfzmhm: this.currentUser.sfzmhm || '', ksysfzmhm: this.currentUser.ksy1sfzmhm || '', - zp:encodeURIComponent(this.faceCatchImg ||''), + zp: encodeURIComponent(this.faceCatchImg || ''), kssj: dateFormat(date) || '', - kchp:decodeURI(plateNo), + kchp: decodeURI(plateNo), Ksy2sfzmhm: this.currentUser.Ksy2sfzmhm || '' } const param = { @@ -912,25 +953,25 @@ struct Index { const code = await writeObjectOut(param); // this.examItems=examItems?.getExaminationItemRsp?.body?.ykxx - console.log('codecode',code) - globalThis.lsh=this.currentUser.lsh - globalThis.ksyh=this.currentUser.ksy1sfzmhm||this.currentUser.ksy2sfzmhm - this.currentUser.id='1' + console.log('codecode', code) + globalThis.lsh = this.currentUser.lsh + globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm + this.currentUser.id = '1' 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 - this.stepFlag=false + globalThis.statue = 4 + this.stepFlag = false // this.vocObj.playAudio({ // type: 1, // name: 'ksks.WAV' // }) router.pushUrl({ url: 'pages/Judge', - params:{examItems:examItems?.getExaminationItemRsp?.body?.ykxx} + params: { examItems: examItems?.getExaminationItemRsp?.body?.ykxx } }, router.RouterMode.Single); testNapi.StopReadCard(); // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); @@ -939,7 +980,7 @@ struct Index { } else { this.AccountTable.updateData(this.currentUser, (id) => { this.AccountTable.query('0', (result) => { - this.stepFlag=false + this.stepFlag = false // this.vocObj.playAudio({ // type: 1, // name: 'ksks.WAV' @@ -947,23 +988,23 @@ struct Index { router.pushUrl({ url: 'pages/Judge', - params:{examItems:examItems?.getExaminationItemRsp?.body?.ykxx} + params: { examItems: examItems?.getExaminationItemRsp?.body?.ykxx } }, router.RouterMode.Single); - globalThis.statue=4 + globalThis.statue = 4 testNapi.StopReadCard(); // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); }) }) } }) - }else{ - this.stepFlag=false + } else { + this.stepFlag = false } } build() { Column() { - TopLogo({outFlag:$outFlag}).margin({ bottom: 10 }) + TopLogo({ outFlag: $outFlag }).margin({ bottom: 10 }) Row() { Row() { ForEach(this.dataList, (item, index) => { @@ -983,7 +1024,7 @@ struct Index { } .width(165 * this.ratio) .height(85 * this.ratio) - .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm? $r('app.media.userbox2') : $r('app.media.userboxbg')) + .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) .backgroundImageSize({ width: '100%', height: '100%' }) .onClick(() => { // this.vocObj.playAudio({ @@ -1001,7 +1042,7 @@ struct Index { Image($r('app.media.dk_prev')) .width(90 * this.ratio) .height(70 * this.ratio) - .margin({ left: 65 * this.ratio, right:10 * this.ratio }) + .margin({ left: 65 * this.ratio, right: 10 * this.ratio }) .onClick(() => { this.prevClick() // this.vocObj.playAudio({ @@ -1021,23 +1062,23 @@ struct Index { Flex({ justifyContent: FlexAlign.SpaceBetween }) { Row() { Column() { - if(this.currentUser['kszp']){ - Image(this.currentUser['kszp']?this.currentUser['kszp']:'') + 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{ + } 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']:'') + 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{ + } else { Image('') .width(93 * this.ratio) .height(130.5 * this.ratio) @@ -1097,6 +1138,7 @@ struct Index { .margin({ left: 8 * this.ratio }) .align(Alignment.Center) }.margin({ bottom: 10 * this.ratio }) + Row() { Text('待考次数').fontSize(16 * this.ratio).fontColor('#99948A') Row() { @@ -1141,13 +1183,14 @@ struct Index { .height(69 * this.ratio) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ bottom: 12 * this.ratio }).onClick(()=>{ - // this.getCurrentStudent('3423231995014700007') - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) - }) + .margin({ bottom: 12 * this.ratio }) + .onClick(() => { + // this.getCurrentStudent('3423231995014700007') + // this.vocObj.playAudio({ + // type: 1, + // name: 'media_button.wav' + // }) + }) // Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { // Image($r('app.media.gx')).width(45 * this.ratio).height(45 * this.ratio) @@ -1158,15 +1201,16 @@ struct Index { .height(69 * this.ratio) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ bottom: 12 * this.ratio }).onClick(()=>{ - this.faceCompareSucess=0 - this.numCount=0 - this.getExaminationStudentInfoFn() - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) - }) + .margin({ bottom: 12 * this.ratio }) + .onClick(() => { + this.faceCompareSucess = 0 + this.numCount = 0 + this.getExaminationStudentInfoFn() + // this.vocObj.playAudio({ + // type: 1, + // name: 'media_button.wav' + // }) + }) // Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { // Image($r('app.media.qk')).width(45 * this.ratio).height(45 * this.ratio) @@ -1180,7 +1224,7 @@ struct Index { .margin({ bottom: 12 * this.ratio }) .onClick(() => { // this.qkFn() - this.qkFlag=true + this.qkFlag = true // this.vocObj.playAudio({ // type: 1, // name: 'media_button.wav' @@ -1196,12 +1240,12 @@ struct Index { .backgroundImageSize({ width: '100%', height: '100%' }) .margin({ bottom: 12 * this.ratio }) .onClick(() => { - this.faceCompareSucess=0 - globalThis.statue=2 - if(!this.currentUser.xm){ + this.faceCompareSucess = 0 + globalThis.statue = 2 + if (!this.currentUser.xm) { return } - if(globalThis.singlePlay){ + if (globalThis.singlePlay) { this.AccountTable.query('0', (result) => { if (result.length == 0) { this.AccountTable.insertData(this.currentUser, (id) => { @@ -1209,7 +1253,7 @@ struct Index { console.log(result) router.pushUrl({ url: 'pages/Judge', - },router.RouterMode.Single); + }, router.RouterMode.Single); testNapi.StopReadCard(); // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); }) @@ -1219,7 +1263,7 @@ struct Index { this.AccountTable.query('0', (result) => { router.pushUrl({ url: 'pages/Judge', - },router.RouterMode.Single); + }, router.RouterMode.Single); testNapi.StopReadCard(); // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); }) @@ -1228,19 +1272,30 @@ struct Index { }) return } - this.showFaceCompare=true + this.showFaceCompare = true // this.sfbdinterfaceFn() // return }) } } - if(this.showFaceCompare) { - FaceCompare({ showFaceCompare: $showFaceCompare, sfzh: this.currentUser.sfzmhm, firstImage:this.currentUser.kszp,faceCompareSucess: $faceCompareSucess,getqkFlag:$getqkFlag,faceCatchImg:$faceCatchImg,lsh:globalThis.lsh }) + + if (this.showFaceCompare) { + 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}) - Row(){ + 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) } @@ -1248,9 +1303,11 @@ struct Index { .height(69 * this.ratio) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ bottom: 12 * this.ratio }).onClick(()=>{ - this.qkFlag=false + .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) } @@ -1258,19 +1315,19 @@ struct Index { .height(69 * this.ratio) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ bottom: 12 * this.ratio }).onClick(()=>{ + .margin({ bottom: 12 * this.ratio }) + .onClick(() => { this.qkFn() }) - }.position({y:265*this.ratio,x:115*this.ratio}) + }.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%') diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json index 84cfadd..dbd1da5 100644 --- a/entry/src/main/resources/base/profile/main_pages.json +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -6,7 +6,7 @@ "pages/UserInfo", "pages/register", "pages/Settings", - "pages/TeminalInfos", + "pages/TerminalInfo", "pages/VideoConfig", "pages/Hello", "pages/Judge",