diff --git a/entry/src/main/ets/common/utils/tools.ts b/entry/src/main/ets/common/utils/tools.ts index 52e5a377..e625ff54 100644 --- a/entry/src/main/ets/common/utils/tools.ts +++ b/entry/src/main/ets/common/utils/tools.ts @@ -239,6 +239,7 @@ export function fillZero(str, len) { return zeroStr + str; } +// 字符串转字节 export function string2Bytes(number, len) { let str = (Math.floor(+number)).toString(2); if (str.length > len) { diff --git a/entry/src/main/ets/model/ExaminerLogin.ets b/entry/src/main/ets/model/ExaminerLogin.ets index e69de29b..956caf9e 100644 --- a/entry/src/main/ets/model/ExaminerLogin.ets +++ b/entry/src/main/ets/model/ExaminerLogin.ets @@ -0,0 +1,6 @@ +export interface UserLoginType { + carId: string; + examinationRoomId: string; + username: string; + password: string; +} \ No newline at end of file diff --git a/entry/src/main/ets/model/TerminalInfos.ets b/entry/src/main/ets/model/TerminalInfos.ets index e69de29b..32e51b16 100644 --- a/entry/src/main/ets/model/TerminalInfos.ets +++ b/entry/src/main/ets/model/TerminalInfos.ets @@ -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; +} \ No newline at end of file diff --git a/entry/src/main/ets/model/UserInfo.ets b/entry/src/main/ets/model/UserInfo.ets index e69de29b..fb8e026c 100644 --- a/entry/src/main/ets/model/UserInfo.ets +++ b/entry/src/main/ets/model/UserInfo.ets @@ -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; +} diff --git a/entry/src/main/ets/model/index.ets b/entry/src/main/ets/model/index.ets index 6518e40c..2c15f4b4 100644 --- a/entry/src/main/ets/model/index.ets +++ b/entry/src/main/ets/model/index.ets @@ -8,4 +8,6 @@ export * from "./Judge" export * from "./Register" -export * from "./VideoConfig" \ No newline at end of file +export * from "./VideoConfig" + +export * from "./UserInfo" \ 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 cf201f6f..3aac391a 100644 --- a/entry/src/main/ets/pages/ExaminerLogin.ets +++ b/entry/src/main/ets/pages/ExaminerLogin.ets @@ -6,6 +6,8 @@ import promptAction from '@ohos.promptAction'; import errorMsgDialog from './compontents/errorMsgDialog'; // import { voiceService } from '../common/service/voiceService'; import imageBtn from './compontents/imageBtn'; +import { UserLoginType } from '../model/ExaminerLogin'; +import { BusinessError } from '@ohos.base'; @Entry @Component @@ -44,7 +46,7 @@ struct Index { Column() { Text('请考官输入用户名密码').fontColor('#FFAD33').fontSize(36 * this.ratio) Row() { - ForEach(this.inputPlaceholderArr, (item: any, index: number) => { + ForEach(this.inputPlaceholderArr, (item: string, index: number) => { Row() { TextInput({ placeholder: `${item}`, text: this.inputTextArr[index] }) .fontSize(42 * this.ratio) @@ -91,9 +93,9 @@ struct Index { if (this.limit) { return } - const param = { - carId: globalThis.carInfo.carId, - examinationRoomId: globalThis.carInfo.examinationRoomId, + const param: UserLoginType = { + carId: globalThis.carInfo.carId as string, + examinationRoomId: globalThis.carInfo.examinationRoomId as string, username: this.inputTextArr[0], password: Md5.Instance.get_md5(this.inputTextArr[1]) } @@ -102,7 +104,8 @@ struct Index { this.limit = true console.log('carInfo', JSON.stringify(globalThis.carInfo)) try { - examinerLoginService(param).then(res => { + // TODO + examinerLoginService(param).then((res: ESObject) => { console.log('res?.examinerLoginRsp?.head?.resultCode', res?.examinerLoginRsp?.head?.resultCode, JSON.stringify(res)) this.errorDialog.close() @@ -127,7 +130,7 @@ struct Index { globalThis.kgxm = res.examinerLoginRsp.body.name globalThis.username = this.inputTextArr[0] - }).catch(err => { + }).catch((err: BusinessError) => { console.log('jiangsong12', JSON.stringify(err)) this.errorDialog.close() this.limit = false diff --git a/entry/src/main/ets/pages/SignDisplay.ets b/entry/src/main/ets/pages/SignDisplay.ets index 825a8a1a..8ea6f3c4 100644 --- a/entry/src/main/ets/pages/SignDisplay.ets +++ b/entry/src/main/ets/pages/SignDisplay.ets @@ -5,7 +5,6 @@ import signDisplayCom from './compontents/signDisplayCom'; @Entry @Component struct Index { - @State signArr: Array = [] @State sjxhColum: Array = SignalData; @State GPSColum: Array = GPSData @State ratio: number = 850 / 960 diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index 559763a9..1850c2b6 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -1,10 +1,11 @@ import TopLogo from './compontents/TopLogo'; import ethernet from '@ohos.net.ethernet'; -import prompt from '@ohos.prompt'; import FileUtil from '../common/utils/File'; import common from '@ohos.app.ability.common'; import { GlobalConfig } from '../config'; +import { NetworkConfigType } from '../model/TerminalInfos'; +import Prompt from '@system.prompt'; @Entry @@ -31,9 +32,7 @@ struct Index { @State @Watch('outClick') outFlag: boolean = false; scroller: Scroller = new Scroller() // @State inputTextList2: string[] = ['192.168.36.139','20022'] - private fileUtil: FileUtil private context = getContext(this) as common.UIAbilityContext; - private vocObj = null; build() { Column() { @@ -89,7 +88,7 @@ struct Index { Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(async () => { const fileUtil = new FileUtil(this.context) const folderPath = await fileUtil.initFolder(`/config`); - const param = { + const param: NetworkConfigType = { udplocalIp: this.inputTextList1[9], udplocalIpPort: this.inputTextList1[10], udpOppositeIp: this.inputTextList1[7], @@ -113,16 +112,14 @@ struct Index { gateway: this.inputTextList1[5], //value.gateway网关 netMask: this.inputTextList1[4], //value.netMask网络掩码 dnsServers: this.inputTextList1[6], - // @ts-ignore - domain: "" }, (error) => { if (error) { - prompt.showToast({ + Prompt.showToast({ message: '设置失败' + JSON.stringify(error), duration: 3000 }); } else { - prompt.showToast({ + Prompt.showToast({ message: '设置成功', duration: 3000 }); @@ -157,8 +154,8 @@ struct Index { const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); if (data === '' || data === undefined) { } else { - const result = JSON.parse(data) - console.log('tagtag', JSON.stringify(result)) + // TODO + const result: ESObject = JSON.parse(data) this.inputTextList1[9] = result.udplocalIp this.inputTextList1[10] = result.udplocalIpPort this.inputTextList1[7] = result.udpOppositeIp diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 2d22331e..ebae87fe 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -6,6 +6,7 @@ import { dateFormat, getCurrentHourTime, getCurrentTime, string2Bytes } from '.. import FaceCompare from './compontents/FaceCompare'; import { writeObjectOut } from '../api/judge'; import testNapi from '@ohos.idcard'; +import IDCardSDK from '@ohos.idcard'; import common from '@ohos.app.ability.common'; import promptAction from '@ohos.promptAction'; import FilePhoto from './judgeSDK/utils/filePhoto'; @@ -20,7 +21,7 @@ import errorMsgDialog from './compontents/errorMsgDialog'; import imageBtn from './compontents/imageBtn'; import FileUtil from '../common/utils/File'; import DB, { ColumnType } from '../common/database/DbSql'; -import { User } from '../model'; +import { LabelBlockType, QKParamType, SckType, SystemParamType, User } from '../model'; @Entry @Component @@ -46,10 +47,7 @@ struct UserInfo { @State isBoardPrePareSetPopupShow: boolean = false @State isLoadingPopupVisible: boolean = false; @State loadingText: string = '正在认证监管信息,请稍后...' - @State sczbkf: { - xmdm: number, - kfdm: string - }[] = [] + @State sczbkf: SckType[] = [] @State currentUser: User = EmptyCandidateObject @State dataList: Array = [] @State list: Array = [] @@ -64,7 +62,7 @@ struct UserInfo { //是否已经开始考试 @State isExamStart: boolean = false; @State effectDate: string = ''; - @State interval: any = null; + @State interval: number = -1; @State studentRefreshStatue: string = '0'; @State photo: string = 'data:image/bmp;base64,'; @State numCount: number = 0; @@ -75,31 +73,19 @@ struct UserInfo { @State faceFlag: string = '0'; @State FaceOpenStatue: string = '0'; //是否开启人脸识别 @State faceCatchImg: string = '' - @State systemParam: systemParam = { - 'Param341': true, //是否按顺序考试 - 'Param803Str': '0', //开始考试前必须解开安全带或关车门 - 'Param612Str': '0', //开始考试触发方式 - 'Param770Str': '0', //车上没有缺考功能 - 'Param305Str': '0', //视频保存天数 - 'Param352Str': '0', //车上考试过一次就不能缺考 - 'Param828Str': '0', //828考生待考界面,安全员显示考试员 - 'Param830Str': '0', //同一学员连续第二次考试时不再验证身份 - 'Param364': '0', //考前上车准备 - 'Param398': '0', //考前上车准备 + @State systemParam: SystemParamType = { + Param341: true, + Param803Str: '0', + Param612Str: '0', + Param770Str: '0', + Param305Str: '0', + Param352Str: '0', + Param828Str: '0', + Param830Str: '0', + Param364: '0', + Param398: '0' } @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 () => { if (this.ksksLimit) { @@ -163,9 +149,20 @@ struct UserInfo { }, ) 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 context = getContext(this) as common.UIAbilityContext; - private labelBlocks = [ + private labelBlocks: LabelBlockType[] = [ { label: '考生姓名', key: 'xm' }, { label: '身份证号', key: 'sfzmhm' }, { label: ' 流 水 号 ', key: 'lsh' }, @@ -173,7 +170,6 @@ struct UserInfo { { label: '待考次数', key: 'kssycs' }, { label: '考试员名', key: 'ksy2' }, ] - private fileUtil: FileUtil aboutToAppear() { 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}`) let thisVar = globalThis.indexComponent; @@ -450,13 +446,13 @@ struct UserInfo { //考点端查询缺考指令内容消息请求 getqkFn() { - let tmpList = []; + let tmpList: Array = []; tmpList.push(string2Bytes(globalThis.signNum, 1 * 8)[0]) - const param = { + const param: QKParamType = { id: 41, list: tmpList, - carNo: globalThis.carInfo.carNo, - placeId: globalThis.carInfo.examinationRoomId + carNo: globalThis.carInfo.carNo as string, + placeId: globalThis.carInfo.examinationRoomId as string } globalThis.udpClient2.sendMsgExt(param, this.context) }