fix: 优化了信号取值问题,优化了评判内部弹窗
This commit is contained in:
parent
acd7aef88b
commit
edf7e07f6f
@ -490,14 +490,14 @@ export interface JudgeUI {
|
||||
jl: number
|
||||
dwztErrorVisible: boolean
|
||||
isDeductedPopShow: boolean
|
||||
loadingPopupVisible: boolean
|
||||
endPopupVisible: boolean
|
||||
defaultTabIndex: number
|
||||
isDwztRight: boolean
|
||||
draw: boolean
|
||||
lane: LANE
|
||||
sd: string
|
||||
dw: string
|
||||
endExamDialogController: CustomDialogController
|
||||
generateExamRecordsDialogController: CustomDialogController
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -19,6 +19,13 @@ export interface WorkerBackMessage {
|
||||
data: string | CenterCallBackMsgType
|
||||
}
|
||||
|
||||
export enum WorkerBackMessageType {
|
||||
// 后置机信息
|
||||
ObtainUdpData = 'obtainUdpData',
|
||||
// 中心消息
|
||||
CenterUdpData = 'centerUdpData',
|
||||
}
|
||||
|
||||
export interface LogWorkerMessage {
|
||||
type: WorkerMessageType;
|
||||
data?: string;
|
||||
|
||||
@ -40,6 +40,5 @@ export default struct LoadingComponent {
|
||||
radius: 30,
|
||||
color: "#E7B544"
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,6 @@
|
||||
import router from '@ohos.router';
|
||||
import Prompt from '@system.prompt';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import EndPoPup from './compontents/judge/EndPopup';
|
||||
import LoadingPopup from './compontents/judge/LoadingPopup';
|
||||
import DeductedPopup from './compontents/judge/DeductionPopup';
|
||||
import AmplifyPopup from './compontents/judge/AmplifyPopup';
|
||||
import Judge from './judgeSDK/judge';
|
||||
@ -51,6 +49,8 @@ import FileUtils from '../utils/FileUtils';
|
||||
import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog';
|
||||
import { DefaultJudgeConfigData } from '../mock';
|
||||
import { dConsole } from '../utils/LogWorker';
|
||||
import ConfirmDialog from './compontents/ConfirmDialog';
|
||||
import CarLoadingDialog from './compontents/CarLoading';
|
||||
|
||||
|
||||
@Entry
|
||||
@ -61,10 +61,6 @@ struct JudgePage {
|
||||
@State wayno: number = 0
|
||||
@State FONTSIZE: number = 30
|
||||
@State BIGFONTSIZE: number = 32
|
||||
//结束考试弹窗
|
||||
@State endPopupVisible: boolean = false
|
||||
//等待弹窗(考试及格,考试不及格使用)
|
||||
@State loadingPopupVisible: boolean = false
|
||||
@State isDdxk: boolean = false;
|
||||
@State time: string = ''
|
||||
//考试用时
|
||||
@ -156,12 +152,51 @@ struct JudgePage {
|
||||
@State disConnectErrorOpen: boolean = false
|
||||
public context = getContext(this) as common.UIAbilityContext;
|
||||
// 信号查看弹窗
|
||||
signalTrajectoryDialog: CustomDialogController = new CustomDialogController({
|
||||
signalTrajectoryDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: SignalTrajectoryDialog(),
|
||||
customStyle: true,
|
||||
autoCancel: true
|
||||
})
|
||||
// 生成考试记录
|
||||
generateExamRecordsDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CarLoadingDialog({
|
||||
text: "正在生成考试记录,请稍等...",
|
||||
}),
|
||||
customStyle: true
|
||||
})
|
||||
private judge: Judge = new Judge(this)
|
||||
// 结束考试弹窗
|
||||
endExamDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: ConfirmDialog({
|
||||
text: "确认结束考试?",
|
||||
onConfirm: async () => {
|
||||
if (this.isErrorMsgEnd) {
|
||||
this.judge.closeAllFiles()
|
||||
router.back()
|
||||
return
|
||||
}
|
||||
if (Reflect.get(this.judgeConfigObj, '344') == 1) {
|
||||
Prompt.showToast({
|
||||
message: '考试未结束,不允许手动退出!',
|
||||
duration: 4000
|
||||
});
|
||||
return
|
||||
}
|
||||
this.endExamDialogController.close()
|
||||
// this.loadingPopupVisible = true
|
||||
this.generateExamRecordsDialogController.open()
|
||||
clearInterval(this.timer);
|
||||
clearInterval(AppStorage.get('judgeTimer'))
|
||||
try {
|
||||
this.judge.checkExamIsEnd(true);
|
||||
} catch (e) {
|
||||
this.judge.closeAllFiles()
|
||||
router.back()
|
||||
}
|
||||
}
|
||||
}),
|
||||
customStyle: true
|
||||
})
|
||||
|
||||
async aboutToDisappear() {
|
||||
clearInterval(this.mileageTimer)
|
||||
@ -949,7 +984,7 @@ struct JudgePage {
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
this.signalTrajectoryDialog.open()
|
||||
this.signalTrajectoryDialogController.open()
|
||||
})
|
||||
|
||||
Row() {
|
||||
@ -1017,12 +1052,8 @@ struct JudgePage {
|
||||
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
.onClick(() => {
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
if (Reflect.get(this.judgeConfigObj, '353') == '0') {
|
||||
this.endPopupVisible = true
|
||||
this.endExamDialogController.open()
|
||||
} else {
|
||||
Prompt.showToast({
|
||||
message: '车上不允许手动结束考试!',
|
||||
@ -1097,47 +1128,6 @@ struct JudgePage {
|
||||
})
|
||||
}
|
||||
|
||||
//结束考试弹窗
|
||||
if (this.endPopupVisible) {
|
||||
EndPoPup({
|
||||
title: '确定结束考试吗?',
|
||||
cancelFn: () => {
|
||||
this.endPopupVisible = false;
|
||||
},
|
||||
confirmFn: async () => {
|
||||
if (this.isErrorMsgEnd) {
|
||||
this.judge.closeAllFiles()
|
||||
router.back()
|
||||
return
|
||||
}
|
||||
if (Reflect.get(this.judgeConfigObj, '344') == 1) {
|
||||
Prompt.showToast({
|
||||
message: '考试未结束,不允许手动退出!',
|
||||
duration: 4000
|
||||
});
|
||||
return
|
||||
}
|
||||
this.endPopupVisible = false;
|
||||
this.loadingPopupVisible = true
|
||||
clearInterval(this.timer);
|
||||
clearInterval(AppStorage.get('judgeTimer'))
|
||||
try {
|
||||
this.judge.checkExamIsEnd(true);
|
||||
} catch (e) {
|
||||
this.judge.closeAllFiles()
|
||||
router.back()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//loading 弹窗
|
||||
if (this.loadingPopupVisible) {
|
||||
LoadingPopup({
|
||||
title: '正在生成考试记录,请稍后...',
|
||||
})
|
||||
}
|
||||
|
||||
if (this.errorMsg) {
|
||||
MsgPopup({
|
||||
|
||||
@ -47,8 +47,8 @@ import HeaderComponent from './compontents/Header';
|
||||
import AvatarComponent from './UserInfo/Avatar';
|
||||
import CommTextComponent from './UserInfo/CommText';
|
||||
import LabelBlockComponent from './UserInfo/LabelBlock';
|
||||
import MissAnExamDialog from './UserInfo/MissAnExamDialog';
|
||||
import CarLoadingDialog from './compontents/CarLoading';
|
||||
import ConfirmDialog from './compontents/ConfirmDialog';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@ -74,19 +74,11 @@ struct UserInfoPage {
|
||||
@State loadingText: string = '正在认证监管信息,请稍后...'
|
||||
@State sczbkf: SckType[] = []
|
||||
@State currentUser: User = EmptyCandidateObject
|
||||
// 缺考弹窗
|
||||
missAnExamDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: MissAnExamDialog({
|
||||
name: this.currentUser.xm,
|
||||
onConfirm: () => {
|
||||
this.qkFn()
|
||||
}
|
||||
})
|
||||
})
|
||||
// 开始考试弹窗
|
||||
startExamDialog: CustomDialogController = new CustomDialogController({
|
||||
startExamDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CarLoadingDialog(),
|
||||
autoCancel: false
|
||||
autoCancel: false,
|
||||
customStyle: true
|
||||
})
|
||||
@State dataList: Array<User> = []
|
||||
@State list: Array<User> = []
|
||||
@ -108,7 +100,17 @@ struct UserInfoPage {
|
||||
@State signNum: number = 0;
|
||||
@State isCanClick: boolean = true;
|
||||
@State updateTimeLimit: boolean = false
|
||||
@State ksksLimit: boolean = false
|
||||
// 缺考弹窗
|
||||
missAnExamDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: ConfirmDialog({
|
||||
text: `确认考生:${this.currentUser.xm}是否缺考?`,
|
||||
onConfirm: () => {
|
||||
this.qkFn()
|
||||
}
|
||||
}),
|
||||
customStyle: true,
|
||||
autoCancel: true
|
||||
})
|
||||
@State faceFlag: string = '0';
|
||||
@State FaceOpenStatue: string = '0'; //是否开启人脸识别
|
||||
@State faceCatchImg: string = ''
|
||||
@ -163,9 +165,6 @@ struct UserInfoPage {
|
||||
]
|
||||
//开始考试准备
|
||||
prePareExam = async () => {
|
||||
if (this.ksksLimit) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await this.checkSignal()
|
||||
this.faceCompareSucess = 0
|
||||
@ -173,7 +172,6 @@ struct UserInfoPage {
|
||||
if (!this.currentUser.xm) {
|
||||
return
|
||||
}
|
||||
this.ksksLimit = true
|
||||
if (this.singlePlay) {
|
||||
this.currentUser.id = '0'
|
||||
dConsole.log('开始考试')
|
||||
@ -187,7 +185,6 @@ struct UserInfoPage {
|
||||
kfdm: this.sczbkf,
|
||||
}
|
||||
}, router.RouterMode.Single);
|
||||
this.ksksLimit = false
|
||||
this.stopDeviceById()
|
||||
return
|
||||
}
|
||||
@ -216,7 +213,6 @@ struct UserInfoPage {
|
||||
this.isExamStart = false
|
||||
this.startExam = false
|
||||
this.updateTimeLimit = false
|
||||
this.ksksLimit = false
|
||||
this.currentUser = EmptyCandidateObject
|
||||
this.filePhoto = new FilePhoto(this.context);
|
||||
this.singlePlay = AppStorage.get<boolean>('singlePlay') || false
|
||||
@ -606,7 +602,6 @@ struct UserInfoPage {
|
||||
|
||||
//人脸比对窗口关闭
|
||||
changeFaceCompareSuccess() {
|
||||
this.ksksLimit = false
|
||||
dConsole.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser))
|
||||
if (this.faceCompareSucess > 0) {
|
||||
//人脸比对通过
|
||||
@ -640,7 +635,6 @@ struct UserInfoPage {
|
||||
this.isExamStart = false
|
||||
this.startExam = false
|
||||
this.updateTimeLimit = false
|
||||
this.ksksLimit = false
|
||||
// this.isBoardPrePareSetPopupOpen=true
|
||||
this.isFirstBoardPrePareSetPopupBtnShow = false
|
||||
dConsole.log('isFirstBoardPrePareSetPopupBtnShow', this.isFirstBoardPrePareSetPopupBtnShow,
|
||||
@ -774,7 +768,6 @@ struct UserInfoPage {
|
||||
return
|
||||
}
|
||||
this.faceCompareSucess = 0
|
||||
this.ksksLimit = false
|
||||
if (this.singlePlay) {
|
||||
this.qkFlag = false
|
||||
return
|
||||
@ -857,7 +850,7 @@ struct UserInfoPage {
|
||||
}
|
||||
this.currentUser.id = '1'
|
||||
const avPlayer = this.avPlayer;
|
||||
this.startExamDialog.open()
|
||||
this.startExamDialogController.open()
|
||||
|
||||
avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => {
|
||||
dConsole.info('surenjun', '播放结束开始考试接口调用')
|
||||
@ -868,7 +861,7 @@ struct UserInfoPage {
|
||||
|
||||
if (res.code != 1) {
|
||||
avPlayer.playAudio([res.code == -200 ? 'voice/photo_error.mp3' : 'voice/监管审核未通过.mp3']);
|
||||
this.startExamDialog.close()
|
||||
this.startExamDialogController.close()
|
||||
this.isExamStart = false
|
||||
promptAction.showToast({
|
||||
message: res.message,
|
||||
@ -880,7 +873,7 @@ struct UserInfoPage {
|
||||
// await upDateTableByArray('USER', [this.currentUser])
|
||||
await SqlInsertTable('USER', [this.currentUser])
|
||||
this.stepFlag = false
|
||||
this.startExamDialog.close()
|
||||
this.startExamDialogController.close()
|
||||
router.pushUrl({
|
||||
url: 'pages/Judge',
|
||||
params: {
|
||||
@ -1008,8 +1001,7 @@ struct UserInfoPage {
|
||||
AppStorage.setOrCreate('startHourTime', startHourTime)
|
||||
const photoBase64 = await this.getPhoto();
|
||||
if (photoBase64 == '') {
|
||||
this.ksksLimit = false
|
||||
this.startExamDialog.close()
|
||||
this.startExamDialogController.close()
|
||||
return { code: -200 }
|
||||
}
|
||||
const drvexam: DrvexamType = {
|
||||
@ -1196,12 +1188,12 @@ struct UserInfoPage {
|
||||
imageBtn({ btnWidth: 390, btnHeight: 122, imgSrc: $r('app.media.qk_btn') })
|
||||
.margin({ bottom: 21 })
|
||||
.onClick(() => {
|
||||
if (this.ksksLimit || (this.systemParam.Param352Str == '1' && this.currentUser.kssycs == '1') ||
|
||||
if ((this.systemParam.Param352Str == '1' && this.currentUser.kssycs == '1') ||
|
||||
this.systemParam.Param770Str == '1') {
|
||||
return
|
||||
}
|
||||
this.ksksLimit = true
|
||||
// this.qkFlag = true
|
||||
console.log("打开缺考")
|
||||
this.missAnExamDialogController.open()
|
||||
})
|
||||
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
// 缺考考生弹窗
|
||||
import BtnComponent from '../compontents/Button';
|
||||
import BtnComponent from './Button';
|
||||
|
||||
@CustomDialog
|
||||
export default struct MissAnExamDialog {
|
||||
@Prop name: string = "xxx";
|
||||
export default struct ConfirmDialog {
|
||||
@Prop text: string = "xxx";
|
||||
private controller?: CustomDialogController;
|
||||
onConfirm: () => void = () => {
|
||||
};
|
||||
onCancel?: () => void = () => {
|
||||
};
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
@ -14,14 +15,18 @@ export default struct MissAnExamDialog {
|
||||
top: 40
|
||||
}).fontWeight(FontWeight.Bold)
|
||||
Row() {
|
||||
Text(`确认考生:${this.name}是否缺考?`).fontSize(28)
|
||||
Text(this.text).fontSize(28)
|
||||
}.height(300).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
|
||||
|
||||
Row() {
|
||||
BtnComponent({
|
||||
text: "取消",
|
||||
}).onClick(() => {
|
||||
this.controller?.close();
|
||||
if (!this.onCancel) {
|
||||
this.controller?.close();
|
||||
return;
|
||||
}
|
||||
this.onCancel && this.onCancel();
|
||||
})
|
||||
|
||||
BtnComponent().onClick(() => {
|
||||
@ -38,11 +43,4 @@ export default struct MissAnExamDialog {
|
||||
color: "#E7B544"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct btnComponent {
|
||||
build() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,12 @@
|
||||
import { GPSData, InitialPerLane, SignalData } from '../../mock'
|
||||
import { EnvironmentConfigurationType, PerLane, RoadDataType, SignalDataType, WorkerBackMessage } from '../../model'
|
||||
import {
|
||||
EnvironmentConfigurationType,
|
||||
PerLane,
|
||||
RoadDataType,
|
||||
SignalDataType,
|
||||
WorkerBackMessage,
|
||||
WorkerBackMessageType
|
||||
} from '../../model'
|
||||
import apiJudgeSdk from 'libJudgeSdk.so'
|
||||
|
||||
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker'
|
||||
@ -23,14 +30,20 @@ export default struct SignalDisplayComponent {
|
||||
@State laneSignal: PerLane = InitialPerLane
|
||||
|
||||
aboutToAppear(): void {
|
||||
DifferentialAndSignal.onMsg((data: string) => {
|
||||
const result: WorkerBackMessage = JSON.parse(data)
|
||||
dConsole.log("wzj", data)
|
||||
if (result.type === "obtainUdpData") {
|
||||
this.getSignal(result.data as string)
|
||||
this.rawData = result.data as string
|
||||
}
|
||||
})
|
||||
DifferentialAndSignal.onMsg(this.getMsg)
|
||||
}
|
||||
|
||||
getMsg(data: string) {
|
||||
const result: WorkerBackMessage = JSON.parse(data)
|
||||
dConsole.log("wzj", data)
|
||||
if (result.type === WorkerBackMessageType.ObtainUdpData) {
|
||||
this.getSignal(result.data as string)
|
||||
this.rawData = result.data as string
|
||||
}
|
||||
}
|
||||
|
||||
aboutToDisappear(): void {
|
||||
DifferentialAndSignal.offMsg(this.getMsg)
|
||||
}
|
||||
|
||||
getSignal = (msg: string) => {
|
||||
@ -39,11 +52,9 @@ export default struct SignalDisplayComponent {
|
||||
return
|
||||
}
|
||||
this.signArr = newArr
|
||||
|
||||
for (let i = 0; i <= 12; i++) {
|
||||
this.vehicleSignal[i].value = this.signArr[i+2]
|
||||
}
|
||||
|
||||
this.vehicleSignal[13].value = this.signArr[17]
|
||||
this.vehicleSignal[14].value = this.signArr[18]
|
||||
this.vehicleSignal[15].value = this.signArr[19]
|
||||
|
||||
@ -51,6 +51,7 @@ import {
|
||||
TKmItem,
|
||||
User,
|
||||
WorkerBackMessage,
|
||||
WorkerBackMessageType,
|
||||
WR
|
||||
} from '../../model';
|
||||
import { DrivingDataStorage } from '../../utils/business/DrivingDataStorage';
|
||||
@ -1321,8 +1322,10 @@ export default class Judge {
|
||||
}
|
||||
// 处理考试结束
|
||||
public handEndExam = async () => {
|
||||
this.judgeUI.loadingPopupVisible = true;
|
||||
this.judgeUI.endPopupVisible = false;
|
||||
// this.judgeUI.loadingPopupVisible = true;
|
||||
this.judgeUI.generateExamRecordsDialogController.open()
|
||||
// this.judgeUI.endPopupVisible = false;
|
||||
this.judgeUI.endExamDialogController.close()
|
||||
this.judgeUI.isDeductedPopShow = false;
|
||||
|
||||
const judgeUI = this.judgeUI
|
||||
@ -1450,12 +1453,14 @@ export default class Judge {
|
||||
}
|
||||
this.isUdpEnd = true;
|
||||
closeAllFiles()
|
||||
this.judgeUI.loadingPopupVisible = false;
|
||||
// this.judgeUI.loadingPopupVisible = false;
|
||||
this.judgeUI.generateExamRecordsDialogController.close()
|
||||
return
|
||||
}
|
||||
dConsole.info(JudgeTag, '考试结束 end')
|
||||
const param302: string = Reflect.get(judgeConfigObj, '302')
|
||||
judgeUI.loadingPopupVisible = true;
|
||||
// judgeUI.loadingPopupVisible = true;
|
||||
judgeUI.generateExamRecordsDialogController.open()
|
||||
let currentKssycs = '0';
|
||||
let voiceURL = ''
|
||||
if (examSubject == '2') {
|
||||
@ -1951,7 +1956,7 @@ export default class Judge {
|
||||
DifferentialAndSignal.onMsg((data: string) => {
|
||||
dConsole.info(JudgeTag, 'socketTag[PLC.UdpClient]', '收到udp回调数据')
|
||||
const result: WorkerBackMessage = JSON.parse(data)
|
||||
if (result.type === "obtainUdpData") {
|
||||
if (result.type === WorkerBackMessageType.ObtainUdpData) {
|
||||
handleUdp(result.data as string)
|
||||
}
|
||||
//TODO UDP修改
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// 处理worker线程的消息tcp拿差分改正数,udp给后置机
|
||||
import worker, { ErrorEvent, MessageEvents, ThreadWorkerGlobalScope } from '@ohos.worker';
|
||||
import { WorkerTag } from '../config';
|
||||
import { CenterCallBackMsgType, WorkerBackMessage, WorkerMessage } from '../model';
|
||||
import { CenterCallBackMsgType, WorkerBackMessage, WorkerBackMessageType, WorkerMessage } from '../model';
|
||||
import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness';
|
||||
import { DifferentialSignal } from '../utils/business/DifferentialSignal';
|
||||
import { ObtainUdpBusinessInstance } from '../utils/business/ObtainUdpBusiness';
|
||||
@ -56,7 +56,7 @@ function getDataFn() {
|
||||
// 收到后置机消息传出去提供给业务,data应该是个string
|
||||
workerPort.postMessage(
|
||||
JSON.stringify({
|
||||
type: 'obtainUdpData',
|
||||
type: WorkerBackMessageType.ObtainUdpData,
|
||||
data: data
|
||||
} as WorkerBackMessage))
|
||||
})
|
||||
@ -68,7 +68,7 @@ function getDataFn() {
|
||||
// 收到中心指令发送出去
|
||||
workerPort.postMessage(
|
||||
JSON.stringify({
|
||||
type: 'centerUdpData',
|
||||
type: WorkerBackMessageType.CenterUdpData,
|
||||
data: data
|
||||
} as WorkerBackMessage)
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user