fix: 修改部分错误
This commit is contained in:
parent
f041e2a8bb
commit
c4856b956f
@ -1,5 +1,6 @@
|
|||||||
import request from '../utils/Request'
|
import request from '../utils/Request'
|
||||||
import http from '@ohos.net.http'
|
import http from '@ohos.net.http'
|
||||||
|
import { FaceCompareResp } from '../model'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 照片比对
|
* 照片比对
|
||||||
@ -20,7 +21,7 @@ interface FaceCompareParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function faceCompare(params: FaceCompareParams) {
|
export async function faceCompare(params: FaceCompareParams) {
|
||||||
return request<object>({
|
return request<FaceCompareResp>({
|
||||||
url: '/der2/services/imageCompare/base64ImageStrCompare.ws',
|
url: '/der2/services/imageCompare/base64ImageStrCompare.ws',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<imageCompareReq>
|
<imageCompareReq>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ export interface CarInfoType {
|
|||||||
carId?: string;
|
carId?: string;
|
||||||
examinationRoomId?: string;
|
examinationRoomId?: string;
|
||||||
plateNo?: string;
|
plateNo?: string;
|
||||||
|
carNo?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,3 +3,11 @@ export interface AmplifyItem {
|
|||||||
projectCode: string;
|
projectCode: string;
|
||||||
projectCodeCenter: string;
|
projectCodeCenter: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UDPParamType {
|
||||||
|
id?: number;
|
||||||
|
list?: number[];
|
||||||
|
carNo?: string;
|
||||||
|
placeId?: string;
|
||||||
|
sendCallback?: () => void;
|
||||||
|
}
|
||||||
@ -12,3 +12,10 @@ interface Head {
|
|||||||
resultMessage: string;
|
resultMessage: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FaceCompareResp {
|
||||||
|
imageCompareRsp: ImageCompareRsp
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImageCompareRsp {
|
||||||
|
head: Head;
|
||||||
|
}
|
||||||
@ -7,8 +7,14 @@ import { string2Bytes } from '../../common/utils/tools';
|
|||||||
import { takePhoto } from '../../service/videoService';
|
import { takePhoto } from '../../service/videoService';
|
||||||
import { GlobalConfig } from '../../config/index';
|
import { GlobalConfig } from '../../config/index';
|
||||||
import { VideoConfigData } from '../../mock';
|
import { VideoConfigData } from '../../mock';
|
||||||
import { VideoConfig } from '../../model';
|
import { CarInfoType, UDPParamType, VideoConfig } from '../../model';
|
||||||
import App from '@system.app';
|
|
||||||
|
interface ParamType {
|
||||||
|
id?: number;
|
||||||
|
list?: number[];
|
||||||
|
carNo?: string | undefined;
|
||||||
|
placeId?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default struct FaceCompare {
|
export default struct FaceCompare {
|
||||||
@ -30,13 +36,13 @@ export default struct FaceCompare {
|
|||||||
@State showControls: boolean = false
|
@State showControls: boolean = false
|
||||||
@State isAutoPlay: boolean = true
|
@State isAutoPlay: boolean = true
|
||||||
@State signNum: number = 0;
|
@State signNum: number = 0;
|
||||||
@State carinfo: object = {};
|
@State carInfo: CarInfoType = {};
|
||||||
@State param: VideoConfig = VideoConfigData
|
@State param: VideoConfig = VideoConfigData
|
||||||
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发
|
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发
|
||||||
private vocObj = null;
|
private vocObj: voiceService = null;
|
||||||
private controller: VideoController = new VideoController()
|
private controller: VideoController = new VideoController()
|
||||||
private fileUtil: FileUtil
|
private fileUtil: FileUtil
|
||||||
private interval: any
|
private interval: number = -1
|
||||||
private context = getContext(this) as common.UIAbilityContext;
|
private context = getContext(this) as common.UIAbilityContext;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -114,7 +120,7 @@ export default struct FaceCompare {
|
|||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
this.showFaceCompareFlag = !this.showFaceCompareFlag
|
this.showFaceCompareFlag = !this.showFaceCompareFlag
|
||||||
this.faceCompareSucess = -1
|
this.faceCompareSucess = -1
|
||||||
AppStorage.setOrCreate('statue',2)
|
AppStorage.setOrCreate('statue', 2)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.width('88.9%')
|
.width('88.9%')
|
||||||
@ -151,9 +157,7 @@ export default struct FaceCompare {
|
|||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
this.showFaceCompareFlag = !this.showFaceCompareFlag
|
this.showFaceCompareFlag = !this.showFaceCompareFlag
|
||||||
this.faceCompareSucess = -1
|
this.faceCompareSucess = -1
|
||||||
AppStorage.setOrCreate('statue',2)
|
AppStorage.setOrCreate('statue', 2)
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.width('100%')
|
.width('100%')
|
||||||
@ -167,7 +171,7 @@ export default struct FaceCompare {
|
|||||||
|
|
||||||
async aboutToAppear() {
|
async aboutToAppear() {
|
||||||
const fileUtil = new FileUtil(this.context)
|
const fileUtil = new FileUtil(this.context)
|
||||||
this.carInfo=AppStorage.get('carInfo')
|
this.carInfo = AppStorage.get('carInfo')
|
||||||
this.fileUtil = fileUtil
|
this.fileUtil = fileUtil
|
||||||
this.getVideoConfig()
|
this.getVideoConfig()
|
||||||
}
|
}
|
||||||
@ -179,13 +183,13 @@ export default struct FaceCompare {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getqkFn() {
|
getqkFn() {
|
||||||
let tmpList = [];
|
let tmpList: number[] = [];
|
||||||
tmpList.push(string2Bytes(AppStorage.get('signNum'), 1 * 8)[0])
|
tmpList.push(string2Bytes(AppStorage.get('signNum'), 1 * 8)[0])
|
||||||
const param = {
|
const param: ParamType = {
|
||||||
id: 41,
|
id: 41,
|
||||||
list: tmpList,
|
list: tmpList,
|
||||||
carNo: this.carInfo.carNo,
|
carNo: this.carInfo?.carNo as string,
|
||||||
placeId: this.carInfo.examinationRoomId
|
placeId: this.carInfo?.examinationRoomId
|
||||||
}
|
}
|
||||||
globalThis.udpClient2.sendMsgExt(param, this.context)
|
globalThis.udpClient2.sendMsgExt(param, this.context)
|
||||||
}
|
}
|
||||||
@ -200,12 +204,11 @@ export default struct FaceCompare {
|
|||||||
sfzh: this.sfzh,
|
sfzh: this.sfzh,
|
||||||
firstImage: this.firstImage.substr(22),
|
firstImage: this.firstImage.substr(22),
|
||||||
secondImage: data.base64,
|
secondImage: data.base64,
|
||||||
type: 2,
|
type: "2",
|
||||||
verifyType: 1
|
verifyType: "1"
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('mmmmm8', JSON.stringify(res))
|
console.log('mmmmm8', JSON.stringify(res))
|
||||||
// @ts-ignore
|
|
||||||
if (res.imageCompareRsp.head.resultCode == '0') {
|
if (res.imageCompareRsp.head.resultCode == '0') {
|
||||||
this.controller.stop()
|
this.controller.stop()
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
@ -231,14 +234,13 @@ export default struct FaceCompare {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async heartMsg(context) {
|
async heartMsg() {
|
||||||
let tmpList = []
|
let tmpList: number[] = []
|
||||||
const str = this.lsh
|
const str = this.lsh
|
||||||
console.log('this.lshbitbit', this.lsh, this.carInfo.carNo, this.carInfo.examinationRoomId)
|
|
||||||
for (let i = 0; i < str.length; i++) {
|
for (let i = 0; i < str.length; i++) {
|
||||||
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
|
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
|
||||||
}
|
}
|
||||||
const param = {
|
const param: UDPParamType = {
|
||||||
id: 46,
|
id: 46,
|
||||||
list: tmpList,
|
list: tmpList,
|
||||||
carNo: this.carInfo.carNo,
|
carNo: this.carInfo.carNo,
|
||||||
@ -251,7 +253,7 @@ export default struct FaceCompare {
|
|||||||
clearInterval(this.interval)
|
clearInterval(this.interval)
|
||||||
this.interval = setInterval(() => {
|
this.interval = setInterval(() => {
|
||||||
if (this.callBackFlag) {
|
if (this.callBackFlag) {
|
||||||
const param2 = {
|
const param2: UDPParamType = {
|
||||||
id: 47,
|
id: 47,
|
||||||
list: tmpList,
|
list: tmpList,
|
||||||
carNo: this.carInfo.carNo,
|
carNo: this.carInfo.carNo,
|
||||||
@ -272,7 +274,7 @@ export default struct FaceCompare {
|
|||||||
this.faceCompareSucess = 1
|
this.faceCompareSucess = 1
|
||||||
clearInterval(this.interval)
|
clearInterval(this.interval)
|
||||||
} else if (val.body[13] == '0' && this.callBackFlag) {
|
} else if (val.body[13] == '0' && this.callBackFlag) {
|
||||||
AppStorage.setOrCreate('statue',2)
|
AppStorage.setOrCreate('statue', 2)
|
||||||
this.vocObj && this.vocObj.playAudio({
|
this.vocObj && this.vocObj.playAudio({
|
||||||
type: 1,
|
type: 1,
|
||||||
name: 'face_chekc_fail.wav'
|
name: 'face_chekc_fail.wav'
|
||||||
@ -285,11 +287,11 @@ export default struct FaceCompare {
|
|||||||
|
|
||||||
async getVideoConfig() {
|
async getVideoConfig() {
|
||||||
console.log('faceEnterIn')
|
console.log('faceEnterIn')
|
||||||
this.vocObj = new voiceService(async (status, val, next) => {
|
this.vocObj = new voiceService(async (status: string, val: string) => {
|
||||||
if (status == 'idle') {
|
if (status == 'idle') {
|
||||||
if (val == 'face_check.mp3' || val == 'face_fail.mp3') {
|
if (val == 'face_check.mp3' || val == 'face_fail.mp3') {
|
||||||
if (this.times >= 3) {
|
if (this.times >= 3) {
|
||||||
AppStorage.setOrCreate('statue',3)
|
AppStorage.setOrCreate('statue', 3)
|
||||||
this.faceCompareSucess = -1;
|
this.faceCompareSucess = -1;
|
||||||
this.vocObj && this.vocObj.playAudio({
|
this.vocObj && this.vocObj.playAudio({
|
||||||
type: 1,
|
type: 1,
|
||||||
@ -304,7 +306,7 @@ export default struct FaceCompare {
|
|||||||
} else if (val == 'yzcg.wav') {
|
} else if (val == 'yzcg.wav') {
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
this.showFaceCompareFlag = !this.showFaceCompareFlag
|
this.showFaceCompareFlag = !this.showFaceCompareFlag
|
||||||
AppStorage.setOrCreate('statue',4)
|
AppStorage.setOrCreate('statue', 4)
|
||||||
this.faceCompareSucess = 1;
|
this.faceCompareSucess = 1;
|
||||||
this.vocObj && this.vocObj.releasePlayer()
|
this.vocObj && this.vocObj.releasePlayer()
|
||||||
|
|
||||||
|
|||||||
@ -2,16 +2,16 @@ import router from '@ohos.router';
|
|||||||
|
|
||||||
@CustomDialog
|
@CustomDialog
|
||||||
export default struct errorMsgDialog {
|
export default struct errorMsgDialog {
|
||||||
private controller?: CustomDialogController
|
|
||||||
cancel: () => void = () => {
|
|
||||||
}
|
|
||||||
confirm: () => void = () => {
|
|
||||||
}
|
|
||||||
dialogRatio: number = 0.8
|
dialogRatio: number = 0.8
|
||||||
title?: string
|
title?: string
|
||||||
type: string //1 tip 2loading 3Dialog
|
type: string //1 tip 2loading 3Dialog
|
||||||
@State angle: number = 0
|
@State angle: number = 0
|
||||||
@State ratio: number = 1700 / 960
|
@State ratio: number = 1700 / 960
|
||||||
|
private controller?: CustomDialogController
|
||||||
|
cancel: () => void = () => {
|
||||||
|
}
|
||||||
|
confirm: () => void = () => {
|
||||||
|
}
|
||||||
|
|
||||||
@Styles
|
@Styles
|
||||||
commStyle(){
|
commStyle(){
|
||||||
@ -47,17 +47,17 @@ export default struct errorMsgDialog {
|
|||||||
Row() {
|
Row() {
|
||||||
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||||
Text(' 取 消 ')
|
Text(' 取 消 ')
|
||||||
.fontSize(24 * this.ratio* this.dialogRatio*0.6 )
|
.fontSize(24 * this.ratio * this.dialogRatio * 0.6)
|
||||||
.fontColor('#fff')
|
.fontColor('#fff')
|
||||||
.width(60 * this.ratio* this.dialogRatio)
|
.width(60 * this.ratio * this.dialogRatio)
|
||||||
}
|
}
|
||||||
.commStyle()
|
.commStyle()
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
if (this.controller != undefined) {
|
if (this.controller != undefined) {
|
||||||
const errorCode=AppStorage.Get('errorMsg');
|
const errorCode: number = AppStorage.get('errorMsg');
|
||||||
// const errorCodeFlage=AppStorage.Get('errorCodeFlage');
|
// const errorCodeFlage=AppStorage.Get('errorCodeFlage');
|
||||||
// console.log('errorCode',errorCode,errorCodeFlage)
|
// console.log('errorCode',errorCode,errorCodeFlage)
|
||||||
if(errorCode==0){
|
if (errorCode == 0) {
|
||||||
router.replaceUrl({
|
router.replaceUrl({
|
||||||
url: 'pages/Index',
|
url: 'pages/Index',
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
@ -67,29 +67,29 @@ export default struct errorMsgDialog {
|
|||||||
this.cancel()
|
this.cancel()
|
||||||
this.controller.close()
|
this.controller.close()
|
||||||
}
|
}
|
||||||
}).margin({ right: 10 * this.ratio * this.dialogRatio})
|
}).margin({ right: 10 * this.ratio * this.dialogRatio })
|
||||||
|
|
||||||
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||||
Text(' 确 定 ')
|
Text(' 确 定 ')
|
||||||
.fontSize(24 * this.ratio* this.dialogRatio*0.6)
|
.fontSize(24 * this.ratio * this.dialogRatio * 0.6)
|
||||||
.fontColor('#fff')
|
.fontColor('#fff')
|
||||||
.width(60 * this.ratio* this.dialogRatio)
|
.width(60 * this.ratio * this.dialogRatio)
|
||||||
}
|
}
|
||||||
.commStyle()
|
.commStyle()
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
const errorCode=AppStorage.Get('errorCode');
|
const errorCode: number = AppStorage.get('errorCode');
|
||||||
const errorCodeFlage=AppStorage.Get('errorCodeFlage');
|
const errorCodeFlage: string = AppStorage.get('errorCodeFlage');
|
||||||
console.log('errorCode',errorCode,errorCodeFlage)
|
console.log('errorCode', errorCode, errorCodeFlage)
|
||||||
if(errorCode==0&&errorCodeFlage){
|
if (errorCode == 0 && errorCodeFlage) {
|
||||||
router.replaceUrl({
|
router.replaceUrl({
|
||||||
url: 'pages/Index',
|
url: 'pages/Index',
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
router.clear();
|
router.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log('errorCode',errorCode,errorCodeFlage)
|
console.log('errorCode', errorCode, errorCodeFlage)
|
||||||
|
|
||||||
if (this.controller != undefined){
|
if (this.controller != undefined) {
|
||||||
this.confirm()
|
this.confirm()
|
||||||
this.controller.close()
|
this.controller.close()
|
||||||
}
|
}
|
||||||
@ -98,16 +98,15 @@ export default struct errorMsgDialog {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
.padding({bottom:20})
|
.padding({ bottom: 20 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.
|
.backgroundColor('#E6E3DF')
|
||||||
backgroundColor('#E6E3DF')
|
|
||||||
.borderRadius(19 * this.ratio)
|
.borderRadius(19 * this.ratio)
|
||||||
.constraintSize({ minWidth: 520 })
|
.constraintSize({ minWidth: 520 })
|
||||||
}
|
}
|
||||||
|
|
||||||
aboutToAppear() {
|
aboutToAppear() {
|
||||||
AppStorage.SetOrCreate('errorMsg', 0);
|
AppStorage.SetOrCreate('errorMsg', 0);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -121,11 +120,11 @@ aboutToAppear() {
|
|||||||
this.controller.close()
|
this.controller.close()
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aboutToDisappear() {
|
aboutToDisappear() {
|
||||||
this.title = ''
|
this.title = ''
|
||||||
this.angle = 0
|
this.angle = 0
|
||||||
AppStorage.SetOrCreate('errorCodeFlage', false);
|
AppStorage.SetOrCreate('errorCodeFlage', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@ import common from '@ohos.app.ability.common';
|
|||||||
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
|
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
|
||||||
import { getCurrentTime } from '../../../common/utils/tools';
|
import { getCurrentTime } from '../../../common/utils/tools';
|
||||||
import { MarkRule, SYSSET } from '../../judgeSDK/api/judgeSDK.d';
|
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 JudgeTask from '../../judgeSDK/utils/judgeTask';
|
||||||
import FilePhoto from '../../judgeSDK/utils/filePhoto';
|
import FilePhoto from '../../judgeSDK/utils/filePhoto';
|
||||||
|
|
||||||
@ -17,10 +17,6 @@ interface SEL {
|
|||||||
//考前模拟人工扣分
|
//考前模拟人工扣分
|
||||||
@Component
|
@Component
|
||||||
export default struct DeductedPopup {
|
export default struct DeductedPopup {
|
||||||
private context = getContext(this) as common.UIAbilityContext;
|
|
||||||
private judgeTask: JudgeTask
|
|
||||||
private filePhoto: FilePhoto
|
|
||||||
private avPlayer
|
|
||||||
@State name: string = ''
|
@State name: string = ''
|
||||||
@State idCard: string = ''
|
@State idCard: string = ''
|
||||||
@State lsh: string = ''
|
@State lsh: string = ''
|
||||||
@ -36,7 +32,7 @@ export default struct DeductedPopup {
|
|||||||
kfdm: string,
|
kfdm: string,
|
||||||
markreal: number,
|
markreal: number,
|
||||||
markcatalog: string
|
markcatalog: string
|
||||||
score:number
|
score: number
|
||||||
}[] = []
|
}[] = []
|
||||||
//开始考试前判绕车一周评判是否开启
|
//开始考试前判绕车一周评判是否开启
|
||||||
@State isOpen: boolean = false
|
@State isOpen: boolean = false
|
||||||
@ -57,27 +53,36 @@ export default struct DeductedPopup {
|
|||||||
@State selectedLine: number = undefined
|
@State selectedLine: number = undefined
|
||||||
@State carInfo: object = {}
|
@State carInfo: object = {}
|
||||||
@State singlePlay: boolean = false
|
@State singlePlay: boolean = false
|
||||||
private closePopup: Function = () => {
|
|
||||||
}
|
|
||||||
private confirmMark: Function = (itemno: number, serial: string) => {
|
|
||||||
}
|
|
||||||
private endLoading: Function = () => {
|
|
||||||
}
|
|
||||||
@State selectedLineStyle: SEL = {
|
@State selectedLineStyle: SEL = {
|
||||||
fontColor: '#FFF',
|
fontColor: '#FFF',
|
||||||
bgColor: '#B36E00'
|
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() {
|
async aboutToAppear() {
|
||||||
this.carInfo=AppStorage.get('carInfo')
|
this.carInfo = AppStorage.get('carInfo')
|
||||||
this.singlePlay=AppStorage.get('singlePlay')
|
this.singlePlay = AppStorage.get('singlePlay')
|
||||||
this.avPlayer = new VoiceAnnounce();
|
this.avPlayer = new VoiceAnnounce();
|
||||||
this.judgeTask = new JudgeTask();
|
this.judgeTask = new JudgeTask();
|
||||||
const mediaTest = new FilePhoto(this.context);
|
const mediaTest = new FilePhoto(this.context);
|
||||||
this.filePhoto = mediaTest
|
this.filePhoto = mediaTest
|
||||||
//上车准备
|
//上车准备
|
||||||
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
|
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
|
||||||
const {isTrajectoryOpen} = judgeConfig;
|
const { isTrajectoryOpen } = judgeConfig;
|
||||||
if (isTrajectoryOpen) {
|
if (isTrajectoryOpen) {
|
||||||
await this.initDb()
|
await this.initDb()
|
||||||
} else {
|
} else {
|
||||||
@ -97,7 +102,7 @@ export default struct DeductedPopup {
|
|||||||
|
|
||||||
//本地数据初始化
|
//本地数据初始化
|
||||||
async initDb() {
|
async initDb() {
|
||||||
const {isTrajectoryOpen,trajectoryPath} = judgeConfig
|
const { isTrajectoryOpen, trajectoryPath } = judgeConfig
|
||||||
const examSubject = this.carInfo.examSubject;
|
const examSubject = this.carInfo.examSubject;
|
||||||
//轨迹回放读取 systemparam表、markrule表
|
//轨迹回放读取 systemparam表、markrule表
|
||||||
const fileUtil = new FileUtil(this.context);
|
const fileUtil = new FileUtil(this.context);
|
||||||
@ -112,29 +117,17 @@ export default struct DeductedPopup {
|
|||||||
await this.initStudent()
|
await this.initStudent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过程照片拍照
|
|
||||||
getPhoto = async (empty?: boolean) => {
|
|
||||||
//单机模式返回空照片
|
|
||||||
if (this.singlePlay) {
|
|
||||||
return ''
|
|
||||||
} else {
|
|
||||||
const {filePhoto} = this;
|
|
||||||
const photoBase64 = await filePhoto.getPhoto();
|
|
||||||
return photoBase64
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 扣分操作
|
// 扣分操作
|
||||||
async pointsDedute() {
|
async pointsDedute() {
|
||||||
const index = this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex;
|
const index = this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex;
|
||||||
const mark = this.universalMarkRules[index * 7 + this.selectedLine];
|
const mark = this.universalMarkRules[index * 7 + this.selectedLine];
|
||||||
const {judgeConfigObj,kssycs,avPlayer,judgeTask} = this;
|
const { judgeConfigObj, kssycs, avPlayer, judgeTask } = this;
|
||||||
this.kfdmArr.push({
|
this.kfdmArr.push({
|
||||||
xmdm: 1,
|
xmdm: 1,
|
||||||
kfdm: mark.markserial,
|
kfdm: mark.markserial,
|
||||||
markreal: mark.markreal,
|
markreal: mark.markreal,
|
||||||
markcatalog: mark.markcatalog ,
|
markcatalog: mark.markcatalog,
|
||||||
score:mark.score
|
score: mark.score
|
||||||
})
|
})
|
||||||
const kfdmArr = this.kfdmArr
|
const kfdmArr = this.kfdmArr
|
||||||
|
|
||||||
@ -151,7 +144,7 @@ export default struct DeductedPopup {
|
|||||||
})))
|
})))
|
||||||
|
|
||||||
if (judgeConfigObj['418'] == '1' || judgeConfig.kfVoiceOpen) {
|
if (judgeConfigObj['418'] == '1' || judgeConfig.kfVoiceOpen) {
|
||||||
avPlayer.playAudio([`voice/${mark.markcatalog}.mp3`,`voice/mark_${Math.abs(mark.score)}.mp3`], false, () => {
|
avPlayer.playAudio([`voice/${mark.markcatalog}.mp3`, `voice/mark_${Math.abs(mark.score)}.mp3`], false, () => {
|
||||||
this.closePopup(true)
|
this.closePopup(true)
|
||||||
});
|
});
|
||||||
return
|
return
|
||||||
@ -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;
|
let kfScore = 0;
|
||||||
if (kfdmArr.length) {
|
if (kfdmArr.length) {
|
||||||
@ -210,11 +204,13 @@ export default struct DeductedPopup {
|
|||||||
async beginProject() {
|
async beginProject() {
|
||||||
//项目开始 //过程照片 //扣分 //结束考试
|
//项目开始 //过程照片 //扣分 //结束考试
|
||||||
const carInfo = this.carInfo;
|
const carInfo = this.carInfo;
|
||||||
const { examSubject,plateNo } = carInfo;
|
const { examSubject, plateNo } = carInfo;
|
||||||
const {serialNumber,lsh,idCard,ksxl,kslx,ksdd} = this
|
const { serialNumber, lsh, idCard, ksxl, kslx, ksdd } = this
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const beginData = {
|
const beginData = {
|
||||||
xtlb: '17', jkxlh: serialNumber, jkid: '17C52',
|
xtlb: '17',
|
||||||
|
jkxlh: serialNumber,
|
||||||
|
jkid: '17C52',
|
||||||
drvexam: {
|
drvexam: {
|
||||||
// 考试科目 身份证号码
|
// 考试科目 身份证号码
|
||||||
lsh,
|
lsh,
|
||||||
@ -237,14 +233,16 @@ export default struct DeductedPopup {
|
|||||||
|
|
||||||
//过程照片
|
//过程照片
|
||||||
async uploadProgressPhoto() {
|
async uploadProgressPhoto() {
|
||||||
const {serialNumber,lsh,idCard,ksdd,kfdmArr,getPhoto} = this;
|
const { serialNumber, lsh, idCard, ksdd, kfdmArr, getPhoto } = this;
|
||||||
const carInfo = this.carInfo;
|
const carInfo = this.carInfo;
|
||||||
const { examSubject,plateNo,carNo } = carInfo;
|
const { examSubject, plateNo, carNo } = carInfo;
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
console.info('surenjun uploadProgressPhoto',)
|
console.info('surenjun uploadProgressPhoto',)
|
||||||
const photoBase64 = await getPhoto()
|
const photoBase64 = await getPhoto()
|
||||||
const photoData = {
|
const photoData = {
|
||||||
xtlb: '17', jkxlh: serialNumber, jkid: '17C54',
|
xtlb: '17',
|
||||||
|
jkxlh: serialNumber,
|
||||||
|
jkid: '17C54',
|
||||||
drvexam: {
|
drvexam: {
|
||||||
lsh,
|
lsh,
|
||||||
kskm: examSubject,
|
kskm: examSubject,
|
||||||
@ -265,14 +263,16 @@ export default struct DeductedPopup {
|
|||||||
|
|
||||||
// 扣分
|
// 扣分
|
||||||
async kfFn() {
|
async kfFn() {
|
||||||
const {serialNumber,lsh,idCard,ksdd,kfdmArr} = this;
|
const { serialNumber, lsh, idCard, ksdd, kfdmArr } = this;
|
||||||
const kfLen = kfdmArr.length;
|
const kfLen = kfdmArr.length;
|
||||||
const kf = kfdmArr[kfLen -1];
|
const kf = kfdmArr[kfLen -1];
|
||||||
const carInfo = this.carInfo;
|
const carInfo = this.carInfo;
|
||||||
const { examSubject} = carInfo;
|
const { examSubject } = carInfo;
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const kfData = {
|
const kfData = {
|
||||||
xtlb: '17', jkxlh: serialNumber, jkid: '17C53',
|
xtlb: '17',
|
||||||
|
jkxlh: serialNumber,
|
||||||
|
jkid: '17C53',
|
||||||
drvexam: {
|
drvexam: {
|
||||||
lsh,
|
lsh,
|
||||||
kskm: examSubject,
|
kskm: examSubject,
|
||||||
@ -293,11 +293,13 @@ export default struct DeductedPopup {
|
|||||||
// 项目结束
|
// 项目结束
|
||||||
async endProject() {
|
async endProject() {
|
||||||
const carInfo = this.carInfo;
|
const carInfo = this.carInfo;
|
||||||
const { examSubject,plateNo,carNo } = carInfo;
|
const { examSubject, plateNo, carNo } = carInfo;
|
||||||
const {lsh,idCard,serialNumber,ksdd,kslx,ksxl,} = this;
|
const { lsh, idCard, serialNumber, ksdd, kslx, ksxl, } = this;
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const endProjectData = {
|
const endProjectData = {
|
||||||
xtlb: '17', jkxlh: serialNumber, jkid: '17C55',
|
xtlb: '17',
|
||||||
|
jkxlh: serialNumber,
|
||||||
|
jkid: '17C55',
|
||||||
drvexam: {
|
drvexam: {
|
||||||
lsh,
|
lsh,
|
||||||
kskm: examSubject,
|
kskm: examSubject,
|
||||||
@ -316,13 +318,15 @@ export default struct DeductedPopup {
|
|||||||
|
|
||||||
//考试结束
|
//考试结束
|
||||||
async endFn() {
|
async endFn() {
|
||||||
const {serialNumber,lsh,idCard,score,getPhoto} = this;
|
const { serialNumber, lsh, idCard, score, getPhoto } = this;
|
||||||
const carInfo = this.carInfo;
|
const carInfo = this.carInfo;
|
||||||
const { examSubject,plateNo } = carInfo;
|
const { examSubject, plateNo } = carInfo;
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const photoBase64 = await getPhoto();
|
const photoBase64 = await getPhoto();
|
||||||
const endData = {
|
const endData = {
|
||||||
xtlb: '17', jkxlh: serialNumber, jkid: '17C56',
|
xtlb: '17',
|
||||||
|
jkxlh: serialNumber,
|
||||||
|
jkid: '17C56',
|
||||||
drvexam: {
|
drvexam: {
|
||||||
lsh,
|
lsh,
|
||||||
kchp: decodeURI(plateNo),
|
kchp: decodeURI(plateNo),
|
||||||
@ -395,7 +399,7 @@ export default struct DeductedPopup {
|
|||||||
const students = await getSyncData('USER')
|
const students = await getSyncData('USER')
|
||||||
const stuInfo = students[0] || {};
|
const stuInfo = students[0] || {};
|
||||||
|
|
||||||
const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl} = stuInfo;
|
const { xm, sfzmhm, lsh, kszp, ksdd, kssycs, kslx, ksxl } = stuInfo;
|
||||||
this.name = xm || '测试考生';
|
this.name = xm || '测试考生';
|
||||||
this.idCard = sfzmhm || '01234567891010';
|
this.idCard = sfzmhm || '01234567891010';
|
||||||
this.lsh = lsh;
|
this.lsh = lsh;
|
||||||
@ -420,7 +424,7 @@ export default struct DeductedPopup {
|
|||||||
|
|
||||||
//选中扣分项
|
//选中扣分项
|
||||||
getSelectedLine(index) {
|
getSelectedLine(index) {
|
||||||
const {selectedLine,selectedLineStyle,lineBg} = this;
|
const { selectedLine, selectedLineStyle, lineBg } = this;
|
||||||
if (selectedLine === index) {
|
if (selectedLine === index) {
|
||||||
return selectedLineStyle.bgColor
|
return selectedLineStyle.bgColor
|
||||||
}
|
}
|
||||||
@ -433,7 +437,7 @@ export default struct DeductedPopup {
|
|||||||
|
|
||||||
//获取当前页的数据
|
//获取当前页的数据
|
||||||
getCurrentMarkRuleList() {
|
getCurrentMarkRuleList() {
|
||||||
const {currentIndex,currentUniversalPageIndex,currentPageIndex,universalMarkRules} = this;
|
const { currentIndex, currentUniversalPageIndex, currentPageIndex, universalMarkRules } = this;
|
||||||
if (currentIndex) {
|
if (currentIndex) {
|
||||||
//通用评判
|
//通用评判
|
||||||
return universalMarkRules.slice(currentUniversalPageIndex * 7, (currentUniversalPageIndex + 1) * 7)
|
return universalMarkRules.slice(currentUniversalPageIndex * 7, (currentUniversalPageIndex + 1) * 7)
|
||||||
@ -477,7 +481,8 @@ export default struct DeductedPopup {
|
|||||||
|
|
||||||
Row() {
|
Row() {
|
||||||
if (
|
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
|
(this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) > 0
|
||||||
) {
|
) {
|
||||||
Row() {
|
Row() {
|
||||||
@ -499,7 +504,8 @@ export default struct DeductedPopup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
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() {
|
Row() {
|
||||||
Text('下一页') {
|
Text('下一页') {
|
||||||
@ -560,7 +566,12 @@ export default struct DeductedPopup {
|
|||||||
.height(710)
|
.height(710)
|
||||||
.position({ x: '10%', y: '10%' })
|
.position({ x: '10%', y: '10%' })
|
||||||
.backgroundColor('#E6E3DF')
|
.backgroundColor('#E6E3DF')
|
||||||
.padding({ top: 15, bottom: 15, left: 25, right: 25 })
|
.padding({
|
||||||
|
top: 15,
|
||||||
|
bottom: 15,
|
||||||
|
left: 25,
|
||||||
|
right: 25
|
||||||
|
})
|
||||||
.borderRadius(20)
|
.borderRadius(20)
|
||||||
|
|
||||||
Row() {
|
Row() {
|
||||||
@ -581,4 +592,13 @@ export default struct DeductedPopup {
|
|||||||
})
|
})
|
||||||
}.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.7)')
|
}.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 = () => {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user