考试结束优化

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

View File

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