考试结束优化

This commit is contained in:
lixiao 2025-07-24 17:31:54 +08:00
parent d1835688b6
commit 9a529fe649
2 changed files with 98 additions and 93 deletions

View File

@ -7,9 +7,9 @@ import DeductedPopup from './compontents/judge/DeductionPopup';
import AmplifyPopup from './compontents/judge/AmplifyPopup'; import AmplifyPopup from './compontents/judge/AmplifyPopup';
import Judge from './judgeSDK/judge'; import Judge from './judgeSDK/judge';
import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon'; import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon';
import {uploadExamMileage} from '../api/judge' import { uploadExamMileage } from '../api/judge'
import DwztErrorPopup from './compontents/judge/DwztErrorPopup' import DwztErrorPopup from './compontents/judge/DwztErrorPopup'
import {debounce} from '../common/utils/tools' import { debounce } from '../common/utils/tools'
import MsgPopup from './compontents/judge/MsgPopup' import MsgPopup from './compontents/judge/MsgPopup'
import { import {
@ -37,7 +37,7 @@ import { voiceService } from '../common/service/voiceService';
@Entry @Entry
@Component @Component
struct Index { struct Index {
async aboutToDisappear(){ async aboutToDisappear() {
clearInterval(this.mileageTimer) clearInterval(this.mileageTimer)
} }
@ -112,7 +112,7 @@ struct Index {
BK2: carInfo.bk2, BK2: carInfo.bk2,
X_MCH: carInfo.x_mch, X_MCH: carInfo.x_mch,
}) })
console.info('surenjun =>carinfoArrr',JSON.stringify( this.carinfoArr)) console.info('surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr))
} }
// 获取考生信息 // 获取考生信息
@ -122,7 +122,7 @@ struct Index {
const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl,xldm} = stuInfo; const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl,xldm} = stuInfo;
this.name = xm || '测试考生'; this.name = xm || '测试考生';
this.idCard = sfzmhm || '01234567891010'; this.idCard = sfzmhm || '01234567891010';
this.lsh = globalThis.singlePlay?'0000000000000':lsh; this.lsh = globalThis.singlePlay ? '0000000000000' : lsh;
this.kszp = kszp; this.kszp = kszp;
this.ksdd = ksdd; this.ksdd = ksdd;
this.kssycs = kssycs; this.kssycs = kssycs;
@ -189,13 +189,13 @@ struct Index {
} }
//623 考试中是否可以查看轨迹画面(0-否+1-是) //623 考试中是否可以查看轨迹画面(0-否+1-是)
if(sys.v_no == '623'){ if (sys.v_no == '623') {
this.syssetParam623 = value == '1'?true:false this.syssetParam623 = value == '1' ? true : false
} }
//科目三应行驶距离参数 //科目三应行驶距离参数
if (sys.v_no == '303') { if (sys.v_no == '303') {
this.examMileage = this.examMileage == '0'?(sys.v_value + ''): this.examMileage; this.examMileage = this.examMileage == '0' ? (sys.v_value + '') : this.examMileage;
} }
// //地点版本参数 // //地点版本参数
@ -213,7 +213,7 @@ struct Index {
const currentProject = this.projectsObj[xmdm] const currentProject = this.projectsObj[xmdm]
// 过滤考前绕车一周上车准备的扣分 // 过滤考前绕车一周上车准备的扣分
if(sczb == 1 && xmdm == '1'){ if (sczb == 1 && xmdm == '1') {
return return
} }
@ -244,7 +244,7 @@ struct Index {
//初始化systemParam表 //初始化systemParam表
async initSystemParam(sysParam?: SYSTEMPARMARR[]) { async initSystemParam(sysParam?: SYSTEMPARMARR[]) {
const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM') const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM')
console.info('surenjun => systemParms',JSON.stringify(systemParms)); console.info('surenjun => systemParms', JSON.stringify(systemParms));
let currentParams: any = router.getParams(); let currentParams: any = router.getParams();
const {carName,carType,examSubject} = this; const {carName,carType,examSubject} = this;
@ -255,7 +255,7 @@ struct Index {
} }
//真实监管下发的项目 //真实监管下发的项目
let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item); let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item);
console.info('surenjun kStringArr',JSON.stringify(kStringArr)) console.info('surenjun kStringArr', JSON.stringify(kStringArr))
let isInExam = kStringArr.length > 0; let isInExam = kStringArr.length > 0;
const {isTrajectoryOpen} = judgeConfig const {isTrajectoryOpen} = judgeConfig
let carNo = '', allItems = []; let carNo = '', allItems = [];
@ -269,8 +269,8 @@ struct Index {
systemParm.txt3 = systemParm.TXT3; systemParm.txt3 = systemParm.TXT3;
} }
const {no1,no2,no3,} = systemParm; const {no1,no2,no3,} = systemParm;
const txt1 = decodeURI(systemParm.txt1) const txt1 = decodeURI(systemParm.txt1)
const txt2 = decodeURI(systemParm.txt2) const txt2 = decodeURI(systemParm.txt2)
//获取当前考车的no2 //获取当前考车的no2
if (no1 == 3 && no3 == 1) { if (no1 == 3 && no3 == 1) {
if (txt1 === carName) { if (txt1 === carName) {
@ -280,11 +280,11 @@ struct Index {
} }
//获取及格分数线 //获取及格分数线
if(no1 == 3 && no3 == 3 && carNo === no2){ if (no1 == 3 && no3 == 3 && carNo === no2) {
this.passingScore = Number(txt1) || 0; this.passingScore = Number(txt1) || 0;
} }
//根据车型获取应行驶里程数 //根据车型获取应行驶里程数
if(no1 == 3 && no3 ==15 && carNo === no2){ if (no1 == 3 && no3 == 15 && carNo === no2) {
this.examMileage = ((decodeURI(systemParm.txt1)) || '').split('^')[0]; this.examMileage = ((decodeURI(systemParm.txt1)) || '').split('^')[0];
} }
//获取当前考车的考试项目 //获取当前考车的考试项目
@ -312,20 +312,20 @@ struct Index {
projectCode: no2, projectCode: no2,
projectCodeCenter: txt2, projectCodeCenter: txt2,
//是否是必考 加减档设置成非必考 //是否是必考 加减档设置成非必考
isRequired: no2== 14 ? false : allItems.includes(no2 + ''), isRequired: no2 == 14 ? false : allItems.includes(no2 + ''),
//是否考过了 //是否考过了
isEnd: false, isEnd: false,
//项目开始数据是否上传过 //项目开始数据是否上传过
isUpload:false, isUpload: false,
} }
this.projectsObj[no2*1] = currentProject this.projectsObj[no2*1] = currentProject
this.projectsCenterObj[txt2] = currentProject this.projectsCenterObj[txt2] = currentProject
this.projects.push(currentProject); this.projects.push(currentProject);
//真实监管下发考试项目 //真实监管下发考试项目
if(isInExam && !(kStringArr.includes(txt2) || kStringArr.includes(no2+''))){ if (isInExam && !(kStringArr.includes(txt2) || kStringArr.includes(no2 + ''))) {
console.info('surenjun =>',txt2) console.info('surenjun =>', txt2)
console.info('surenjun => no2',no2) console.info('surenjun => no2', no2)
this.projectsObj[no2*1].type = '3' this.projectsObj[no2*1].type = '3'
this.projectsObj[no2*1].isUpload = true this.projectsObj[no2*1].isUpload = true
this.projectsObj[no2*1].isEnd = true this.projectsObj[no2*1].isEnd = true
@ -347,7 +347,7 @@ struct Index {
}) })
}) })
const projects = this.projects; const projects = this.projects;
console.info('surenjun',JSON.stringify(this.ddxkKsxmArr)) console.info('surenjun', JSON.stringify(this.ddxkKsxmArr))
if (!projects.length) { if (!projects.length) {
Prompt.showToast({ Prompt.showToast({
@ -369,7 +369,7 @@ struct Index {
const newKey = key.split('~').join('_') const newKey = key.split('~').join('_')
//@ts-ignore //@ts-ignore
const xmdm = key.split('~')[0] * 1 const xmdm = key.split('~')[0] * 1
if(projectsObj[xmdm]){ if (projectsObj[xmdm]) {
this.cdsbInfoObj[newKey] = { this.cdsbInfoObj[newKey] = {
kdid: cdsb.kdid, kdid: cdsb.kdid,
sbbh: cdsb.sbbh, sbbh: cdsb.sbbh,
@ -384,18 +384,18 @@ struct Index {
} }
// 获取itemInfo表信息 // 获取itemInfo表信息
async initItemInfo(){ async initItemInfo() {
const infoParams = await getSyncData('MA_ITEMINFO'); const infoParams = await getSyncData('MA_ITEMINFO');
const carlist = this.carlist; const carlist = this.carlist;
const projectsObj = this.projectsObj const projectsObj = this.projectsObj
//@ts-ignore //@ts-ignore
infoParams.forEach((info)=>{ infoParams.forEach((info) => {
const key = decodeURI(info.itemsno); const key = decodeURI(info.itemsno);
const carlistArr = info.carlist === '' ? [] : (decodeURI(info.carlist).split(',') || []); const carlistArr = info.carlist === '' ? [] : (decodeURI(info.carlist).split(',') || []);
const newKey = key.split('~').join('_') const newKey = key.split('~').join('_')
//@ts-ignore //@ts-ignore
const xmdm = key.split('~')[0] * 1 const xmdm = key.split('~')[0] * 1
if(projectsObj[xmdm] && (carlistArr.length == 0 || carlistArr.includes(carlist))){ if (projectsObj[xmdm] && (carlistArr.length == 0 || carlistArr.includes(carlist))) {
this.itemInfoObj[newKey] = { this.itemInfoObj[newKey] = {
modelKey: newKey, modelKey: newKey,
xmdm, xmdm,
@ -440,7 +440,7 @@ struct Index {
//断点续考 //断点续考
ddxkKsxmArr.forEach(xmdm => { ddxkKsxmArr.forEach(xmdm => {
const projectCode = this.projectsCenterObj[xmdm].projectCode const projectCode = this.projectsCenterObj[xmdm].projectCode
if(this.projectsObj[projectCode]){ if (this.projectsObj[projectCode]) {
this.projectsObj[projectCode].type = '3' this.projectsObj[projectCode].type = '3'
this.projectsObj[projectCode].isUpload = true this.projectsObj[projectCode].isUpload = true
this.projectsObj[projectCode].isEnd = true this.projectsObj[projectCode].isEnd = true
@ -550,17 +550,45 @@ struct Index {
} }
// 上传考试里程 // 上传考试里程
async uploadMileage(){ async uploadMileage() {
if(!globalThis.singlePlay){ if (!globalThis.singlePlay) {
const {lsh,startExamTime:kskssj,jl:kslc} = this const {lsh,startExamTime:kskssj,jl:kslc} = this
const { carId ,examinationRoomId} = globalThis.carInfo; const { carId ,examinationRoomId} = globalThis.carInfo;
await uploadExamMileage({ await uploadExamMileage({
carId,examinationRoomId, carId,
lsh,kskssj,kslc examinationRoomId,
lsh,
kskssj,
kslc
}) })
} }
} }
async endExam() {
if (this.isErrorMsgEnd) {
this.judge.closeAllFiles()
router.back()
return
}
if (this.judgeConfigObj['344'] == 1) {
Prompt.showToast({
message: '考试未结束,不允许手动退出!',
duration: 4000
});
return
}
this.endPopupVisible = false;
this.loadingPopupVisible = true
clearInterval(this.timer);
clearInterval(globalThis.judgeTimer)
try {
this.judge.checkExamIsEnd(true);
} catch (e) {
this.judge.closeAllFiles()
router.back()
}
}
build() { build() {
Column() { Column() {
Row() { Row() {
@ -890,7 +918,11 @@ struct Index {
// name: 'button_media.wav' // name: 'button_media.wav'
// }) // })
if (this.judgeConfigObj['353'] == '0') { if (this.judgeConfigObj['353'] == '0') {
this.endPopupVisible = true if (this.getNotEndProjects().length > 0) {
this.endPopupVisible = true
return
}
this.endExam()
} else { } else {
Prompt.showToast({ Prompt.showToast({
message: '车上不允许手动结束考试!', message: '车上不允许手动结束考试!',
@ -923,15 +955,15 @@ struct Index {
this.isDeductedPopShow = false; this.isDeductedPopShow = false;
this.defaultTabIndex = 0; this.defaultTabIndex = 0;
}, },
confirmMark: async (itemno, serial)=>{ confirmMark: async (itemno, serial) => {
clearTimeout(this.popTimer) clearTimeout(this.popTimer)
this.popTimer = null this.popTimer = null
this.popTimer = setTimeout(async ()=>{ this.popTimer = setTimeout(async () => {
const judge = this.judge const judge = this.judge
await judge.setJudgeMark(itemno, serial); await judge.setJudgeMark(itemno, serial);
this.isDeductedPopShow = false this.isDeductedPopShow = false
this.popTimer = null; this.popTimer = null;
},500) }, 500)
} }
}) })
} }
@ -942,7 +974,7 @@ struct Index {
showBack: false, showBack: false,
scaleNum: 1.8, scaleNum: 1.8,
msgStr: this.judge.plcStr || '', msgStr: this.judge.plcStr || '',
showTrajectory:globalThis.singlePlay ? true : (this.syssetParam623), showTrajectory: globalThis.singlePlay ? true : (this.syssetParam623),
}).margin({ top: 100 }) }).margin({ top: 100 })
Row() { Row() {
@ -966,15 +998,15 @@ struct Index {
if (this.isAmplifyPopShow && this.examSubject == 3) { if (this.isAmplifyPopShow && this.examSubject == 3) {
AmplifyPopup({ AmplifyPopup({
amplifyImgIndex: this.amplifiedImgIndex, amplifyImgIndex: this.amplifiedImgIndex,
confirmAmplify:async (amplify)=>{ confirmAmplify: async (amplify) => {
clearTimeout(this.popTimer) clearTimeout(this.popTimer)
this.popTimer = null this.popTimer = null
this.popTimer = setTimeout(async ()=>{ this.popTimer = setTimeout(async () => {
const judge = this.judge const judge = this.judge
await judge.setJudgeItem(amplify.projectCode, 1); await judge.setJudgeItem(amplify.projectCode, 1);
this.isAmplifyPopShow = false this.isAmplifyPopShow = false
this.popTimer = null; this.popTimer = null;
},500) }, 500)
}, },
closeAmplifyPop: () => { closeAmplifyPop: () => {
this.isAmplifyPopShow = false this.isAmplifyPopShow = false
@ -985,34 +1017,12 @@ struct Index {
//结束考试弹窗 //结束考试弹窗
if (this.endPopupVisible) { if (this.endPopupVisible) {
EndPoPup({ EndPoPup({
title: this.getNotEndProjects().length ? `当前考试存在未完成的项目:${this.getNotEndProjects().join('、')},确定结束考试吗?` :'确定结束考试吗?', title: `当前考试存在未完成的项目:${this.getNotEndProjects().join('、')},确定结束考试吗?`,
cancelFn: () => { cancelFn: () => {
this.endPopupVisible = false; this.endPopupVisible = false;
}, },
confirmFn: async () => { confirmFn: async () => {
if(this.isErrorMsgEnd){ this.endExam()
this.judge.closeAllFiles()
router.back()
return
}
if (this.judgeConfigObj['344'] == 1) {
Prompt.showToast({
message: '考试未结束,不允许手动退出!',
duration: 4000
});
return
}
this.endPopupVisible = false;
this.loadingPopupVisible = true
clearInterval(this.timer);
clearInterval(globalThis.judgeTimer)
try {
this.judge.checkExamIsEnd(true);
} catch (e) {
this.judge.closeAllFiles()
router.back()
}
} }
}) })
} }
@ -1024,28 +1034,28 @@ struct Index {
}) })
} }
if (this.errorMsg){ if (this.errorMsg) {
MsgPopup({ MsgPopup({
title: this.errorMsg, title: this.errorMsg,
confirmFn:()=>{ confirmFn: () => {
this.errorMsg = '' this.errorMsg = ''
this.isErrorMsgEnd = true; this.isErrorMsgEnd = true;
if(this.disConnectErrorOpen){ if (this.disConnectErrorOpen) {
globalThis.context.terminateSelf() globalThis.context.terminateSelf()
}else{ } else {
router.back() router.back()
} }
}, },
}) })
} }
if(this.dwztErrorVisible){ if (this.dwztErrorVisible) {
DwztErrorPopup({ DwztErrorPopup({
title:'当前差分状态异常,学员将无法正常进行考试评判,请将车辆行驶到开阔地,等待程序自检,差分正常后会自动关闭该对话框', title: '当前差分状态异常,学员将无法正常进行考试评判,请将车辆行驶到开阔地,等待程序自检,差分正常后会自动关闭该对话框',
cancelFn:()=>{ cancelFn: () => {
this.dwztErrorVisible = false; this.dwztErrorVisible = false;
}, },
confirmFn:()=>{ confirmFn: () => {
clearInterval(this.timer); clearInterval(this.timer);
clearInterval(globalThis.judgeTimer) clearInterval(globalThis.judgeTimer)
this.judge.checkExamIsEnd(true); this.judge.checkExamIsEnd(true);
@ -1053,7 +1063,7 @@ struct Index {
}) })
} }
if(this.disConnectErrorOpen){ if (this.disConnectErrorOpen) {
} }
} }
@ -1090,14 +1100,14 @@ struct Index {
projectsObj projectsObj
} = this; } = this;
const projectCode = artSubject3ProjectsCodesArr[index]; const projectCode = artSubject3ProjectsCodesArr[index];
if(index === 5) { if (index === 5) {
console.info('surenjun 靠边停车状态=> ',getIsExitManualProject(index)) console.info('surenjun 靠边停车状态=> ', getIsExitManualProject(index))
} }
if (getIsExitManualProject(index)) { if (getIsExitManualProject(index)) {
// 正在进行的项目 取消项目 // 正在进行的项目 取消项目
if (isManualProjectIn && projectsObj[projectCode].type == '2') { if (isManualProjectIn && projectsObj[projectCode].type == '2') {
//判断人工是否能取消项目 && 当前项目有扣分的不能取消 //判断人工是否能取消项目 && 当前项目有扣分的不能取消
if(judgeConfigObj['340'] == 1 && projectsObj[projectCode].type != '5'){ if (judgeConfigObj['340'] == 1 && projectsObj[projectCode].type != '5') {
await this.judge.setJudgeItem(projectCode, 2); await this.judge.setJudgeItem(projectCode, 2);
Prompt.showToast({ Prompt.showToast({
message: '项目取消', message: '项目取消',
@ -1113,11 +1123,11 @@ struct Index {
if (xmmcStr == '无' || xmmcStr == '') { if (xmmcStr == '无' || xmmcStr == '') {
//512[6] 人工项目按钮放大确认 //512[6] 人工项目按钮放大确认
const param512 = (judgeConfigObj['512'] || '').split(','); const param512 = (judgeConfigObj['512'] || '').split(',');
console.info('surenjun',param512) console.info('surenjun', param512)
if(param512[6] !== '0'){ if (param512[6] !== '0') {
this.amplifiedImgIndex = index; this.amplifiedImgIndex = index;
this.isAmplifyPopShow = true this.isAmplifyPopShow = true
}else{ } else {
const judge = this.judge const judge = this.judge
await judge.setJudgeItem(projectCode, 1); await judge.setJudgeItem(projectCode, 1);
} }
@ -1148,7 +1158,7 @@ struct Index {
getProjectIsInRoad getProjectIsInRoad
} = this; } = this;
const projectCode = artSubject3ProjectsCodesArr[index]; const projectCode = artSubject3ProjectsCodesArr[index];
if(projectsObj[projectCode] === undefined){ if (projectsObj[projectCode] === undefined) {
return false return false
} }
const projectType = projectsObj[projectCode].type; const projectType = projectsObj[projectCode].type;
@ -1216,7 +1226,6 @@ struct Index {
} }
return true return true
} }
// 判断项目是否在当前路段号 // 判断项目是否在当前路段号
getProjectIsInRoad = (projectCode: string,) => { getProjectIsInRoad = (projectCode: string,) => {
const { const {
@ -1244,7 +1253,7 @@ struct Index {
return false return false
} }
if(projectRoads[projectCode].length == 0){ if (projectRoads[projectCode].length == 0) {
return true return true
} }
@ -1276,7 +1285,6 @@ struct Index {
return true return true
} }
// 获取人工项目是否已做 // 获取人工项目是否已做
getIsEndManualProject = (index: number) => { getIsEndManualProject = (index: number) => {
const projectName = this.artSubject3Projects[index]; const projectName = this.artSubject3Projects[index];
@ -1287,19 +1295,18 @@ struct Index {
} }
return (type == '3' || type == '4') ? `${projectName}_red` : `${projectName}_green`; return (type == '3' || type == '4') ? `${projectName}_red` : `${projectName}_green`;
} }
// 获取是否能进行人工评判 // 获取是否能进行人工评判
getIsManualKf = () =>{ getIsManualKf = () => {
const {examSubject} = this; const {examSubject} = this;
if(examSubject == 3){ if (examSubject == 3) {
//杭州训练模式不允许人工评判 //杭州训练模式不允许人工评判
if(globalThis.singlePlay && this.judgeConfigObj['211'] == 'zjhz'){ if (globalThis.singlePlay && this.judgeConfigObj['211'] == 'zjhz') {
return false return false
} }
if(this.judgeConfigObj['342'] == '0'){ if (this.judgeConfigObj['342'] == '0') {
return true return true
} }
}else{ } else {
return false return false
} }
} }
@ -1307,7 +1314,7 @@ struct Index {
getNotEndProjects = () => { getNotEndProjects = () => {
const projectsObj = this.projectsObj; const projectsObj = this.projectsObj;
const notEndProjectsNames = []; const notEndProjectsNames = [];
Reflect.ownKeys(projectsObj).forEach((projectKey:string) => { Reflect.ownKeys(projectsObj).forEach((projectKey: string) => {
const { type, isRequired ,name} = projectsObj[projectKey]; const { type, isRequired ,name} = projectsObj[projectKey];
if (isRequired) { if (isRequired) {
if (type == undefined || type == '1' || type == '2') { if (type == undefined || type == '1' || type == '2') {
@ -1317,8 +1324,6 @@ struct Index {
}) })
return notEndProjectsNames; return notEndProjectsNames;
} }
scroller: Scroller = new Scroller() scroller: Scroller = new Scroller()
//页面通用字体大小 //页面通用字体大小
@State wayno: number = 0 @State wayno: number = 0
@ -1422,8 +1427,8 @@ struct Index {
@State mileageTimer: number = 0; @State mileageTimer: number = 0;
@State passingScore: number = 80 @State passingScore: number = 80
@State dwztErrorVisible: boolean = false; @State dwztErrorVisible: boolean = false;
@State popTimer:number =0; @State popTimer: number = 0;
@State carlist:string= '' @State carlist: string = ''
@State errorMsg: string = '' @State errorMsg: string = ''
@State isErrorMsgEnd: boolean = false @State isErrorMsgEnd: boolean = false
@State disConnectErrorOpen: boolean = false @State disConnectErrorOpen: boolean = false

View File

@ -1,7 +1,7 @@
//考试回放开关 //考试回放开关
export const judgeConfig = { export const judgeConfig = {
// 外壳版本号 // 外壳版本号
version: "2025.05.26.01", version: "2025.07.24.01",
//本地目录开关 //本地目录开关
isTrajectoryOpen: false, isTrajectoryOpen: false,
//是否开启拍照 //是否开启拍照