diff --git a/entry/src/main/ets/.DS_Store b/entry/src/main/ets/.DS_Store new file mode 100644 index 0000000..3ce9dd1 Binary files /dev/null and b/entry/src/main/ets/.DS_Store differ diff --git a/entry/src/main/ets/mock/CandidateData.ts b/entry/src/main/ets/mock/CandidateData.ts new file mode 100644 index 0000000..63adf99 --- /dev/null +++ b/entry/src/main/ets/mock/CandidateData.ts @@ -0,0 +1,212 @@ +export const CandidateData = [ + { + 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: '' +}] \ No newline at end of file diff --git a/entry/src/main/ets/pages/ExaminerLogin.ets b/entry/src/main/ets/pages/ExaminerLogin.ets index ec05147..55589ec 100644 --- a/entry/src/main/ets/pages/ExaminerLogin.ets +++ b/entry/src/main/ets/pages/ExaminerLogin.ets @@ -78,7 +78,7 @@ struct Index { // }) // this.url='pages/userInfo' router.pushUrl({ - url: 'pages/userInfo', + url: 'pages/UserInfo', },router.RouterMode.Single); console.log('res11',JSON.stringify(res)) globalThis.username=this.inputTextArr[0] diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 6efe36b..fc04d28 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -91,7 +91,7 @@ struct Index { } router.pushUrl({ - url: 'pages/userInfo', + url: 'pages/UserInfo', }, router.RouterMode.Single); }) } @@ -100,7 +100,7 @@ struct Index { return } router.pushUrl({ - url: 'pages/carCheck' + url: 'pages/CarCheck' }, router.RouterMode.Single); }) } diff --git a/entry/src/main/ets/pages/Index_bak.ets b/entry/src/main/ets/pages/Index_bak.ets index f8a3de6..0ea2605 100644 --- a/entry/src/main/ets/pages/Index_bak.ets +++ b/entry/src/main/ets/pages/Index_bak.ets @@ -112,7 +112,7 @@ struct Index { } router.pushUrl({ - url: 'pages/userInfo', + url: 'pages/UserInfo', }, router.RouterMode.Single); }) } @@ -121,7 +121,7 @@ struct Index { return } router.pushUrl({ - url: 'pages/carCheck' + url: 'pages/CarCheck' }, router.RouterMode.Single); }) } diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 5456506..82391d6 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -1,6 +1,4 @@ import { getExaminationItem, getExaminationStudentInfo, examinationStuAbsent, getPhotosForOther } from '../api/userInfo' -import { voiceService } from '../common/service/voiceService' - import router from '@ohos.router' import TopLogo from './compontents/topLogo' import Md5 from '../common/utils/md5'; @@ -9,15 +7,38 @@ import USER from '../common/constants/USER'; 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 { writeObjectOut } from '../api/judge' import testNapi from "@ohos.idcard"; import common from '@ohos.app.ability.common'; import { VideoConfig } from './interfaces' import WebRTCVoice from './webRTC/' +import promptAction from '@ohos.promptAction' +import { CandidateData } from "../mock/CandidateData" + +export interface User { + sfzmhm: string + xm: string + lsh: string + ksy1: string + id: string + kszp: string + ksmjzp: string + bz1: string + jxmc: string + kchp: string + kscx: string + ksdd: string + kssycs: string + ksxl: string + ksy1sfzmhm: string + kszt: string + xb: string + xh: string + xldm: string + yycs: string + ksy2sfzmhm: string +} @Entry @Component @@ -30,15 +51,14 @@ struct Index { @State ksxtbh: string = '' @State pic: string = '' @State jkxlh: string = '' - @State @Watch('changefaceCompareSucess') faceCompareSucess: number = 0; + @State @Watch('changeFaceCompareSuccess') faceCompareSucess: number = 0; @State @Watch('changeQkfn') getqkFlag: boolean = false; @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 = { + @State currentUser: User = { sfzmhm: '', xm: '', lsh: '', @@ -58,7 +78,8 @@ struct Index { xb: '', xh: '', xldm: '', - yycs: '' + yycs: '', + ksy2sfzmhm: '' } @State dataList: Array = [] @State list: Array = [] @@ -100,14 +121,10 @@ struct Index { @State photo: string = 'data:image/bmp;base64,'; @State numCount: number = 0; @State signNum: number = 0; - // @State examItems: string = ''; @State isCanClick: boolean = true; subscriber; @State faceCatchImg: string = '' - // private fileUtil: FileUtil - // that.sfzmhm = 'surenjun'; - onPageShow() { //语音功能 this.stepFlag = false @@ -119,6 +136,7 @@ struct Index { this.callBackFlag = false globalThis.lsh = this.lsh this.currentUser = { + ksy2sfzmhm: '', sfzmhm: '', xm: '', lsh: '', @@ -142,37 +160,18 @@ struct Index { } globalThis.statue = 2 this.numCount = 0 - - 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') { this.getqkFn() this.signNum = val.body[1] } - } 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]) this.qkFn() - // 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) + } else if (val.id == '48') { + console.log('valvalkkkk', val.body) } }) // 应用启动时打开读卡设备 @@ -182,232 +181,10 @@ struct Index { } else { console.error("zzctest Failed to Open Device"); } - // 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() - // } - // } - // }); 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: '' - }] + // TODO 模拟假数据 + this.list = CandidateData this.pageIndex = 0 this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) this.currentUser = this.dataList[0] @@ -468,18 +245,13 @@ struct Index { 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) - - - // 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) { @@ -491,13 +263,6 @@ struct Index { 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, @@ -601,21 +366,8 @@ struct Index { }) } - // 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 + changeFaceCompareSuccess() { 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() - // - // } if (this.faceCompareSucess > 0) { this.sfbdinterfaceFn() } @@ -665,7 +417,7 @@ struct Index { }) this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) if (!flag) { - prompt.showToast({ + promptAction.showToast({ message: '未匹配到对应下载学员', duration: 3000 }); @@ -676,13 +428,12 @@ struct Index { 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)) if (!res) { this.dataList = [] this.currentUser = { + ksy2sfzmhm: "", sfzmhm: '', xm: '', lsh: '', @@ -717,18 +468,13 @@ struct Index { } 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 = dataList.length > 4 ? dataList.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : dataList; dataList.forEach(listData => { for (let i in listData) { listData[i] = decodeURI(listData[i]) @@ -741,6 +487,7 @@ struct Index { this.currentUser = this.dataList[0] } else { this.currentUser = { + ksy2sfzmhm: '', sfzmhm: '', xm: '', lsh: '', @@ -767,16 +514,6 @@ struct Index { 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 - // 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)) this.pageIndex = 0 }).catch((error) => { @@ -785,41 +522,27 @@ struct Index { } fillZero(str, len) { - str = str + ''; - if (str.length > len || !len) { - return str + str = String(str); + if (!len || str.length >= len) { + return str; } - - let num = len - str.length; - let zeroStr = ''; - for (var i = 0; i < num; i++) { - zeroStr = zeroStr + '0' - } - + const num = len - str.length; + const zeroStr = '0'.repeat(num); return zeroStr + str; } string2Bytes(number, len) { - // console.log('string2Bytes == ', number) - let str = (+number).toString(2); + const 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 - - } + const byteString = this.fillZero(str, len); + const arrBytes = Array.from({ length: byteString.length / 8 }, (_, i) => { + const start = Math.max(byteString.length - (i + 1) * 8, 0); + const end = byteString.length - i * 8; + return parseInt(byteString.slice(start, end), 2); + }); return arrBytes; } @@ -842,12 +565,10 @@ struct Index { 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)) const param = `${globalThis.carInfo.carId}${this.currentUser.sfzmhm}${globalThis.carInfo.examinationRoomId}${globalThis.username}${this.lsh}` console.log('carNo1111', param) @@ -857,12 +578,6 @@ struct Index { let tmpList = []; tmpList.push(this.string2Bytes(arr[0], 1 * 8)[0]) tmpList.push(this.string2Bytes(arr[1], 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: 489, placeId: 62 } console.log('globalThis.signNum', globalThis.signNum) const param = { id: 43, @@ -876,6 +591,7 @@ struct Index { this.pageIndex = 0 this.qkFlag = false this.currentUser = { + ksy2sfzmhm: '', sfzmhm: '', xm: '', lsh: '', @@ -898,11 +614,8 @@ struct Index { yycs: '' } this.getExaminationStudentInfoFn() - // this.errorMsg = decodeURI(res.examinationStuAbsentRsp.head.resultMessage) return } - - // this.getExaminationStudentInfoFn() }).catch((error) => { console.log('error12error' + error) }) @@ -911,7 +624,6 @@ struct Index { outClick() { testNapi.StopReadCard(); - // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); } async sfbdinterfaceFn() { @@ -940,7 +652,7 @@ struct Index { zp: encodeURIComponent(this.faceCatchImg || ''), kssj: dateFormat(date) || '', kchp: decodeURI(plateNo), - Ksy2sfzmhm: this.currentUser.Ksy2sfzmhm || '' + Ksy2sfzmhm: this.currentUser.ksy2sfzmhm || '' } const param = { drvexam: drvexam, @@ -951,9 +663,6 @@ struct Index { jkid: '17C51', } 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' @@ -962,37 +671,25 @@ struct Index { if (result.length == 0) { this.AccountTable.insertData(this.currentUser, (id) => { this.AccountTable.query('0', (result) => { - console.log(result) 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 } }, router.RouterMode.Single); testNapi.StopReadCard(); - // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); }) }) } else { this.AccountTable.updateData(this.currentUser, (id) => { this.AccountTable.query('0', (result) => { this.stepFlag = false - // this.vocObj.playAudio({ - // type: 1, - // name: 'ksks.WAV' - // }) - router.pushUrl({ url: 'pages/Judge', params: { examItems: examItems?.getExaminationItemRsp?.body?.ykxx } }, router.RouterMode.Single); globalThis.statue = 4 testNapi.StopReadCard(); - // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); }) }) } @@ -1002,24 +699,43 @@ struct Index { } } + // 几个按钮公共样式 + @Styles + commStyle(){ + .width(220 * this.ratio) + .height(69 * this.ratio) + .backgroundImage($r('app.media.button_nor')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .margin({ bottom: 12 * this.ratio }) + } + + private labelBlocks = [ + { label: '考生姓名', key: 'xm' }, + { label: '身份证号', key: 'sfzmhm' }, + { label: ' 流 水 号 ', key: 'lsh' }, + { label: '考试路线', key: 'kslx' }, + { label: '待考次数', key: 'kssycs' }, + { label: '考官姓名', key: 'ksy1' }, + ] + build() { Column() { TopLogo({ outFlag: $outFlag }).margin({ bottom: 10 }) Row() { Row() { - ForEach(this.dataList, (item, index) => { + ForEach(this.dataList, (item) => { 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') + CommText({ + ratio: this.ratio, + color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', + text: item.lsh + }) + CommText({ + ratio: this.ratio, + color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', + text: decodeURIComponent(item.xm) + }) } } .width(165 * this.ratio) @@ -1027,14 +743,7 @@ struct Index { .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 }) @@ -1045,17 +754,9 @@ struct Index { .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 }) @@ -1063,109 +764,53 @@ struct Index { Row() { Column() { 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 }) + // Image(this.currentUser['kszp'] ? this.currentUser['kszp'] : '') + // .width(93 * this.ratio) + // .height(130.5 * this.ratio) + // .backgroundColor('green') + // .margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio }) + Avatar({ + ratio: this.ratio, + url: this.currentUser['kszp'] ? this.currentUser['kszp'] : '' + }) } else { - Image('') - .width(93 * this.ratio) - .height(130.5 * this.ratio) - .margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio }) + // Image('') + // .width(93 * this.ratio) + // .height(130.5 * this.ratio) + // .backgroundColor('red') + // .margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio }) + Avatar({ + ratio: this.ratio, + url: "" + }) } 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 }) + // Image(this.currentUser['ksmjzp'] ? this.currentUser['ksmjzp'] : '') + // .width(93 * this.ratio) + // .height(130.5 * this.ratio) + // .backgroundColor('yellow') + // .margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio }) + Avatar({ + ratio: this.ratio, + url: this.currentUser['ksmjzp'] ? this.currentUser['ksmjzp'] : '' + }) } else { - Image('') - .width(93 * this.ratio) - .height(130.5 * this.ratio) - .margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio }) + // Image('') + // .width(93 * this.ratio) + // .height(130.5 * this.ratio) + // .margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio }) + Avatar({ + ratio: this.ratio, + url: "" + }) } } Column() { - Row() { - Text('考生姓名').fontSize(16 * this.ratio).fontColor('#99948A') - Row() { - Text(this.currentUser['xm']).fontColor('#fff').textAlign(TextAlign.Center).width('100%') - } - .width(280 * this.ratio) - .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['sfzmhm']).fontColor('#fff').textAlign(TextAlign.Center).width('100%') - } - .width(280 * this.ratio) - .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['lsh']).fontColor('#fff').textAlign(TextAlign.Center).width('100%') - } - .width(280 * this.ratio) - .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['kslx']).fontColor('#fff').textAlign(TextAlign.Center).width('100%') - } - .width(280 * this.ratio) - .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) - .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['ksy1']).fontColor('#fff').textAlign(TextAlign.Center).width('100%') - } - .width(280 * this.ratio) - .height(35 * this.ratio) - .backgroundImageSize({ width: '100%', height: '100%' }) - .backgroundImage($r('app.media.userbox')) - .margin({ left: 8 * this.ratio }) - .align(Alignment.Center) - } + ForEach(this.labelBlocks, (item) => { + LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser[item.key] }) + }) } - } .width(664 * this.ratio) .height(339 * this.ratio) @@ -1174,71 +819,22 @@ struct Index { .margin({ left: 53 * this.ratio }) Column() { - // 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) - // } 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(() => { - // 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) - // Text(' 更 新 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio) - // } + .commStyle() 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 }) + .commStyle() .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) - // Text(' 缺 考 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio) - // } 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 }) + .commStyle() .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 }) + .commStyle() .onClick(() => { this.faceCompareSucess = 0 globalThis.statue = 2 @@ -1255,7 +851,6 @@ struct Index { url: 'pages/Judge', }, router.RouterMode.Single); testNapi.StopReadCard(); - // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); }) }) } else { @@ -1265,7 +860,6 @@ struct Index { url: 'pages/Judge', }, router.RouterMode.Single); testNapi.StopReadCard(); - // console.log("zzctest Close Device ret = " + testNapi.CloseDevice()); }) }) } @@ -1273,8 +867,6 @@ struct Index { return } this.showFaceCompare = true - // this.sfbdinterfaceFn() - // return }) } } @@ -1299,11 +891,7 @@ struct Index { 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 }) + .commStyle() .onClick(() => { this.qkFlag = false }) @@ -1311,11 +899,7 @@ struct Index { 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 }) + .commStyle() .onClick(() => { this.qkFn() }) @@ -1334,4 +918,66 @@ struct Index { .backgroundImage($r('app.media.bg')) .backgroundImageSize({ width: '100%', height: '100%' }) } +} + +// 头像组件 +@Component +struct Avatar { + @State ratio: number = 0 + @State url: string = "" + + build() { + Row() { + Image(this.url) + .width(93 * this.ratio) + .height(130.5 * this.ratio) + .margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio }) + .backgroundColor('orange') + .border({ color: '#fff', width: 1, style: BorderStyle.Solid }) + } + } +} + +// 横向滚动学员列表里面文字 +@Component +struct CommText { + @State text: string = "" + @State color: string = "#fff" + @State ratio: number = 0 + + build() { + Text(this.text) + .fontSize(16 * this.ratio) + .lineHeight(30 * this.ratio) + .fontWeight(500) + .fontColor(this.color) + } +} + +// 考生信息的labelBlock组件 +@Component +struct LabelBlock { + @State label: string = '' + @State ratio: number = 0 + @Prop value: string = '' + + @Styles + commLabelStyle(){ + .width(280 * this.ratio) + .height(35 * this.ratio) + .backgroundImageSize({ width: '100%', height: '100%' }) + .backgroundImage($r('app.media.userbox')) + .margin({ left: 8 * this.ratio }) + .align(Alignment.Center) + } + + build() { + Row() { + Text(this.label).fontSize(16 * this.ratio).fontColor('#99948A') + Row() { + Text(this.value).fontColor('#fff').textAlign(TextAlign.Center).width('100%') + } + .commLabelStyle() + }.margin({ bottom: 10 * this.ratio }) + } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/compontents/faceCompareByhaikang.ets b/entry/src/main/ets/pages/compontents/faceCompareByhaikang.ets index 5679e07..986db4a 100644 --- a/entry/src/main/ets/pages/compontents/faceCompareByhaikang.ets +++ b/entry/src/main/ets/pages/compontents/faceCompareByhaikang.ets @@ -26,7 +26,7 @@ const PERMISSIONS: Array = [ 'ohos.permission.CAMERA'] @Component -struct FaceCompare { +export default struct FaceCompare { constructor() { super() } @@ -45,7 +45,7 @@ struct FaceCompare { private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发 private vocObj = null; @State callBackFlag:boolean=false; - @State @Watch('changefaceCompareSucess') showFaceCompare2: Boolean = false; + @State @Watch('changeFaceCompareSuccess') showFaceCompare2: Boolean = false; private surfaceId: string = ''; @State video_url: string = 'rtsp://admin:12345qwe@192.168.5.41:8000/h264/ch2/main/av_stream' @@ -209,7 +209,7 @@ struct FaceCompare { // this.cameraModel.initCamera(this.surfaceId); } - changefaceCompareSucess(){ + changeFaceCompareSuccess(){ this.callBackFlag=false clearInterval(this.interval) this.vocObj&&this.vocObj.releasePlayer() @@ -554,4 +554,3 @@ struct FaceCompare { } } -export default FaceCompare \ No newline at end of file diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json index dbd1da5..bde90c0 100644 --- a/entry/src/main/resources/base/profile/main_pages.json +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -8,9 +8,7 @@ "pages/Settings", "pages/TerminalInfo", "pages/VideoConfig", - "pages/Hello", "pages/Judge", - "pages/SignalDisplay", "pages/SignDisplay", "pages/RealTime" ],