refactor: 更新类型定义,优化代码可读性
This commit is contained in:
parent
365199bf28
commit
e4af4393b7
@ -41,7 +41,17 @@ struct Index {
|
|||||||
@State devPath: string = "/dev/ttyS3"
|
@State devPath: string = "/dev/ttyS3"
|
||||||
@State stopFlag: boolean = false
|
@State stopFlag: boolean = false
|
||||||
@State fromIndex: boolean = false
|
@State fromIndex: boolean = false
|
||||||
@State carInfo: CarInfoType = {}
|
@State carInfo: CarInfoType = {
|
||||||
|
carId: '',
|
||||||
|
examinationRoomId: '',
|
||||||
|
plateNo: '',
|
||||||
|
carNo: '',
|
||||||
|
examSubject: 'C1',
|
||||||
|
isNeedCheck: '0',
|
||||||
|
udpAddress: '',
|
||||||
|
messagePort: '',
|
||||||
|
hintPort: ''
|
||||||
|
}
|
||||||
private vocObj?: voiceService;
|
private vocObj?: voiceService;
|
||||||
private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
|
private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,9 @@ 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: CarInfoType = {};
|
@State carInfo: CarInfoType = {
|
||||||
|
|
||||||
|
};
|
||||||
@State param: VideoConfig = VideoConfigData
|
@State param: VideoConfig = VideoConfigData
|
||||||
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发
|
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发
|
||||||
private vocObj!: voiceService;
|
private vocObj!: voiceService;
|
||||||
|
|||||||
@ -706,7 +706,7 @@ export default class Judge {
|
|||||||
getJudgeInitData = async () => {
|
getJudgeInitData = async () => {
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||||
const judgeUI = this.judgeUI
|
const judgeUI = this.judgeUI
|
||||||
const projectsObj = judgeUI.projectsObj
|
// const projectsObj = judgeUI.projectsObj
|
||||||
const itemInfoObj = judgeUI.itemInfoObj
|
const itemInfoObj = judgeUI.itemInfoObj
|
||||||
const markRuleListObj = judgeUI.markRuleListObj
|
const markRuleListObj = judgeUI.markRuleListObj
|
||||||
const carType = judgeUI.carType
|
const carType = judgeUI.carType
|
||||||
@ -893,9 +893,9 @@ export default class Judge {
|
|||||||
this.rmndg = 1
|
this.rmndg = 1
|
||||||
}
|
}
|
||||||
this.judgeUI.currentXmdm = xmdm;
|
this.judgeUI.currentXmdm = xmdm;
|
||||||
const xmmcStr = project.name||"";
|
const xmmcStr = project?.name || "";
|
||||||
const xmmcCode = project.projectCodeCenter||"";
|
const xmmcCode = project?.projectCodeCenter || "";
|
||||||
const xmmcSingleCode = project.projectCode||"";
|
const xmmcSingleCode = project?.projectCode || "";
|
||||||
const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode)
|
const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode)
|
||||||
kmItem.status = 2;
|
kmItem.status = 2;
|
||||||
this.xmmcStr = xmmcStr;
|
this.xmmcStr = xmmcStr;
|
||||||
@ -955,8 +955,8 @@ export default class Judge {
|
|||||||
type: kf.type
|
type: kf.type
|
||||||
}
|
}
|
||||||
//扣分信息
|
//扣分信息
|
||||||
this.kfArr.push(kfObj)
|
this.kfArr?.push(kfObj)
|
||||||
this.judgeUI.totalScore += thisKf.score * 1;
|
this.judgeUI.totalScore += Number(thisKf?.score);
|
||||||
if (kf.xmdm != 20) {
|
if (kf.xmdm != 20) {
|
||||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, kf.xmdm)
|
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, kf.xmdm)
|
||||||
const type = project.type;
|
const type = project.type;
|
||||||
@ -1016,19 +1016,20 @@ export default class Judge {
|
|||||||
const param611: JudgeConfigObj = Reflect.get(judgeConfigObj, '611') || ''
|
const param611: JudgeConfigObj = Reflect.get(judgeConfigObj, '611') || ''
|
||||||
const xmdm = precast.xmdm
|
const xmdm = precast.xmdm
|
||||||
const xmxh = precast.xmxh
|
const xmxh = precast.xmxh
|
||||||
|
|
||||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
|
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
|
||||||
const xmmcCode = project.projectCodeCenter||""
|
|
||||||
const projectCode = project.projectCode
|
const projectCode = project.projectCode
|
||||||
// const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
|
const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
|
||||||
// const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode;
|
const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode;
|
||||||
const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode)
|
const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode)
|
||||||
|
const xmmcStr = project?.name || "";
|
||||||
kmItem.status = 2;
|
kmItem.status = 2;
|
||||||
Reflect.set(this.kmItems, xmmcCode, project)
|
Reflect.set(this.kmItems, xmmcCode, project)
|
||||||
this.xmmcStr = xmmcStr;
|
this.xmmcStr = xmmcStr||"";
|
||||||
this.xmmcCode = xmmcCode;
|
this.xmmcCode = xmmcCode||"";
|
||||||
this.xmdm = xmdm;
|
this.xmdm = xmdm;
|
||||||
this.xmxh = xmxh;
|
this.xmxh = xmxh;
|
||||||
this.xmmcSingleCode = xmmcSingleCode;
|
this.xmmcSingleCode = xmmcSingleCode||"";
|
||||||
project.type = '2';
|
project.type = '2';
|
||||||
Reflect.set(this.judgeUI.projectsObj, xmdm, project)
|
Reflect.set(this.judgeUI.projectsObj, xmdm, project)
|
||||||
}
|
}
|
||||||
@ -1046,7 +1047,7 @@ export default class Judge {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//语音播报
|
//语音播报
|
||||||
this.goVoiceAnnounce(event, xmdm, this.kfArr, xmjs, ksjs, xmxh)
|
this.goVoiceAnnounce(event, xmdm, this.kfArr||[], xmjs, ksjs, xmxh)
|
||||||
//更新UI
|
//更新UI
|
||||||
if (event == 1 || event == 2 || event == 3 || event == 6) {
|
if (event == 1 || event == 2 || event == 3 || event == 6) {
|
||||||
const copyProjectsObj = this.judgeUI.projectsObj;
|
const copyProjectsObj = this.judgeUI.projectsObj;
|
||||||
@ -1148,7 +1149,7 @@ export default class Judge {
|
|||||||
if (!this.judgeUI.isProjectIn) {
|
if (!this.judgeUI.isProjectIn) {
|
||||||
this.deductedPopShowTimer = setTimeout(() => {
|
this.deductedPopShowTimer = setTimeout(() => {
|
||||||
this.judgeUI.isDeductedPopShow = false
|
this.judgeUI.isDeductedPopShow = false
|
||||||
}, (Reflect.get(param512, 5) || 0) * 1000)
|
}, (Reflect.get(param512!, 5) || 0) * 1000)
|
||||||
}
|
}
|
||||||
project.isEnd = true;
|
project.isEnd = true;
|
||||||
Reflect.set(this.judgeUI.projects, xmdm, project)
|
Reflect.set(this.judgeUI.projects, xmdm, project)
|
||||||
@ -1162,7 +1163,7 @@ export default class Judge {
|
|||||||
const currentKf = kf[kfLen -1];
|
const currentKf = kf[kfLen -1];
|
||||||
if (JudgeConfig.kfVoiceOpen || (examSubject == '2' && judgeConfigObj['618'] == '1') ||
|
if (JudgeConfig.kfVoiceOpen || (examSubject == '2' && judgeConfigObj['618'] == '1') ||
|
||||||
(examSubject == '3' && judgeConfigObj['418'] == '1')) {
|
(examSubject == '3' && judgeConfigObj['418'] == '1')) {
|
||||||
avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`, `voice/mark_${Math.abs(currentKf.score)}.mp3`])
|
avPlayer?.playAudio([`voice/${currentKf.markcatalog}.mp3`, `voice/mark_${Math.abs(currentKf?.score||0)}.mp3`])
|
||||||
}
|
}
|
||||||
const isStart = await checkProjectIsStart(Number(currentKf.xmdm), 2, currentKf);
|
const isStart = await checkProjectIsStart(Number(currentKf.xmdm), 2, currentKf);
|
||||||
if (isStart) {
|
if (isStart) {
|
||||||
@ -1184,7 +1185,7 @@ export default class Judge {
|
|||||||
console.info(judgeTag, '考试结束')
|
console.info(judgeTag, '考试结束')
|
||||||
//关闭录像
|
//关闭录像
|
||||||
const singlePlay = AppStorage.get<boolean>('singlePlay')
|
const singlePlay = AppStorage.get<boolean>('singlePlay')
|
||||||
if (!singlePlay) {
|
if (!singlePlay&&this.videoData) {
|
||||||
await endRecordVideo(this.videoData)
|
await endRecordVideo(this.videoData)
|
||||||
}
|
}
|
||||||
judgeTask.addTask(async () => {
|
judgeTask.addTask(async () => {
|
||||||
@ -1211,15 +1212,15 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
// 考试扣分
|
// 考试扣分
|
||||||
pointsDedute = async (ksxm: number, kf: MarkRule) => {
|
pointsDedute = async (ksxm: number, kf: MarkRule) => {
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
const carInfo = AppStorage.get<CarInfoType>('carInfo')!;
|
||||||
const examSubject = carInfo.examSubject
|
const examSubject = carInfo.examSubject
|
||||||
const plateNo = carInfo.plateNo
|
// const plateNo = carInfo.plateNo
|
||||||
const carNo = carInfo.carNo
|
// const carNo = carInfo.carNo
|
||||||
|
|
||||||
const judgeUI = this.judgeUI
|
const judgeUI = this.judgeUI
|
||||||
const getProjectInfo = this.getProjectInfo
|
// const getProjectInfo = this.getProjectInfo
|
||||||
const fileLog = this.fileLog
|
// const fileLog = this.fileLog
|
||||||
const xmmcSingleCode = this.xmmcSingleCode
|
// const xmmcSingleCode = this.xmmcSingleCode
|
||||||
const xmmcEndCode = this.xmmcEndCode
|
const xmmcEndCode = this.xmmcEndCode
|
||||||
const filePath = this.filePath
|
const filePath = this.filePath
|
||||||
|
|
||||||
@ -1248,7 +1249,7 @@ export default class Judge {
|
|||||||
|
|
||||||
const ksxmD: string = project == undefined
|
const ksxmD: string = project == undefined
|
||||||
? (commonKsxm
|
? (commonKsxm
|
||||||
? (project.projectCodeCenter)
|
? (project?.projectCodeCenter||"")
|
||||||
: (examSubject == '3' ? '30000' : (xmmcEndCode == undefined ? '10000' : xmmcEndCode)))
|
: (examSubject == '3' ? '30000' : (xmmcEndCode == undefined ? '10000' : xmmcEndCode)))
|
||||||
: project.projectCodeCenter
|
: project.projectCodeCenter
|
||||||
const drvexam: DrvexamType = {
|
const drvexam: DrvexamType = {
|
||||||
@ -1258,7 +1259,7 @@ export default class Judge {
|
|||||||
kfxm: kf.markcatalog,
|
kfxm: kf.markcatalog,
|
||||||
kfxmmx: `${ksxm},${kf.markserial}`,
|
kfxmmx: `${ksxm},${kf.markserial}`,
|
||||||
sfzmhm: idCard,
|
sfzmhm: idCard,
|
||||||
kchp: encodeURI(carInfo.plateNo),
|
kchp: encodeURI(carInfo?.plateNo||""),
|
||||||
//扣分方式
|
//扣分方式
|
||||||
kffs: kf.type == 0 ? 1 : 2,
|
kffs: kf.type == 0 ? 1 : 2,
|
||||||
ksdd: encodeURI(ksdd),
|
ksdd: encodeURI(ksdd),
|
||||||
@ -1270,14 +1271,14 @@ export default class Judge {
|
|||||||
jkid: '17C53',
|
jkid: '17C53',
|
||||||
drvexam
|
drvexam
|
||||||
}
|
}
|
||||||
console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm)
|
// console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm)
|
||||||
|
|
||||||
const temp = await this.sendWriteObjectOut(data, filePath);
|
const temp = await this.sendWriteObjectOut(data, filePath);
|
||||||
if (temp.code == 2300007) {
|
if (temp.code == 2300007) {
|
||||||
this.isJudgeDisConnect = true
|
this.isJudgeDisConnect = true
|
||||||
}
|
}
|
||||||
console.info(judgeTag, '项目扣分 end')
|
console.info(judgeTag, '项目扣分 end')
|
||||||
promptWxCode('17C53', temp.code)
|
promptWxCode('17C53', temp?.code||0)
|
||||||
}
|
}
|
||||||
// 评判语音提示
|
// 评判语音提示
|
||||||
goJudgeVoice = async (sound: JudgeSound) => {
|
goJudgeVoice = async (sound: JudgeSound) => {
|
||||||
@ -1286,11 +1287,11 @@ export default class Judge {
|
|||||||
console.info('surenjun code=>', JSON.stringify(sound.code))
|
console.info('surenjun code=>', JSON.stringify(sound.code))
|
||||||
//判断是不是模拟灯光语音
|
//判断是不是模拟灯光语音
|
||||||
if (sound.type == 1) {
|
if (sound.type == 1) {
|
||||||
avPlayer.playAudio([`voice/${sound.code[0]}.mp3`], false, () => {
|
avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`], false, () => {
|
||||||
examJudgeSoundEnd({
|
examJudgeSoundEnd({
|
||||||
xmdm: sound.xmdm, code: sound.code[0], type: sound.type
|
xmdm: sound.xmdm, code: sound.code[0], type: sound.type
|
||||||
})
|
})
|
||||||
fileLog.setExamJudgeData(JSON.stringify({
|
fileLog?.setExamJudgeData(JSON.stringify({
|
||||||
method: 'examJudgeSoundEnd',
|
method: 'examJudgeSoundEnd',
|
||||||
itemno: sound.xmdm,
|
itemno: sound.xmdm,
|
||||||
code: sound.code[0],
|
code: sound.code[0],
|
||||||
@ -1298,7 +1299,7 @@ export default class Judge {
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
avPlayer.playAudio([`voice/${sound.code[0]}.mp3`])
|
avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 处理考试结束
|
// 处理考试结束
|
||||||
@ -1331,11 +1332,11 @@ export default class Judge {
|
|||||||
//自动退出待验证并且不合格
|
//自动退出待验证并且不合格
|
||||||
if (!isManual && examSubject == '3' && (param302 == '1' || (singlePlay && param302 == '2')) &&
|
if (!isManual && examSubject == '3' && (param302 == '1' || (singlePlay && param302 == '2')) &&
|
||||||
totalScore < passingScore) {
|
totalScore < passingScore) {
|
||||||
avPlayer.playAudio([`voice/考试结束.mp3`])
|
avPlayer?.playAudio([`voice/考试结束.mp3`])
|
||||||
}
|
}
|
||||||
//联网模式下手动结束的直接退出
|
//联网模式下手动结束的直接退出
|
||||||
if (!singlePlay && isManual && !isAllProjectsEnd) {
|
if (!singlePlay && isManual && !isAllProjectsEnd) {
|
||||||
avPlayer.playAudio(['voice/empty.mp3'], true, () => {
|
avPlayer?.playAudio(['voice/empty.mp3'], true, () => {
|
||||||
this.isUdpEnd = true;
|
this.isUdpEnd = true;
|
||||||
closeAllFiles()
|
closeAllFiles()
|
||||||
router.back();
|
router.back();
|
||||||
@ -1352,7 +1353,7 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await handleSEP(306);
|
await handleSEP(306);
|
||||||
avPlayer.playAudio(['voice/exam_waiting.mp3'], AppStorage.get('singlePlay'), async () => {
|
avPlayer?.playAudio(['voice/exam_waiting.mp3'], AppStorage.get('singlePlay'), async () => {
|
||||||
try {
|
try {
|
||||||
if (!singlePlay) {
|
if (!singlePlay) {
|
||||||
// TODO const bytes = await this.getMessageHeartbeat(true);
|
// TODO const bytes = await this.getMessageHeartbeat(true);
|
||||||
@ -1367,10 +1368,10 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
// 考试结束
|
// 考试结束
|
||||||
public endExam = async (isManual?: Boolean) => {
|
public endExam = async (isManual?: Boolean) => {
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
const carInfo = AppStorage.get<CarInfoType>('carInfo')!;
|
||||||
const singlePlay = AppStorage.get<boolean>('singlePlay')
|
const singlePlay = AppStorage.get<boolean>('singlePlay')||false
|
||||||
const examSubject = carInfo.examSubject
|
const examSubject = carInfo?.examSubject||"2"
|
||||||
const plateNo = carInfo.plateNo
|
const plateNo = carInfo?.plateNo||""
|
||||||
|
|
||||||
const judgeUI = this.judgeUI
|
const judgeUI = this.judgeUI
|
||||||
const ksjs = this.ksjs
|
const ksjs = this.ksjs
|
||||||
@ -1392,11 +1393,11 @@ export default class Judge {
|
|||||||
// await uploadDisConnectData();
|
// await uploadDisConnectData();
|
||||||
const time = GetCurrentTime();
|
const time = GetCurrentTime();
|
||||||
const photoBase64 = await getPhoto();
|
const photoBase64 = await getPhoto();
|
||||||
const d1 = ksjs.d1;
|
const d1 = ksjs?.d1||0;
|
||||||
const d2 = ksjs.d2;
|
const d2 = ksjs?.d2||0;
|
||||||
const d3 = ksjs.d3;
|
const d3 = ksjs?.d3||0;
|
||||||
const d4 = ksjs.d4;
|
const d4 = ksjs?.d4||0;
|
||||||
const d5 = ksjs.d5;
|
const d5 = ksjs?.d5||0;
|
||||||
|
|
||||||
const drvexam: DrvexamType = {
|
const drvexam: DrvexamType = {
|
||||||
lsh,
|
lsh,
|
||||||
@ -1406,7 +1407,7 @@ export default class Judge {
|
|||||||
zp: photoBase64,
|
zp: photoBase64,
|
||||||
jssj: time,
|
jssj: time,
|
||||||
kscj: (totalScore * 1) > 0 ? totalScore : 0,
|
kscj: (totalScore * 1) > 0 ? totalScore : 0,
|
||||||
kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100),
|
kslc: Math.ceil(((ksjs?.qjjl ?? 0) + (ksjs?.dcjl ?? 0)) / 100),
|
||||||
// 1,22;2,560;3,128;4,0;5,0;
|
// 1,22;2,560;3,128;4,0;5,0;
|
||||||
dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'),
|
dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'),
|
||||||
}
|
}
|
||||||
@ -1421,11 +1422,11 @@ export default class Judge {
|
|||||||
router.back()
|
router.back()
|
||||||
}, 90 * 1000)
|
}, 90 * 1000)
|
||||||
const temp = await this.sendWriteObjectOut(data, filePath);
|
const temp = await this.sendWriteObjectOut(data, filePath);
|
||||||
promptWxCode('17C56', temp.code)
|
promptWxCode('17C56', temp?.code||0)
|
||||||
|
|
||||||
if (temp.code != 1) {
|
if (temp.code != 1) {
|
||||||
avPlayer.playAudio(['voice/监管失败.mp3'])
|
avPlayer?.playAudio(['voice/监管失败.mp3'])
|
||||||
this.judgeUI.errorMsg = decodeURIComponent(temp.message)
|
this.judgeUI.errorMsg = decodeURIComponent(temp?.message||"")
|
||||||
|
|
||||||
if (temp.code == 2300028 || temp.code == 2300007) {
|
if (temp.code == 2300028 || temp.code == 2300007) {
|
||||||
this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!'
|
this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!'
|
||||||
@ -1504,24 +1505,24 @@ export default class Judge {
|
|||||||
let score = 0;
|
let score = 0;
|
||||||
//结束考试时候是否播报一遍所有扣分
|
//结束考试时候是否播报一遍所有扣分
|
||||||
const param634: string = Reflect.get(judgeConfigObj, '634')
|
const param634: string = Reflect.get(judgeConfigObj, '634')
|
||||||
if (kfArr.length && ((examSubject == '2' && param634 == '1') || examSubject == '3')) {
|
if (kfArr&&kfArr.length && ((examSubject == '2' && param634 == '1') || examSubject == '3')) {
|
||||||
avPlayer.playAudio([`voice/kfdesc.mp3`], false, () => {
|
avPlayer?.playAudio([`voice/kfdesc.mp3`], false, () => {
|
||||||
try {
|
try {
|
||||||
kfArr.forEach((kf, index) => {
|
kfArr.forEach((kf, index) => {
|
||||||
score += Math.abs(Number(kf.score));
|
score += Math.abs(Number(kf.score));
|
||||||
//TODO 考试分数待替换
|
//TODO 考试分数待替换
|
||||||
if (score <= (examSubject == '3' ? 10 : 20)) {
|
if (score <= (examSubject == '3' ? 10 : 20)) {
|
||||||
if (kfArr.length - 1 === index) {
|
if (kfArr&&kfArr.length - 1 === index) {
|
||||||
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
|
avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
|
||||||
this.isUdpEnd = true;
|
this.isUdpEnd = true;
|
||||||
closeAllFiles()
|
closeAllFiles()
|
||||||
router.back();
|
router.back();
|
||||||
})
|
})
|
||||||
throw new Error('End Loop')
|
throw new Error('End Loop')
|
||||||
}
|
}
|
||||||
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`])
|
avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`])
|
||||||
} else {
|
} else {
|
||||||
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
|
avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
|
||||||
this.isUdpEnd = true;
|
this.isUdpEnd = true;
|
||||||
closeAllFiles()
|
closeAllFiles()
|
||||||
router.back();
|
router.back();
|
||||||
@ -1534,7 +1535,7 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
avPlayer.playAudio([voiceURL], true, () => {
|
avPlayer?.playAudio([voiceURL], true, () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.isUdpEnd = true
|
this.isUdpEnd = true
|
||||||
closeAllFiles()
|
closeAllFiles()
|
||||||
@ -1691,7 +1692,8 @@ export default class Judge {
|
|||||||
return '0000000000'
|
return '0000000000'
|
||||||
}
|
}
|
||||||
const projectKey = `${ksxm}_${xmxh}`;
|
const projectKey = `${ksxm}_${xmxh}`;
|
||||||
const currentCdsb: CDSBInfo = Reflect.get(cdsbInfoObj, projectKey) || {}
|
// const currentCdsb: CDSBInfo = Reflect.get(cdsbInfoObj, projectKey) || {}
|
||||||
|
const currentCdsb: CDSBInfo = (Reflect.get(cdsbInfoObj, projectKey) ?? {}) as CDSBInfo;
|
||||||
const sbxh: string = currentCdsb.sbbh || '0000000000'
|
const sbxh: string = currentCdsb.sbbh || '0000000000'
|
||||||
return sbxh
|
return sbxh
|
||||||
}
|
}
|
||||||
@ -1750,7 +1752,7 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
// 获取模型数据
|
// 获取模型数据
|
||||||
getModelData = (modelName: string) => {
|
getModelData = (modelName: string) => {
|
||||||
const modelData = this.fileModel.getModelContent(this.modelPath, modelName);
|
const modelData = this.fileModel?.getModelContent(this.modelPath, modelName);
|
||||||
return modelData
|
return modelData
|
||||||
}
|
}
|
||||||
// 统计必考项目、所有项目、已考数量
|
// 统计必考项目、所有项目、已考数量
|
||||||
@ -1795,19 +1797,19 @@ export default class Judge {
|
|||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
this.judgeUI.dwztErrorVisible = true;
|
this.judgeUI.dwztErrorVisible = true;
|
||||||
avPlayer.playAudio([`voice/差分状态异常.mp3`], true)
|
avPlayer?.playAudio([`voice/差分状态异常.mp3`], true)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
router.back()
|
router.back()
|
||||||
}, 3000)
|
}, 3000)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
avPlayer.playAudio([`voice/差分状态异常.mp3`], true);
|
avPlayer?.playAudio([`voice/差分状态异常.mp3`], true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.judgeUI.dwztErrorVisible = true;
|
this.judgeUI.dwztErrorVisible = true;
|
||||||
avPlayer.playAudio([`voice/差分状态异常.mp3`], true);
|
avPlayer?.playAudio([`voice/差分状态异常.mp3`], true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
@ -1818,7 +1820,7 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
closeAllFiles = () => {
|
closeAllFiles = () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.fileLog.closeAllFiles()
|
this.fileLog?.closeAllFiles()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1833,7 +1835,7 @@ export default class Judge {
|
|||||||
const manualMarkRules = judgeUI.manualMarkRules
|
const manualMarkRules = judgeUI.manualMarkRules
|
||||||
|
|
||||||
const fileLog = new FileLog(judgeUI.context);
|
const fileLog = new FileLog(judgeUI.context);
|
||||||
const filePath = await fileLog.initFileLogo({
|
const filePath = await fileLog?.initFileLogo({
|
||||||
name, lsh, idCard
|
name, lsh, idCard
|
||||||
});
|
});
|
||||||
this.fileLog = fileLog;
|
this.fileLog = fileLog;
|
||||||
@ -1858,13 +1860,13 @@ export default class Judge {
|
|||||||
console.info(judgeTag, '1.进入评判入口')
|
console.info(judgeTag, '1.进入评判入口')
|
||||||
await examJudgeSetLogCallback(3, async (level: number, info: string, len: number) => {
|
await examJudgeSetLogCallback(3, async (level: number, info: string, len: number) => {
|
||||||
console.log('评判日志:' + info)
|
console.log('评判日志:' + info)
|
||||||
await fileLog.setExamJudgeLogData(info);
|
await fileLog?.setExamJudgeLogData(info);
|
||||||
})
|
})
|
||||||
|
|
||||||
console.info(judgeTag, '2.注册日志回调完成')
|
console.info(judgeTag, '2.注册日志回调完成')
|
||||||
|
|
||||||
let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData();
|
let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData();
|
||||||
await fileLog.setExamJudgeData(JSON.stringify(initInfo))
|
await fileLog?.setExamJudgeData(JSON.stringify(initInfo))
|
||||||
//相关评判初始化只做一次
|
//相关评判初始化只做一次
|
||||||
if (!isJudgeInitBool) {
|
if (!isJudgeInitBool) {
|
||||||
const tempJudge = await examJudgeInit(initInfo);
|
const tempJudge = await examJudgeInit(initInfo);
|
||||||
@ -1874,7 +1876,7 @@ export default class Judge {
|
|||||||
AppStorage.setOrCreate('isJudge', true)
|
AppStorage.setOrCreate('isJudge', true)
|
||||||
// 2.评判过程回调
|
// 2.评判过程回调
|
||||||
await examJudgeSetRealExamCallback(async (strData: string, len: number) => {
|
await examJudgeSetRealExamCallback(async (strData: string, len: number) => {
|
||||||
await fileLog.setExamJudgeCallbackData(strData)
|
await fileLog?.setExamJudgeCallbackData(strData)
|
||||||
console.info('评判回调数据', strData)
|
console.info('评判回调数据', strData)
|
||||||
this.handleRealExam(strData, callBack)
|
this.handleRealExam(strData, callBack)
|
||||||
})
|
})
|
||||||
@ -1892,7 +1894,7 @@ export default class Judge {
|
|||||||
// globalThis.laneData = performInfo.lane;
|
// globalThis.laneData = performInfo.lane;
|
||||||
})
|
})
|
||||||
|
|
||||||
let beginExamInfo: JudgeBeginObj = undefined
|
let beginExamInfo: JudgeBeginObj|undefined = undefined
|
||||||
// 3.开始考试
|
// 3.开始考试
|
||||||
if (isTrajectoryOpen) {
|
if (isTrajectoryOpen) {
|
||||||
beginExamInfo = JSON.parse(strArr[1])
|
beginExamInfo = JSON.parse(strArr[1])
|
||||||
@ -1900,10 +1902,10 @@ export default class Judge {
|
|||||||
} else {
|
} else {
|
||||||
beginExamInfo = await getJudgeBeginData()
|
beginExamInfo = await getJudgeBeginData()
|
||||||
}
|
}
|
||||||
await fileLog.setExamJudgeData(JSON.stringify(beginExamInfo))
|
await fileLog?.setExamJudgeData(JSON.stringify(beginExamInfo))
|
||||||
await examJudgeBeginExam(beginExamInfo);
|
await examJudgeBeginExam(beginExamInfo);
|
||||||
console.info(judgeTag, '6.开始考试注册完成')
|
console.info(judgeTag, '6.开始考试注册完成')
|
||||||
avPlayer.playAudio([judgeUI.singlePlay ? 'voice/ksks.wav' : 'voice/监管成功.mp3'])
|
avPlayer?.playAudio([judgeUI.singlePlay ? 'voice/ksks.wav' : 'voice/监管成功.mp3'])
|
||||||
|
|
||||||
if (!judgeUI.singlePlay) {
|
if (!judgeUI.singlePlay) {
|
||||||
this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`, this.context)
|
this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`, this.context)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user