fix: 优化代码

This commit is contained in:
wangzhongjie 2025-10-13 16:14:41 +08:00
parent 77291e107d
commit 732e7535c7
6 changed files with 30 additions and 27 deletions

View File

@ -4,13 +4,13 @@
{ {
"name": "default", "name": "default",
"material": { "material": {
"certpath": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_j6U20r4hUBYNJsocRUYxzV96xIPQLMTqn59Ua3h6tI4=.cer", "certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer",
"storePassword": "0000001A3FBAE9120A580DE1C9D5F8AB398DD7175A8B9FABFBA723C6EB0B2BB78768AAB20CD625EDB6A8", "storePassword": "0000001BD807731D6FB9F044E3DF0E0429F4BB4214FE1608E25B4197041FBF36DDA3C6760585312F2864B6",
"keyAlias": "debugKey", "keyAlias": "debugKey",
"keyPassword": "0000001AC5B516340EAB600B1F9452419BB8A854BB2BBCC2E47FCA97B67D93556BBF50F322FA80CC4A21", "keyPassword": "0000001BFA38BF5235541496B5FF9ED9FFA764AB53FABC873D21DC230060209C2FF24ACE5DA09413B0C138",
"profile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_j6U20r4hUBYNJsocRUYxzV96xIPQLMTqn59Ua3h6tI4=.p7b", "profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b",
"signAlg": "SHA256withECDSA", "signAlg": "SHA256withECDSA",
"storeFile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_j6U20r4hUBYNJsocRUYxzV96xIPQLMTqn59Ua3h6tI4=.p12" "storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p12"
} }
} }
], ],

View File

@ -1,5 +1,5 @@
{ {
"lockfileVersion": 1, "lockfileVersion": 2,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {}, "specifiers": {},
"packages": {} "packages": {}

View File

@ -264,7 +264,9 @@ export const DefaultJudgeConfigData: DefaultJudgeConfigObj = {
//里程不够允许手工点靠边停车 //里程不够允许手工点靠边停车
param_387: '0', param_387: '0',
//监管模式有扣分续考0-否++1-是+把上次未考完的扣分带下来重新考试) //监管模式有扣分续考0-否++1-是+把上次未考完的扣分带下来重新考试)
param_432: '1' param_432: '1',
// Todo
param_634: '1'
} }
//所有的科二 科目三项目 //所有的科二 科目三项目

View File

@ -206,7 +206,7 @@ export class ProcessDataTaskPool {
const attemptType = attempt === 0 ? '初次尝试' : `重试 ${attempt}`; const attemptType = attempt === 0 ? '初次尝试' : `重试 ${attempt}`;
console.log(`[Queue] 开始上传 (${attemptType}, 总共第 ${attemptNum} 次)`); console.log(`[Queue] 开始上传 (${attemptType}, 总共第 ${attemptNum} 次)`);
const result: WR = await taskpool.execute(uploadWorkerTask, taskData); const result: WR = (await taskpool.execute(uploadWorkerTask, taskData)) as WR;
dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(result)); dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(result));
if (result.code === 1) { if (result.code === 1) {

View File

@ -2,17 +2,16 @@ import {
CarInfoType, CarInfoType,
JudgeConfigObj, JudgeConfigObj,
JudgeSound, JudgeSound,
JudgeUI,
MarkRule, MarkRule,
ProcessDataEnumType, ProcessDataEnumType,
Project, Project,
ProjectInfo, ProjectInfo,
ProjectInfos, ProjectInfos,
SYSTEM_PARAM, SYSTEM_PARAM,
User, User
} from '../../model' } from '../../model'
import JudgeBusiness from './JudgeBusiness' import JudgeBusiness from './JudgeBusiness'
import { JudgePage } from "../Judge" import { JudgePage } from '../Judge'
import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements' import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements'
import { dConsole } from '../../utils/LogWorker' import { dConsole } from '../../utils/LogWorker'
import { JudgeConfig, JudgeTag } from '../../config' import { JudgeConfig, JudgeTag } from '../../config'
@ -323,17 +322,17 @@ export class BaseJudge {
const param302 = judgeUI.judgeConfigObj.param_302; const param302 = judgeUI.judgeConfigObj.param_302;
//自动退出待验证并且不合格 //自动退出待验证并且不合格
if (!that.isManual && judgeUI.examSubject === "3" && (param302 === "1" || (judgeUI.singlePlay && param302 === "2")) && judgeUI.totalScore < judgeUI.passingScore) { if (!that.isManual && judgeUI.examSubject === "3" && (param302 === "1" || (judgeUI.singlePlay && param302 === "2")) && judgeUI.totalScore < judgeUI.passingScore) {
that.avPlayer.playAudio([`voice/考试结束.mp3`]) that.avPlayer?.playAudio([`voice/考试结束.mp3`])
} }
//联网模式下:项目没有做完、当前分数大于及格分;手动结束直接退出 //联网模式下:项目没有做完、当前分数大于及格分;手动结束直接退出
if (!judgeUI.singlePlay && that.isManual && !judgeUI.isAllProjectsEnd && judgeUI.totalScore >= judgeUI.passingScore) { if (!judgeUI.singlePlay && that.isManual && !judgeUI.isAllProjectsEnd && judgeUI.totalScore >= judgeUI.passingScore) {
that.avPlayer.playAudio(['voice/empty.mp3'], true, () => { that.avPlayer?.playAudio(['voice/empty.mp3'], true, () => {
router.back(); router.back();
}) })
return return
} }
// //
that.avPlayer.playAudio(['voice/exam_waiting.mp3'], judgeUI.singlePlay, async () => { that.avPlayer?.playAudio(['voice/exam_waiting.mp3'], judgeUI.singlePlay, async () => {
try { try {
if (!judgeUI.singlePlay) { if (!judgeUI.singlePlay) {
// const bytes = await this.getMessageHeartbeat(true); // const bytes = await this.getMessageHeartbeat(true);
@ -457,21 +456,21 @@ export class BaseJudge {
//结束考试时候是否播报一遍所有扣分 //结束考试时候是否播报一遍所有扣分
const param634 = judgeUI.judgeConfigObj.param_634; const param634 = judgeUI.judgeConfigObj.param_634;
if (judgeUI.kfArr.length && ((judgeUI.examSubject === "2" && param634 === "1") || judgeUI.examSubject === "3")) { if (judgeUI.kfArr.length && ((judgeUI.examSubject === "2" && param634 === "1") || judgeUI.examSubject === "3")) {
that.avPlayer.playAudio([`voice/kfdesc.mp3`], false, () => { that.avPlayer?.playAudio([`voice/kfdesc.mp3`], false, () => {
try { try {
judgeUI.kfArr.forEach((kf, index) => { judgeUI.kfArr.forEach((kf, index) => {
score += Math.abs(Number(kf.score)); score += Math.abs(Number(kf.score));
//TODO 考试分数待替换 //TODO 考试分数待替换
if (score <= (judgeUI.examSubject === "3" ? 10 : 20)) { if (score <= (judgeUI.examSubject === "3" ? 10 : 20)) {
if (judgeUI.kfArr.length - 1 === index) { if (judgeUI.kfArr.length - 1 === index) {
that.avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
router.back(); router.back();
}) })
throw new Error('End Loop') throw new Error('End Loop')
} }
that.avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`]) that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`])
} else { } else {
that.avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
router.back(); router.back();
}) })
throw new Error('End Loop') throw new Error('End Loop')
@ -482,7 +481,7 @@ export class BaseJudge {
} }
}) })
} else { } else {
that.avPlayer.playAudio([voiceURL], true, () => { that.avPlayer?.playAudio([voiceURL], true, () => {
setTimeout(() => { setTimeout(() => {
router.back(); router.back();
}, param302 === "8" ? 3000 : 0) }, param302 === "8" ? 3000 : 0)

View File

@ -1,18 +1,20 @@
{ {
"lockfileVersion": 1, "lockfileVersion": 2,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": { "specifiers": {
"@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3", "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19",
"@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3"
}, },
"packages": { "packages": {
"@ohos/crypto-js@2.0.3": {
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ=="
},
"@ohos/hypium@1.0.19": { "@ohos/hypium@1.0.19": {
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har",
"integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==" "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==",
"registryType": "ohpm"
},
"@ohos/crypto-js@2.0.3": {
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==",
"registryType": "ohpm"
} }
} }
} }