fix:修复一个写法问题

This commit is contained in:
wangzhongjie 2024-07-02 10:42:53 +08:00
parent 273a411f83
commit b82d3ff6bc
2 changed files with 852 additions and 779 deletions

View File

@ -1,22 +1,21 @@
import { getExaminationItem, getExaminationStudentInfo, examinationStuAbsent, getPhotosForOther } from '../api/userInfo'
import router from '@ohos.router'
import TopLogo from './compontents/TopLogo'
import { examinationStuAbsent, getExaminationItem, getExaminationStudentInfo } from '../api/userInfo';
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';
import { dateFormat, getCurrentTime } from '../common/utils/tools';
import { dateFormat, getCurrentTime, string2Bytes } from '../common/utils/tools';
import MA_SYSSET from '../common//constants/MA_SYSSET';
import FaceCompare from './compontents/FaceCompare'
import FaceCompare from './compontents/FaceCompare';
// import { initJudgeUdp } from '../common/utils/UdpJudge'
import { writeObjectOut } from '../api/judge'
import testNapi from "@ohos.idcard";
import { writeObjectOut } from '../api/judge';
import testNapi from '@ohos.idcard';
import common from '@ohos.app.ability.common';
import { User } from './interfaces'
import WebRTCVoice from './webRTC/'
import promptAction from '@ohos.promptAction'
import { CandidateData, EmptyCandidateObject } from "../mock/CandidateData"
import {string2Bytes} from '../common/utils/tools'
import { getSyncData } from '../common/service/initable'
import { User } from './interfaces';
import WebRTCVoice from './webRTC/';
import promptAction from '@ohos.promptAction';
import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData';
@Entry
@Component
struct UserInfo {
@ -38,9 +37,6 @@ struct UserInfo {
@State currentUser: User = EmptyCandidateObject
@State dataList: Array<User> = []
@State list: Array<User> = []
private AccountTable = new AccountTable(() => {
}, USER);
private context = getContext(this) as common.UIAbilityContext;
@State name: string = 'initName';
@State sex: string = '';
@State callBackFlag: boolean = false;
@ -57,9 +53,20 @@ struct UserInfo {
@State signNum: number = 0;
@State isCanClick: boolean = true;
@State faceFlag: string = '0';
@State FaceOpenStatue: string = '0';//是否开启人脸识别
@State FaceOpenStatue: string = '0'; //是否开启人脸识别
subscriber;
@State faceCatchImg: string = ''
private AccountTable = new AccountTable(() => {
}, USER);
private context = getContext(this) as common.UIAbilityContext;
private labelBlocks = [
{ label: '考生姓名', key: 'xm' },
{ label: '身份证号', key: 'sfzmhm' },
{ label: ' 流 水 号 ', key: 'lsh' },
{ label: '考试路线', key: 'kslx' },
{ label: '待考次数', key: 'kssycs' },
{ label: '考官姓名', key: 'ksy1' },
]
async onPageShow() {
//语音功能
@ -75,8 +82,9 @@ struct UserInfo {
this.heartMsg()
}
//身份证读卡器初始化
openDeviceByIDCard(){
openDeviceByIDCard() {
globalThis.indexComponent = this;
// 应用启动时打开读卡设备
let ret = testNapi.OpenDevice();
@ -86,11 +94,13 @@ struct UserInfo {
console.error("zzctest Failed to Open Device");
}
}
stopDeviceById(){
if(this.faceFlag=='1'){
testNapi&&testNapi.StopReadCard()
stopDeviceById() {
if (this.faceFlag == '1') {
testNapi && testNapi.StopReadCard()
}
}
// 通过身份证获取当前学员
getCurrentStudent(id) {
let flag = false
@ -126,6 +136,7 @@ struct UserInfo {
});
}
}
onReadCard(ret) {
console.info(`zzctest xx Read Card ret =${ret.status}`)
let thisVar = globalThis.indexComponent;
@ -182,7 +193,8 @@ struct UserInfo {
changeQkfn() {
this.qkFn()
}
initData(){
initData() {
this.stepFlag = false
this.faceCompareSucess = 0
this.showFaceCompare = false
@ -207,21 +219,22 @@ struct UserInfo {
}
async heartMsg() {
globalThis.udpClient2&globalThis.udpClient2.setMsgCallBack((val)=>{
if(val.id=='32'){
globalThis.signNum=val.body[1]
if(val.body[0]=='7'){
globalThis.udpClient2 & globalThis.udpClient2.setMsgCallBack((val) => {
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=='42'){
} else if (val.id == '42') {
//收到中心缺考确认消息
console.log('qkfnqkfn',val.body[0])
console.log('qkfnqkfn', val.body[0])
this.qkFn()
}
})
}
//考点端查询缺考指令内容消息请求
getqkFn() {
let tmpList = [];
@ -236,8 +249,6 @@ struct UserInfo {
globalThis.udpClient2.sendMsg(param, this.context)
}
async initSysset() {
const that = this;
const db = new AccountTable(() => {
@ -251,13 +262,13 @@ struct UserInfo {
const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452')
that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0'
const faceParam = syssetParams.filter(sys => sys.v_no === '2313')
that.FaceOpenStatue =faceParam?.[0]?.v_value=='3'? '1':'0'
that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0'
that.FaceOpenStatue = '0'
console.log('that.FaceOpenStatue',that.FaceOpenStatue)
console.log('that.FaceOpenStatue', that.FaceOpenStatue)
// faceParam?.[0]?.v_value ||
// 1身份证读卡器 2指纹 3人脸
this.faceFlag=faceParam?.[0]?.v_value ||'0'
if(faceParam?.[0]?.v_value=='1'){
this.faceFlag = faceParam?.[0]?.v_value || '0'
if (faceParam?.[0]?.v_value == '1') {
that.openDeviceByIDCard()
}
//0不自动更新 1自动更新不限次数 2没有考生更新2次
@ -276,18 +287,19 @@ struct UserInfo {
that.getExaminationStudentInfoFn()
}
}, 5000)
}else{
} else {
this.getExaminationItemFn()
}
})
})
}
//人脸比对窗口关闭
//人脸比对窗口关闭
changeFaceCompareSuccess() {
console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser))
if (this.faceCompareSucess > 0) {
//人脸比对通过
//人脸比对通过
this.sfbdinterfaceFn()
}
}
@ -307,7 +319,8 @@ struct UserInfo {
this.pageIndex--;
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
}
//获取下载考生
//获取下载考生
getExaminationStudentInfoFn() {
if (globalThis.singlePlay) {
return
@ -360,6 +373,7 @@ struct UserInfo {
console.log('error12error' + error)
})
}
qkFn() {
this.faceCompareSucess = 0
if (globalThis.singlePlay) {
@ -396,9 +410,10 @@ struct UserInfo {
})
}
async getExaminationItemFn(){
async getExaminationItemFn() {
console.info('surenjun', this.currentUser.lsh)
if(!this.currentUser.lsh||globalThis.singlePlay){
if (!this.currentUser.lsh || globalThis.singlePlay) {
return
}
const carInfo = globalThis.carInfo;
@ -409,14 +424,15 @@ struct UserInfo {
lsh: this.currentUser.lsh || '',
examinationRoomId
});
if(examItems?.getExaminationItemRsp?.body?.kssycs!=0){
if (examItems?.getExaminationItemRsp?.body?.kssycs != 0) {
this.getExaminationStudentInfoFn()
}else{
this.dataList=[]
} else {
this.dataList = []
this.currentUser = EmptyCandidateObject
}
}
//身份比对
async sfbdinterfaceFn() {
this.stepFlag = true
@ -441,7 +457,7 @@ struct UserInfo {
ksxtbh: this.ksxtbh || '222',
sfzmhm: this.currentUser.sfzmhm || '',
ksysfzmhm: this.currentUser.ksy1sfzmhm || '',
zp: encodeURIComponent((this.faceCatchImg||this.currentUser.kszp.substr(22)) || ''),
zp: encodeURIComponent((this.faceCatchImg || this.currentUser.kszp.substr(22)) || ''),
kssj: dateFormat(date) || '',
kchp: decodeURI(plateNo),
Ksy2sfzmhm: this.currentUser.ksy2sfzmhm || ''
@ -491,14 +507,18 @@ struct UserInfo {
this.stepFlag = false
}
}
aboutToDisappear() {
this.outClick()
}
outClick() {
clearInterval(this.interval)
this.stopDeviceById()
globalThis.udpClient2&&globalThis.udpClient2?.setMsgCallBack(()=>{})
globalThis.udpClient2 && globalThis.udpClient2?.setMsgCallBack(() => {
})
}
// 几个按钮公共样式
@Styles
commStyle(){
@ -509,15 +529,6 @@ struct UserInfo {
.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 })
@ -656,9 +667,9 @@ struct UserInfo {
})
return
}
if(this.FaceOpenStatue!='0'){
if (this.FaceOpenStatue != '0') {
this.showFaceCompare = true
}else{
} else {
this.sfbdinterfaceFn()
}
})

File diff suppressed because it is too large Load Diff