fix: 结束考试问题修复
This commit is contained in:
parent
756ced2469
commit
b2b7950d81
@ -200,6 +200,7 @@ struct JudgePage {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async aboutToDisappear() {
|
async aboutToDisappear() {
|
||||||
|
this.generateExamRecordsDialogController.close()
|
||||||
clearInterval(this.mileageTimer)
|
clearInterval(this.mileageTimer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -261,6 +261,85 @@ export default class Judge {
|
|||||||
dConsole.info(JudgeTag, '过程数据文件上传 end')
|
dConsole.info(JudgeTag, '过程数据文件上传 end')
|
||||||
}
|
}
|
||||||
private judgeTask: JudgeTask
|
private judgeTask: JudgeTask
|
||||||
|
// 检测扣分、结束项目时该项目是否开始
|
||||||
|
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
|
||||||
|
if (xmdm == 20) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const judgeUI = this.judgeUI;
|
||||||
|
const judgeTask = this.judgeTask;
|
||||||
|
const projectsObj: object = this.judgeUI.projectsObj
|
||||||
|
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||||
|
const isUpload = currentProject.isUpload
|
||||||
|
|
||||||
|
//如果项目没有开始
|
||||||
|
dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
|
||||||
|
if (!isUpload) {
|
||||||
|
dConsole.info(JudgeTag, '项目补传开始')
|
||||||
|
//项目开始补传
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.beginProject(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.uploadProgressPhoto(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
currentProject.isUpload = true;
|
||||||
|
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||||
|
//扣分补传
|
||||||
|
if (currentType == 2) {
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.pointsDedute(xmdm, kf!)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//扣分补传判断是否合格 不合格补传项目结束
|
||||||
|
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.endProject(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
currentProject.isEnd = true;
|
||||||
|
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||||
|
}
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
this.checkExamIsEnd()
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private tempData?: PLCType
|
||||||
|
//实时计算gps经纬度距离
|
||||||
|
handDistance = async () => {
|
||||||
|
const dwzt = this.tempData?.gps?.dwzt || "";
|
||||||
|
const jdzt = this.tempData?.gps?.jdzt || "";
|
||||||
|
const tJD = ConvertDdmmToDecimalDegrees(this.tempData?.gps?.jd || 0)
|
||||||
|
const tWD = ConvertDdmmToDecimalDegrees(this.tempData?.gps?.wd || 0)
|
||||||
|
if (this.prevJd && dwzt == 4 && jdzt == 3) {
|
||||||
|
const distance = await examCalcGpsDistance({
|
||||||
|
jd1: this.prevJd,
|
||||||
|
wd1: this.prevWd,
|
||||||
|
jd2: tJD,
|
||||||
|
wd2: tWD,
|
||||||
|
h: this.tempData?.gps?.hxj || 1,
|
||||||
|
})
|
||||||
|
// const distanceClass = AppStorage.get<DistanceClass>('distanceClass')
|
||||||
|
// distanceClass?.setTimeData(Number(((distance / 100).toFixed(2))))
|
||||||
|
DrivingDataStorage.setDrivingProcessData(Number(((distance / 100).toFixed(2))))
|
||||||
|
}
|
||||||
|
this.prevJd = tJD;
|
||||||
|
this.prevWd = tWD;
|
||||||
|
}
|
||||||
|
private performInfo?: JudgePerformInfo
|
||||||
|
private isEndTip: boolean = false;
|
||||||
|
private deductedPopShowTimer: number = 0;
|
||||||
// 校验考试是否结束
|
// 校验考试是否结束
|
||||||
checkExamIsEnd =
|
checkExamIsEnd =
|
||||||
async (isManual?: boolean) => {
|
async (isManual?: boolean) => {
|
||||||
@ -374,85 +453,6 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private tempData?: PLCType
|
|
||||||
//实时计算gps经纬度距离
|
|
||||||
handDistance = async () => {
|
|
||||||
const dwzt = this.tempData?.gps?.dwzt || "";
|
|
||||||
const jdzt = this.tempData?.gps?.jdzt || "";
|
|
||||||
const tJD = ConvertDdmmToDecimalDegrees(this.tempData?.gps?.jd || 0)
|
|
||||||
const tWD = ConvertDdmmToDecimalDegrees(this.tempData?.gps?.wd || 0)
|
|
||||||
if (this.prevJd && dwzt == 4 && jdzt == 3) {
|
|
||||||
const distance = await examCalcGpsDistance({
|
|
||||||
jd1: this.prevJd,
|
|
||||||
wd1: this.prevWd,
|
|
||||||
jd2: tJD,
|
|
||||||
wd2: tWD,
|
|
||||||
h: this.tempData?.gps?.hxj || 1,
|
|
||||||
})
|
|
||||||
// const distanceClass = AppStorage.get<DistanceClass>('distanceClass')
|
|
||||||
// distanceClass?.setTimeData(Number(((distance / 100).toFixed(2))))
|
|
||||||
DrivingDataStorage.setDrivingProcessData(Number(((distance / 100).toFixed(2))))
|
|
||||||
}
|
|
||||||
this.prevJd = tJD;
|
|
||||||
this.prevWd = tWD;
|
|
||||||
}
|
|
||||||
private performInfo?: JudgePerformInfo
|
|
||||||
private isEndTip: boolean = false;
|
|
||||||
private deductedPopShowTimer: number = 0;
|
|
||||||
// 检测扣分、结束项目时该项目是否开始
|
|
||||||
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
|
|
||||||
if (xmdm == 20) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
const judgeUI = this.judgeUI;
|
|
||||||
const judgeTask = this.judgeTask;
|
|
||||||
const projectsObj: object = this.judgeUI.projectsObj
|
|
||||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
|
||||||
const isUpload = currentProject.isUpload
|
|
||||||
|
|
||||||
//如果项目没有开始
|
|
||||||
dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
|
|
||||||
if (!isUpload) {
|
|
||||||
dConsole.info(JudgeTag, '项目补传开始')
|
|
||||||
//项目开始补传
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.beginProject(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.uploadProgressPhoto(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
currentProject.isUpload = true;
|
|
||||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
|
||||||
//扣分补传
|
|
||||||
if (currentType == 2) {
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.pointsDedute(xmdm, kf!)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//扣分补传判断是否合格 不合格补传项目结束
|
|
||||||
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.endProject(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
currentProject.isEnd = true;
|
|
||||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
|
||||||
}
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
this.checkExamIsEnd()
|
|
||||||
})
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private ksjs?: JudgeKSJS
|
private ksjs?: JudgeKSJS
|
||||||
private kfArr?: MarkRule[]
|
private kfArr?: MarkRule[]
|
||||||
//所有的科目考试项目(大车&小车)
|
//所有的科目考试项目(大车&小车)
|
||||||
@ -1325,6 +1325,7 @@ export default class Judge {
|
|||||||
public handEndExam = async () => {
|
public handEndExam = async () => {
|
||||||
dConsole.info(JudgeTag, '处理考试结束 handEndExam')
|
dConsole.info(JudgeTag, '处理考试结束 handEndExam')
|
||||||
// this.judgeUI.loadingPopupVisible = true;
|
// this.judgeUI.loadingPopupVisible = true;
|
||||||
|
dConsole.log(JudgeTag, ' 打开车辆loading1')
|
||||||
this.judgeUI.generateExamRecordsDialogController.open()
|
this.judgeUI.generateExamRecordsDialogController.open()
|
||||||
// this.judgeUI.endPopupVisible = false;
|
// this.judgeUI.endPopupVisible = false;
|
||||||
this.judgeUI.endExamDialogController.close()
|
this.judgeUI.endExamDialogController.close()
|
||||||
@ -1456,13 +1457,15 @@ export default class Judge {
|
|||||||
this.isUdpEnd = true;
|
this.isUdpEnd = true;
|
||||||
closeAllFiles()
|
closeAllFiles()
|
||||||
// this.judgeUI.loadingPopupVisible = false;
|
// this.judgeUI.loadingPopupVisible = false;
|
||||||
|
dConsole.log(JudgeTag, ' 关闭车辆loading1')
|
||||||
this.judgeUI.generateExamRecordsDialogController.close()
|
this.judgeUI.generateExamRecordsDialogController.close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dConsole.info(JudgeTag, '考试结束 end')
|
dConsole.info(JudgeTag, '考试结束 end')
|
||||||
const param302: string = Reflect.get(judgeConfigObj, '302')
|
const param302: string = Reflect.get(judgeConfigObj, '302')
|
||||||
// judgeUI.loadingPopupVisible = true;
|
// judgeUI.loadingPopupVisible = true;
|
||||||
judgeUI.generateExamRecordsDialogController.open()
|
dConsole.log(JudgeTag, ' 打开车辆loading2')
|
||||||
|
// judgeUI.generateExamRecordsDialogController.open()
|
||||||
let currentKssycs = '0';
|
let currentKssycs = '0';
|
||||||
let voiceURL = ''
|
let voiceURL = ''
|
||||||
if (examSubject == '2') {
|
if (examSubject == '2') {
|
||||||
@ -1563,6 +1566,8 @@ export default class Judge {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.isUdpEnd = true
|
this.isUdpEnd = true
|
||||||
closeAllFiles()
|
closeAllFiles()
|
||||||
|
dConsole.log(JudgeTag, ' 关闭车辆loading2')
|
||||||
|
this.judgeUI.generateExamRecordsDialogController.close()
|
||||||
router.back();
|
router.back();
|
||||||
}, param302 == '8' ? 3000 : 0)
|
}, param302 == '8' ? 3000 : 0)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -13,43 +13,68 @@ interface QUEUE {
|
|||||||
type GoTask = (currentTask: QUEUE) => Promise<boolean>
|
type GoTask = (currentTask: QUEUE) => Promise<boolean>
|
||||||
|
|
||||||
export default class JudgeTask {
|
export default class JudgeTask {
|
||||||
//执行任务
|
private queue: QUEUE[] = [];
|
||||||
goTask: GoTask = async (currentTask: QUEUE) => {
|
private status: string = 'end';
|
||||||
const fn = currentTask.fn;
|
private isExecuting: boolean = false;
|
||||||
const delayConfig = currentTask.delayConfig || {
|
// 改为迭代方式执行队列
|
||||||
isDelay: false, delayTime: 1000
|
|
||||||
}
|
|
||||||
const isDelay = delayConfig.isDelay
|
|
||||||
const delayTime = delayConfig.delayTime
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
private queue?: QUEUE[] = []
|
|
||||||
private status: string
|
|
||||||
executeQueue = async () => {
|
executeQueue = async () => {
|
||||||
const queue = this.queue;
|
if (this.isExecuting) return;
|
||||||
const executeQueue = this.executeQueue
|
|
||||||
if (queue?.length) {
|
this.isExecuting = true;
|
||||||
for (const currentTask of queue) {
|
this.status = 'running';
|
||||||
await this.goTask(currentTask)
|
|
||||||
this.queue?.shift()
|
while (this.queue.length > 0) {
|
||||||
await executeQueue()
|
const currentTask = this.queue[0];
|
||||||
|
try {
|
||||||
|
await this.goTask(currentTask);
|
||||||
|
} finally {
|
||||||
|
this.queue.shift();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.status = 'end'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.status = 'end';
|
||||||
|
this.isExecuting = false;
|
||||||
}
|
}
|
||||||
addTask = async (fn: Function, delayConfig?: DelayConfig) => {
|
addTask = async (fn: Function, delayConfig?: DelayConfig) => {
|
||||||
this.queue?.push({
|
this.queue.push({
|
||||||
fn, delayConfig
|
fn,
|
||||||
|
delayConfig
|
||||||
});
|
});
|
||||||
if (this.status == 'end' && this.queue?.length === 1) {
|
|
||||||
|
// 如果当前没有在执行,就启动执行
|
||||||
|
if (!this.isExecuting) {
|
||||||
await this.executeQueue();
|
await this.executeQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.queue = []
|
this.queue = [];
|
||||||
this.status = 'end'
|
this.status = 'end';
|
||||||
|
this.isExecuting = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// 执行任务
|
||||||
|
goTask: GoTask = async (currentTask: QUEUE) => {
|
||||||
|
try {
|
||||||
|
const fn = currentTask.fn;
|
||||||
|
const delayConfig = currentTask.delayConfig || {
|
||||||
|
isDelay: false, delayTime: 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
// 实际执行任务函数
|
||||||
|
await fn();
|
||||||
|
|
||||||
|
// 处理延迟逻辑
|
||||||
|
if (delayConfig.isDelay && delayConfig.delayTime) {
|
||||||
|
await new Promise<void>(resolve => {
|
||||||
|
setTimeout(resolve, delayConfig.delayTime);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(TAG, '任务执行失败:', error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user