fix: 修改部分错误

This commit is contained in:
wangzhongjie 2025-02-18 13:22:38 +08:00
parent f041e2a8bb
commit c4856b956f
8 changed files with 173 additions and 193 deletions

View File

@ -1,5 +1,6 @@
import request from '../utils/Request'
import http from '@ohos.net.http'
import { FaceCompareResp } from '../model'
/**
* 照片比对
@ -20,7 +21,7 @@ interface FaceCompareParams {
}
export async function faceCompare(params: FaceCompareParams) {
return request<object>({
return request<FaceCompareResp>({
url: '/der2/services/imageCompare/base64ImageStrCompare.ws',
data: `<?xml version="1.0" encoding="UTF-8" ?>
<imageCompareReq>

View File

@ -22,6 +22,7 @@ export interface CarInfoType {
carId?: string;
examinationRoomId?: string;
plateNo?: string;
carNo?: string;
}

View File

@ -3,3 +3,11 @@ export interface AmplifyItem {
projectCode: string;
projectCodeCenter: string;
}
export interface UDPParamType {
id?: number;
list?: number[];
carNo?: string;
placeId?: string;
sendCallback?: () => void;
}

View File

@ -12,3 +12,10 @@ interface Head {
resultMessage: string;
}
export interface FaceCompareResp {
imageCompareRsp: ImageCompareRsp
}
interface ImageCompareRsp {
head: Head;
}

View File

@ -7,8 +7,14 @@ import { string2Bytes } from '../../common/utils/tools';
import { takePhoto } from '../../service/videoService';
import { GlobalConfig } from '../../config/index';
import { VideoConfigData } from '../../mock';
import { VideoConfig } from '../../model';
import App from '@system.app';
import { CarInfoType, UDPParamType, VideoConfig } from '../../model';
interface ParamType {
id?: number;
list?: number[];
carNo?: string | undefined;
placeId?: string | undefined;
}
@Component
export default struct FaceCompare {
@ -30,13 +36,13 @@ export default struct FaceCompare {
@State showControls: boolean = false
@State isAutoPlay: boolean = true
@State signNum: number = 0;
@State carinfo: object = {};
@State carInfo: CarInfoType = {};
@State param: VideoConfig = VideoConfigData
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对需要点击重新打开重新触发
private vocObj = null;
private vocObj: voiceService = null;
private controller: VideoController = new VideoController()
private fileUtil: FileUtil
private interval: any
private interval: number = -1
private context = getContext(this) as common.UIAbilityContext;
constructor() {
@ -152,8 +158,6 @@ export default struct FaceCompare {
this.showFaceCompareFlag = !this.showFaceCompareFlag
this.faceCompareSucess = -1
AppStorage.setOrCreate('statue', 2)
})
}
.width('100%')
@ -179,13 +183,13 @@ export default struct FaceCompare {
}
getqkFn() {
let tmpList = [];
let tmpList: number[] = [];
tmpList.push(string2Bytes(AppStorage.get('signNum'), 1 * 8)[0])
const param = {
const param: ParamType = {
id: 41,
list: tmpList,
carNo: this.carInfo.carNo,
placeId: this.carInfo.examinationRoomId
carNo: this.carInfo?.carNo as string,
placeId: this.carInfo?.examinationRoomId
}
globalThis.udpClient2.sendMsgExt(param, this.context)
}
@ -200,12 +204,11 @@ export default struct FaceCompare {
sfzh: this.sfzh,
firstImage: this.firstImage.substr(22),
secondImage: data.base64,
type: 2,
verifyType: 1
type: "2",
verifyType: "1"
})
.then(res => {
console.log('mmmmm8', JSON.stringify(res))
// @ts-ignore
if (res.imageCompareRsp.head.resultCode == '0') {
this.controller.stop()
this.showFaceCompare = !this.showFaceCompare
@ -231,14 +234,13 @@ export default struct FaceCompare {
}
async heartMsg(context) {
let tmpList = []
async heartMsg() {
let tmpList: number[] = []
const str = this.lsh
console.log('this.lshbitbit', this.lsh, this.carInfo.carNo, this.carInfo.examinationRoomId)
for (let i = 0; i < str.length; i++) {
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
}
const param = {
const param: UDPParamType = {
id: 46,
list: tmpList,
carNo: this.carInfo.carNo,
@ -251,7 +253,7 @@ export default struct FaceCompare {
clearInterval(this.interval)
this.interval = setInterval(() => {
if (this.callBackFlag) {
const param2 = {
const param2: UDPParamType = {
id: 47,
list: tmpList,
carNo: this.carInfo.carNo,
@ -285,7 +287,7 @@ export default struct FaceCompare {
async getVideoConfig() {
console.log('faceEnterIn')
this.vocObj = new voiceService(async (status, val, next) => {
this.vocObj = new voiceService(async (status: string, val: string) => {
if (status == 'idle') {
if (val == 'face_check.mp3' || val == 'face_fail.mp3') {
if (this.times >= 3) {

View File

@ -2,16 +2,16 @@ import router from '@ohos.router';
@CustomDialog
export default struct errorMsgDialog {
private controller?: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
dialogRatio: number = 0.8
title?: string
type: string //1 tip 2loading 3Dialog
@State angle: number = 0
@State ratio: number = 1700 / 960
private controller?: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
@Styles
commStyle(){
@ -54,7 +54,7 @@ export default struct errorMsgDialog {
.commStyle()
.onClick(() => {
if (this.controller != undefined) {
const errorCode=AppStorage.Get('errorMsg');
const errorCode: number = AppStorage.get('errorMsg');
// const errorCodeFlage=AppStorage.Get('errorCodeFlage');
// console.log('errorCode',errorCode,errorCodeFlage)
if (errorCode == 0) {
@ -77,8 +77,8 @@ export default struct errorMsgDialog {
}
.commStyle()
.onClick(() => {
const errorCode=AppStorage.Get('errorCode');
const errorCodeFlage=AppStorage.Get('errorCodeFlage');
const errorCode: number = AppStorage.get('errorCode');
const errorCodeFlage: string = AppStorage.get('errorCodeFlage');
console.log('errorCode', errorCode, errorCodeFlage)
if (errorCode == 0 && errorCodeFlage) {
router.replaceUrl({
@ -101,8 +101,7 @@ export default struct errorMsgDialog {
.padding({ bottom: 20 })
}
}
.
backgroundColor('#E6E3DF')
.backgroundColor('#E6E3DF')
.borderRadius(19 * this.ratio)
.constraintSize({ minWidth: 520 })
}

View File

@ -5,7 +5,7 @@ import common from '@ohos.app.ability.common';
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
import { getCurrentTime } from '../../../common/utils/tools';
import { MarkRule, SYSSET } from '../../judgeSDK/api/judgeSDK.d';
import { uploadExamProgressData, writeObjectOut } from '../../../api/judge';
import { writeObjectOut } from '../../../api/judge';
import JudgeTask from '../../judgeSDK/utils/judgeTask';
import FilePhoto from '../../judgeSDK/utils/filePhoto';
@ -17,10 +17,6 @@ interface SEL {
//考前模拟人工扣分
@Component
export default struct DeductedPopup {
private context = getContext(this) as common.UIAbilityContext;
private judgeTask: JudgeTask
private filePhoto: FilePhoto
private avPlayer
@State name: string = ''
@State idCard: string = ''
@State lsh: string = ''
@ -57,16 +53,25 @@ export default struct DeductedPopup {
@State selectedLine: number = undefined
@State carInfo: object = {}
@State singlePlay: boolean = false
private closePopup: Function = () => {
}
private confirmMark: Function = (itemno: number, serial: string) => {
}
private endLoading: Function = () => {
}
@State selectedLineStyle: SEL = {
fontColor: '#FFF',
bgColor: '#B36E00'
}
// 过程照片拍照
getPhoto = async (empty?: boolean) => {
//单机模式返回空照片
if (this.singlePlay) {
return ''
} else {
const { filePhoto } = this;
const photoBase64 = await filePhoto.getPhoto();
return photoBase64
}
}
private context = getContext(this) as common.UIAbilityContext;
private judgeTask: JudgeTask
private filePhoto: FilePhoto
private avPlayer
async aboutToAppear() {
this.carInfo = AppStorage.get('carInfo')
@ -112,18 +117,6 @@ export default struct DeductedPopup {
await this.initStudent()
}
// 过程照片拍照
getPhoto = async (empty?: boolean) => {
//单机模式返回空照片
if (this.singlePlay) {
return ''
} else {
const {filePhoto} = this;
const photoBase64 = await filePhoto.getPhoto();
return photoBase64
}
}
// 扣分操作
async pointsDedute() {
const index = this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex;
@ -179,7 +172,8 @@ export default struct DeductedPopup {
}
;
let voiceURL = score < 90 ? `voice/${kssycs == '1' ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3` : 'voice/exam_pass.mp3'
let voiceURL =
score < 90 ? `voice/${kssycs == '1' ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3` : 'voice/exam_pass.mp3'
let kfScore = 0;
if (kfdmArr.length) {
@ -214,7 +208,9 @@ export default struct DeductedPopup {
const { serialNumber, lsh, idCard, ksxl, kslx, ksdd } = this
const time = await getCurrentTime();
const beginData = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C52',
xtlb: '17',
jkxlh: serialNumber,
jkid: '17C52',
drvexam: {
// 考试科目 身份证号码
lsh,
@ -244,7 +240,9 @@ export default struct DeductedPopup {
console.info('surenjun uploadProgressPhoto',)
const photoBase64 = await getPhoto()
const photoData = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C54',
xtlb: '17',
jkxlh: serialNumber,
jkid: '17C54',
drvexam: {
lsh,
kskm: examSubject,
@ -272,7 +270,9 @@ export default struct DeductedPopup {
const { examSubject } = carInfo;
const time = await getCurrentTime();
const kfData = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C53',
xtlb: '17',
jkxlh: serialNumber,
jkid: '17C53',
drvexam: {
lsh,
kskm: examSubject,
@ -297,7 +297,9 @@ export default struct DeductedPopup {
const { lsh, idCard, serialNumber, ksdd, kslx, ksxl, } = this;
const time = await getCurrentTime();
const endProjectData = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C55',
xtlb: '17',
jkxlh: serialNumber,
jkid: '17C55',
drvexam: {
lsh,
kskm: examSubject,
@ -322,7 +324,9 @@ export default struct DeductedPopup {
const time = await getCurrentTime();
const photoBase64 = await getPhoto();
const endData = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C56',
xtlb: '17',
jkxlh: serialNumber,
jkid: '17C56',
drvexam: {
lsh,
kchp: decodeURI(plateNo),
@ -477,7 +481,8 @@ export default struct DeductedPopup {
Row() {
if (
(Math.ceil(this.universalMarkRules.length / 7 - 1)) >= (this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) &&
(Math.ceil(this.universalMarkRules.length / 7 - 1)) >=
(this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) &&
(this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) > 0
) {
Row() {
@ -499,7 +504,8 @@ export default struct DeductedPopup {
}
if (
(Math.ceil(this.universalMarkRules.length / 7 - 1)) > (this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex)
(Math.ceil(this.universalMarkRules.length / 7 - 1)) >
(this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex)
) {
Row() {
Text('下一页') {
@ -560,7 +566,12 @@ export default struct DeductedPopup {
.height(710)
.position({ x: '10%', y: '10%' })
.backgroundColor('#E6E3DF')
.padding({ top: 15, bottom: 15, left: 25, right: 25 })
.padding({
top: 15,
bottom: 15,
left: 25,
right: 25
})
.borderRadius(20)
Row() {
@ -581,4 +592,13 @@ export default struct DeductedPopup {
})
}.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.7)')
}
private closePopup: Function = () => {
}
private confirmMark: Function = (itemno: number, serial: string) => {
}
private endLoading: Function = () => {
}
}

View File

@ -1,58 +0,0 @@
import Prompt from '@system.prompt'
const TAG = 'SURENJUN_JUDGE'
interface QUEUE{
fn:Function,
config?:{
isDelay:boolean
delayTime:number
}
}
export default class JudgeTask{
private queue = []
private status:string
constructor() {
this.queue = []
this.status = 'end'
}
executeQueue = async ()=>{
const {queue,executeQueue} = this
if(queue.length){
for (const currentTask of queue) {
const {fn,delayConfig:{
isDelay = false,
delayTime = 1000
}} = currentTask;
const {status} = this
try {
isDelay
?setTimeout(async ()=>{await fn()})
:await fn();
}catch (e){
// console.info(TAG,'过程数据接口解析错误')
Prompt.showToast({
message: '过程数据接口解析错误',
duration: 3000
});
}
this.queue.shift()
await executeQueue()
}
}else{
this.status = 'end'
}
}
addTask = async (fn,delayConfig?:{
isDelay:Boolean,
delayTime:Number
}) =>{
this.queue.push({fn,delayConfig});
if(this.status == 'end' && this.queue.length === 1){
await this.executeQueue();
}
}
}