Merge remote-tracking branch 'origin/api10' into api10

This commit is contained in:
lixiao 2025-02-12 09:03:01 +08:00
commit 49461428ab
9 changed files with 102 additions and 54 deletions

View File

@ -239,6 +239,7 @@ export function fillZero(str, len) {
return zeroStr + str; return zeroStr + str;
} }
// 字符串转字节
export function string2Bytes(number, len) { export function string2Bytes(number, len) {
let str = (Math.floor(+number)).toString(2); let str = (Math.floor(+number)).toString(2);
if (str.length > len) { if (str.length > len) {

View File

@ -0,0 +1,6 @@
export interface UserLoginType {
carId: string;
examinationRoomId: string;
username: string;
password: string;
}

View File

@ -0,0 +1,15 @@
export interface NetworkConfigType {
udplocalIp: string;
udplocalIpPort: string;
udpOppositeIp: string;
udpOppositeIpPort: string;
tcplocalIp: string;
tcplocalIpPort: string;
tcpOppositeIp: string;
tcpOppositePort: string;
netMask: string;
gateway: string;
dnsServers: string;
centerIp: string;
centerPort: string;
}

View File

@ -0,0 +1,29 @@
export interface SckType {
xmdm: number,
kfdm: string
}
export interface SystemParamType {
Param341: boolean; // 是否按顺序考试
Param803Str: string; // 开始考试前必须解开安全带或关车门
Param612Str: string; // 开始考试触发方式
Param770Str: string; // 车上没有缺考功能
Param305Str: string; // 视频保存天数
Param352Str: string; // 车上考试过一次就不能缺考
Param828Str: string; // 828考生待考界面安全员显示考试员
Param830Str: string; // 同一学员连续第二次考试时不再验证身份
Param364: string; // 考前上车准备
Param398: string; // 考前上车准备
}
export interface LabelBlockType {
label: string;
key: string;
}
export interface QKParamType {
id: number;
list: number[];
carNo: string;
placeId: string;
}

View File

@ -8,4 +8,6 @@ export * from "./Judge"
export * from "./Register" export * from "./Register"
export * from "./VideoConfig" export * from "./VideoConfig"
export * from "./UserInfo"

View File

@ -6,6 +6,8 @@ import promptAction from '@ohos.promptAction';
import errorMsgDialog from './compontents/errorMsgDialog'; import errorMsgDialog from './compontents/errorMsgDialog';
// import { voiceService } from '../common/service/voiceService'; // import { voiceService } from '../common/service/voiceService';
import imageBtn from './compontents/imageBtn'; import imageBtn from './compontents/imageBtn';
import { UserLoginType } from '../model/ExaminerLogin';
import { BusinessError } from '@ohos.base';
@Entry @Entry
@Component @Component
@ -44,7 +46,7 @@ struct Index {
Column() { Column() {
Text('请考官输入用户名密码').fontColor('#FFAD33').fontSize(36 * this.ratio) Text('请考官输入用户名密码').fontColor('#FFAD33').fontSize(36 * this.ratio)
Row() { Row() {
ForEach(this.inputPlaceholderArr, (item: any, index: number) => { ForEach(this.inputPlaceholderArr, (item: string, index: number) => {
Row() { Row() {
TextInput({ placeholder: `${item}`, text: this.inputTextArr[index] }) TextInput({ placeholder: `${item}`, text: this.inputTextArr[index] })
.fontSize(42 * this.ratio) .fontSize(42 * this.ratio)
@ -91,9 +93,9 @@ struct Index {
if (this.limit) { if (this.limit) {
return return
} }
const param = { const param: UserLoginType = {
carId: globalThis.carInfo.carId, carId: globalThis.carInfo.carId as string,
examinationRoomId: globalThis.carInfo.examinationRoomId, examinationRoomId: globalThis.carInfo.examinationRoomId as string,
username: this.inputTextArr[0], username: this.inputTextArr[0],
password: Md5.Instance.get_md5(this.inputTextArr[1]) password: Md5.Instance.get_md5(this.inputTextArr[1])
} }
@ -102,7 +104,8 @@ struct Index {
this.limit = true this.limit = true
console.log('carInfo', JSON.stringify(globalThis.carInfo)) console.log('carInfo', JSON.stringify(globalThis.carInfo))
try { try {
examinerLoginService(param).then(res => { // TODO
examinerLoginService(param).then((res: ESObject) => {
console.log('res?.examinerLoginRsp?.head?.resultCode', res?.examinerLoginRsp?.head?.resultCode, console.log('res?.examinerLoginRsp?.head?.resultCode', res?.examinerLoginRsp?.head?.resultCode,
JSON.stringify(res)) JSON.stringify(res))
this.errorDialog.close() this.errorDialog.close()
@ -127,7 +130,7 @@ struct Index {
globalThis.kgxm = res.examinerLoginRsp.body.name globalThis.kgxm = res.examinerLoginRsp.body.name
globalThis.username = this.inputTextArr[0] globalThis.username = this.inputTextArr[0]
}).catch(err => { }).catch((err: BusinessError) => {
console.log('jiangsong12', JSON.stringify(err)) console.log('jiangsong12', JSON.stringify(err))
this.errorDialog.close() this.errorDialog.close()
this.limit = false this.limit = false

View File

@ -5,7 +5,6 @@ import signDisplayCom from './compontents/signDisplayCom';
@Entry @Entry
@Component @Component
struct Index { struct Index {
@State signArr: Array<any> = []
@State sjxhColum: Array<SignalDataType> = SignalData; @State sjxhColum: Array<SignalDataType> = SignalData;
@State GPSColum: Array<SignalDataType> = GPSData @State GPSColum: Array<SignalDataType> = GPSData
@State ratio: number = 850 / 960 @State ratio: number = 850 / 960

View File

@ -1,10 +1,11 @@
import TopLogo from './compontents/TopLogo'; import TopLogo from './compontents/TopLogo';
import ethernet from '@ohos.net.ethernet'; import ethernet from '@ohos.net.ethernet';
import prompt from '@ohos.prompt';
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { GlobalConfig } from '../config'; import { GlobalConfig } from '../config';
import { NetworkConfigType } from '../model/TerminalInfos';
import Prompt from '@system.prompt';
@Entry @Entry
@ -31,9 +32,7 @@ struct Index {
@State @Watch('outClick') outFlag: boolean = false; @State @Watch('outClick') outFlag: boolean = false;
scroller: Scroller = new Scroller() scroller: Scroller = new Scroller()
// @State inputTextList2: string[] = ['192.168.36.139','20022'] // @State inputTextList2: string[] = ['192.168.36.139','20022']
private fileUtil: FileUtil
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private vocObj = null;
build() { build() {
Column() { Column() {
@ -89,7 +88,7 @@ struct Index {
Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(async () => { Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(async () => {
const fileUtil = new FileUtil(this.context) const fileUtil = new FileUtil(this.context)
const folderPath = await fileUtil.initFolder(`/config`); const folderPath = await fileUtil.initFolder(`/config`);
const param = { const param: NetworkConfigType = {
udplocalIp: this.inputTextList1[9], udplocalIp: this.inputTextList1[9],
udplocalIpPort: this.inputTextList1[10], udplocalIpPort: this.inputTextList1[10],
udpOppositeIp: this.inputTextList1[7], udpOppositeIp: this.inputTextList1[7],
@ -113,16 +112,14 @@ struct Index {
gateway: this.inputTextList1[5], //value.gateway网关 gateway: this.inputTextList1[5], //value.gateway网关
netMask: this.inputTextList1[4], //value.netMask网络掩码 netMask: this.inputTextList1[4], //value.netMask网络掩码
dnsServers: this.inputTextList1[6], dnsServers: this.inputTextList1[6],
// @ts-ignore
domain: ""
}, (error) => { }, (error) => {
if (error) { if (error) {
prompt.showToast({ Prompt.showToast({
message: '设置失败' + JSON.stringify(error), message: '设置失败' + JSON.stringify(error),
duration: 3000 duration: 3000
}); });
} else { } else {
prompt.showToast({ Prompt.showToast({
message: '设置成功', message: '设置成功',
duration: 3000 duration: 3000
}); });
@ -157,8 +154,8 @@ struct Index {
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
if (data === '' || data === undefined) { if (data === '' || data === undefined) {
} else { } else {
const result = JSON.parse(data) // TODO
console.log('tagtag', JSON.stringify(result)) const result: ESObject = JSON.parse(data)
this.inputTextList1[9] = result.udplocalIp this.inputTextList1[9] = result.udplocalIp
this.inputTextList1[10] = result.udplocalIpPort this.inputTextList1[10] = result.udplocalIpPort
this.inputTextList1[7] = result.udpOppositeIp this.inputTextList1[7] = result.udpOppositeIp

View File

@ -6,6 +6,7 @@ import { dateFormat, getCurrentHourTime, getCurrentTime, string2Bytes } from '..
import FaceCompare from './compontents/FaceCompare'; import FaceCompare from './compontents/FaceCompare';
import { writeObjectOut } from '../api/judge'; import { writeObjectOut } from '../api/judge';
import testNapi from '@ohos.idcard'; import testNapi from '@ohos.idcard';
import IDCardSDK from '@ohos.idcard';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import FilePhoto from './judgeSDK/utils/filePhoto'; import FilePhoto from './judgeSDK/utils/filePhoto';
@ -20,7 +21,7 @@ import errorMsgDialog from './compontents/errorMsgDialog';
import imageBtn from './compontents/imageBtn'; import imageBtn from './compontents/imageBtn';
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import DB, { ColumnType } from '../common/database/DbSql'; import DB, { ColumnType } from '../common/database/DbSql';
import { User } from '../model'; import { LabelBlockType, QKParamType, SckType, SystemParamType, User } from '../model';
@Entry @Entry
@Component @Component
@ -46,10 +47,7 @@ struct UserInfo {
@State isBoardPrePareSetPopupShow: boolean = false @State isBoardPrePareSetPopupShow: boolean = false
@State isLoadingPopupVisible: boolean = false; @State isLoadingPopupVisible: boolean = false;
@State loadingText: string = '正在认证监管信息,请稍后...' @State loadingText: string = '正在认证监管信息,请稍后...'
@State sczbkf: { @State sczbkf: SckType[] = []
xmdm: number,
kfdm: string
}[] = []
@State currentUser: User = EmptyCandidateObject @State currentUser: User = EmptyCandidateObject
@State dataList: Array<User> = [] @State dataList: Array<User> = []
@State list: Array<User> = [] @State list: Array<User> = []
@ -64,7 +62,7 @@ struct UserInfo {
//是否已经开始考试 //是否已经开始考试
@State isExamStart: boolean = false; @State isExamStart: boolean = false;
@State effectDate: string = ''; @State effectDate: string = '';
@State interval: any = null; @State interval: number = -1;
@State studentRefreshStatue: string = '0'; @State studentRefreshStatue: string = '0';
@State photo: string = 'data:image/bmp;base64,'; @State photo: string = 'data:image/bmp;base64,';
@State numCount: number = 0; @State numCount: number = 0;
@ -75,31 +73,19 @@ struct UserInfo {
@State faceFlag: string = '0'; @State faceFlag: string = '0';
@State FaceOpenStatue: string = '0'; //是否开启人脸识别 @State FaceOpenStatue: string = '0'; //是否开启人脸识别
@State faceCatchImg: string = '' @State faceCatchImg: string = ''
@State systemParam: systemParam = { @State systemParam: SystemParamType = {
'Param341': true, //是否按顺序考试 Param341: true,
'Param803Str': '0', //开始考试前必须解开安全带或关车门 Param803Str: '0',
'Param612Str': '0', //开始考试触发方式 Param612Str: '0',
'Param770Str': '0', //车上没有缺考功能 Param770Str: '0',
'Param305Str': '0', //视频保存天数 Param305Str: '0',
'Param352Str': '0', //车上考试过一次就不能缺考 Param352Str: '0',
'Param828Str': '0', //828考生待考界面安全员显示考试员 Param828Str: '0',
'Param830Str': '0', //同一学员连续第二次考试时不再验证身份 Param830Str: '0',
'Param364': '0', //考前上车准备 Param364: '0',
'Param398': '0', //考前上车准备 Param398: '0'
} }
@State startExam: boolean = false @State startExam: boolean = false
// 过程照片拍照
getPhoto = async (empty?: boolean) => {
const singlePlay = globalThis.singlePlay
//单机模式返回空照片
if (singlePlay) {
return ''
} else {
const { filePhoto } = this;
const photoBase64 = await filePhoto.getPhoto();
return photoBase64
}
}
//开始考试准备 //开始考试准备
prePareExam = async () => { prePareExam = async () => {
if (this.ksksLimit) { if (this.ksksLimit) {
@ -163,9 +149,20 @@ struct UserInfo {
}, },
) )
private filePhoto: FilePhoto private filePhoto: FilePhoto
// 过程照片拍照
getPhoto = async (empty?: boolean) => {
const singlePlay = globalThis.singlePlay
//单机模式返回空照片
if (singlePlay) {
return ''
} else {
const photoBase64 = await this.filePhoto.getPhoto();
return photoBase64
}
}
private avPlayer private avPlayer
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private labelBlocks = [ private labelBlocks: LabelBlockType[] = [
{ label: '考生姓名', key: 'xm' }, { label: '考生姓名', key: 'xm' },
{ label: '身份证号', key: 'sfzmhm' }, { label: '身份证号', key: 'sfzmhm' },
{ label: ' 流 水 号 ', key: 'lsh' }, { label: ' 流 水 号 ', key: 'lsh' },
@ -173,7 +170,6 @@ struct UserInfo {
{ label: '待考次数', key: 'kssycs' }, { label: '待考次数', key: 'kssycs' },
{ label: '考试员名', key: 'ksy2' }, { label: '考试员名', key: 'ksy2' },
] ]
private fileUtil: FileUtil
aboutToAppear() { aboutToAppear() {
this.fileUtil = new FileUtil(this.context) this.fileUtil = new FileUtil(this.context)
@ -345,7 +341,7 @@ struct UserInfo {
} }
} }
onReadCard(ret) { onReadCard(ret: IDCardSDK.IDCardInfo) {
console.info(`zzctest xx Read Card ret =${ret.status}`) console.info(`zzctest xx Read Card ret =${ret.status}`)
let thisVar = globalThis.indexComponent; let thisVar = globalThis.indexComponent;
@ -450,13 +446,13 @@ struct UserInfo {
//考点端查询缺考指令内容消息请求 //考点端查询缺考指令内容消息请求
getqkFn() { getqkFn() {
let tmpList = []; let tmpList: Array<number> = [];
tmpList.push(string2Bytes(globalThis.signNum, 1 * 8)[0]) tmpList.push(string2Bytes(globalThis.signNum, 1 * 8)[0])
const param = { const param: QKParamType = {
id: 41, id: 41,
list: tmpList, list: tmpList,
carNo: globalThis.carInfo.carNo, carNo: globalThis.carInfo.carNo as string,
placeId: globalThis.carInfo.examinationRoomId placeId: globalThis.carInfo.examinationRoomId as string
} }
globalThis.udpClient2.sendMsgExt(param, this.context) globalThis.udpClient2.sendMsgExt(param, this.context)
} }