refactor: 更新类型定义,优化代码可读性
This commit is contained in:
		
						commit
						a75bba1761
					
				| @ -112,7 +112,7 @@ export interface CarInfoType { | |||||||
|   examinationRoomId?: string; |   examinationRoomId?: string; | ||||||
|   plateNo?: string; |   plateNo?: string; | ||||||
|   carNo?: string; |   carNo?: string; | ||||||
|   examSubject: string; |   examSubject?: string; | ||||||
|   isNeedCheck?: string; |   isNeedCheck?: string; | ||||||
|   udpAddress?: string |   udpAddress?: string | ||||||
|   messagePort?: string |   messagePort?: string | ||||||
|  | |||||||
| @ -120,7 +120,6 @@ struct Index { | |||||||
|   @State isDeductedPopShow: boolean = false |   @State isDeductedPopShow: boolean = false | ||||||
|   @State isAmplifyPopShow: boolean = false |   @State isAmplifyPopShow: boolean = false | ||||||
|   @State amplifiedImgIndex: number = 0 |   @State amplifiedImgIndex: number = 0 | ||||||
|   judge: Judge |  | ||||||
|   //行驶距离 |   //行驶距离 | ||||||
|   @State jl: number = 0 |   @State jl: number = 0 | ||||||
|   //应考里程 |   //应考里程 | ||||||
| @ -162,6 +161,7 @@ struct Index { | |||||||
|   @State isErrorMsgEnd: boolean = false |   @State isErrorMsgEnd: boolean = false | ||||||
|   @State disConnectErrorOpen: boolean = false |   @State disConnectErrorOpen: boolean = false | ||||||
|   public context = getContext(this) as common.UIAbilityContext; |   public context = getContext(this) as common.UIAbilityContext; | ||||||
|  |   private judge: Judge = new Judge(this) | ||||||
| 
 | 
 | ||||||
|   async aboutToDisappear() { |   async aboutToDisappear() { | ||||||
|     clearInterval(this.mileageTimer) |     clearInterval(this.mileageTimer) | ||||||
| @ -185,8 +185,7 @@ struct Index { | |||||||
|     //断点续考 |     //断点续考 | ||||||
|     await this.goDdxkItems() |     await this.goDdxkItems() | ||||||
|     //初始化评判 |     //初始化评判 | ||||||
|     const judge = await this.initJudge(); |     await this.initJudge(); | ||||||
|     this.judge = judge |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   //初始化相关数据库表 |   //初始化相关数据库表 | ||||||
| @ -522,16 +521,12 @@ struct Index { | |||||||
| 
 | 
 | ||||||
|   // 评判相关初始化 |   // 评判相关初始化 | ||||||
|   async initJudge() { |   async initJudge() { | ||||||
|     const JUDGEUI: JudgeUI = this; |     ; | ||||||
|     const judge = new Judge(JUDGEUI); |     await this.judge.onJudgeFn(async (judgeData: JudgeCallBacData) => { | ||||||
|     // await judge.init<typeof Index>() |  | ||||||
|     await judge.onJudgeFn(async (judgeData: JudgeCallBacData) => { |  | ||||||
|       // const { xmmcStr, carztStr, kfArr } = judgeData; |  | ||||||
|       this.xmmcStr = judgeData.xmmcStr || ""; |       this.xmmcStr = judgeData.xmmcStr || ""; | ||||||
|       this.carztStr = judgeData.carztStr || ""; |       this.carztStr = judgeData.carztStr || ""; | ||||||
|       this.kfArr = judgeData.kfArr || []; |       this.kfArr = judgeData.kfArr || []; | ||||||
|     }); |     }); | ||||||
|     return judge |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 断点续考判断 |   // 断点续考判断 | ||||||
|  | |||||||
| @ -339,7 +339,7 @@ export default struct DeductedPopup { | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       if (mark.itemno == 1 && Number(mark.markserial) > 100 && Number(mark.markserial) < 200) { |       if (mark.itemno == 1 && Number(mark.markserial) > 100 && Number(mark.markserial) < 200) { | ||||||
|         this.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = { |         Reflect.set(this.markRuleListObj, `${mark.itemno}_${mark.markserial}`, { | ||||||
|           itemno: tempObj.itemno, |           itemno: tempObj.itemno, | ||||||
|           markcatalog: tempObj.markcatalog, |           markcatalog: tempObj.markcatalog, | ||||||
|           markshow: tempObj.markshow, |           markshow: tempObj.markshow, | ||||||
| @ -350,11 +350,9 @@ export default struct DeductedPopup { | |||||||
|           OnlyOneKind: tempObj.OnlyOneKind, |           OnlyOneKind: tempObj.OnlyOneKind, | ||||||
|           NoCancelId: tempObj.NoCancelId, |           NoCancelId: tempObj.NoCancelId, | ||||||
|           GPS_SID: tempObj.GPS_SID, |           GPS_SID: tempObj.GPS_SID, | ||||||
|         }; |         }) | ||||||
| 
 |  | ||||||
|         this.universalMarkRules.push(tempObj) |         this.universalMarkRules.push(tempObj) | ||||||
|       } |       } | ||||||
| 
 |  | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -41,6 +41,7 @@ import { | |||||||
|   BaseInfoType, |   BaseInfoType, | ||||||
|   CarInfoType, |   CarInfoType, | ||||||
|   CDSBInfo, |   CDSBInfo, | ||||||
|  |   CDSBInfos, | ||||||
|   DrvexamType, |   DrvexamType, | ||||||
|   ExaminerInfoType, |   ExaminerInfoType, | ||||||
|   ItemInfo, |   ItemInfo, | ||||||
| @ -83,7 +84,7 @@ type GetDqxmStr = (xmdm: number) => string | |||||||
| type TJudgeBeginObj = JudgeBeginObj | type TJudgeBeginObj = JudgeBeginObj | ||||||
| 
 | 
 | ||||||
| export default class Judge { | export default class Judge { | ||||||
|   public plcStr!: string |   public plcStr: string = "" | ||||||
|   public judgeUI: JudgeUI |   public judgeUI: JudgeUI | ||||||
|   //获取科目三的评判初始化配置 |   //获取科目三的评判初始化配置 | ||||||
|   getKm3JudgeInitConfig: GetKm3JudgeInitConfig = async () => { |   getKm3JudgeInitConfig: GetKm3JudgeInitConfig = async () => { | ||||||
| @ -92,8 +93,8 @@ export default class Judge { | |||||||
|       map_point_item: this.judgeUI.mapPointItemArr, |       map_point_item: this.judgeUI.mapPointItemArr, | ||||||
|       //科目三暂时为空 |       //科目三暂时为空 | ||||||
|       iteminfo: [], |       iteminfo: [], | ||||||
|       roads: this.getModelData('km3/Roads.txt'), |       roads: this.getModelData('km3/Roads.txt') || "", | ||||||
|       sharps: this.getModelData('km3/Sharps.txt') |       sharps: this.getModelData('km3/Sharps.txt') || "" | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; |   private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; | ||||||
| @ -785,7 +786,7 @@ export default class Judge { | |||||||
|     const kssycs = judgeUI.kssycs |     const kssycs = judgeUI.kssycs | ||||||
|     const isDdxk = judgeUI.isDdxk |     const isDdxk = judgeUI.isDdxk | ||||||
|     const ddxkTime = judgeUI.ddxkTime |     const ddxkTime = judgeUI.ddxkTime | ||||||
|     const projectsCenterObj = judgeUI.projectsCenterObj |     const projectsCenterObj: object = judgeUI.projectsCenterObj | ||||||
|     const ddxkKsxmArr = judgeUI.ddxkKsxmArr |     const ddxkKsxmArr = judgeUI.ddxkKsxmArr | ||||||
|     const ddxkKfArr = judgeUI.ddxkKfArr |     const ddxkKfArr = judgeUI.ddxkKfArr | ||||||
|     const passingScore = judgeUI.passingScore |     const passingScore = judgeUI.passingScore | ||||||
| @ -893,9 +894,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; | ||||||
| @ -1018,18 +1019,18 @@ export default class Judge { | |||||||
|         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 projectCode = project.projectCode |         // const projectCode = project.projectCode | ||||||
|         const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; |         const xmmcCode: string = judgeUI.projectsObj[xmdm].projectCodeCenter; | ||||||
|         const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode; |         const xmmcSingleCode: string = judgeUI.projectsObj[xmdm].projectCode; | ||||||
|         const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode) |         const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode) | ||||||
|         const xmmcStr = project?.name || ""; |         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) | ||||||
|       } |       } | ||||||
| @ -1047,10 +1048,10 @@ 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: object = this.judgeUI.projectsObj; | ||||||
|       judgeUI.projectsObj = deepClone(copyProjectsObj); |       judgeUI.projectsObj = deepClone(copyProjectsObj); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @ -1071,8 +1072,8 @@ export default class Judge { | |||||||
|       const lane = this.lane |       const lane = this.lane | ||||||
|       const closeAllFiles = this.closeAllFiles |       const closeAllFiles = this.closeAllFiles | ||||||
| 
 | 
 | ||||||
|       const projectsObj = judgeUI.projectsObj |       const projectsObj: object = judgeUI.projectsObj | ||||||
|       const judgeConfigObj = judgeUI.judgeConfigObj |       const judgeConfigObj: object = judgeUI.judgeConfigObj | ||||||
|       const examSubject = judgeUI.examSubject |       const examSubject = judgeUI.examSubject | ||||||
|       const jl = judgeUI.jl |       const jl = judgeUI.jl | ||||||
|       const isAllProjectsEnd = judgeUI.isAllProjectsEnd |       const isAllProjectsEnd = judgeUI.isAllProjectsEnd | ||||||
| @ -1163,7 +1164,8 @@ 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||0)}.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) { | ||||||
| @ -1185,7 +1187,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&&this.videoData) { |           if (!singlePlay && this.videoData) { | ||||||
|             await endRecordVideo(this.videoData) |             await endRecordVideo(this.videoData) | ||||||
|           } |           } | ||||||
|           judgeTask.addTask(async () => { |           judgeTask.addTask(async () => { | ||||||
| @ -1228,10 +1230,10 @@ export default class Judge { | |||||||
|     const idCard = judgeUI.idCard |     const idCard = judgeUI.idCard | ||||||
|     const serialNumber = judgeUI.serialNumber |     const serialNumber = judgeUI.serialNumber | ||||||
|     const ksdd = judgeUI.ksdd |     const ksdd = judgeUI.ksdd | ||||||
|     const projectsObj = judgeUI.projectsObj |     const projectsObj: object = judgeUI.projectsObj | ||||||
| 
 | 
 | ||||||
|     const time = GetCurrentTime(); |     const time = GetCurrentTime(); | ||||||
|     const project = this.getProjectInfo(ksxm); |     const project: ProjectInfo = this.getProjectInfo(ksxm); | ||||||
|     //科目三夜间行驶.模拟灯光、上车准备出现通用评判,ksxm为当前进行的项目 |     //科目三夜间行驶.模拟灯光、上车准备出现通用评判,ksxm为当前进行的项目 | ||||||
|     const checkProjects = ['17', '41', '1']; |     const checkProjects = ['17', '41', '1']; | ||||||
|     //获取正在进行的项目 |     //获取正在进行的项目 | ||||||
| @ -1247,11 +1249,25 @@ export default class Judge { | |||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|     const ksxmD: string = project == undefined |     // const ksxmD: string = !project | ||||||
|       ? (commonKsxm |     //   ? (commonKsxm | ||||||
|         ? (project?.projectCodeCenter||"") |     //     ? (project?.projectCodeCenter!) | ||||||
|         : (examSubject == '3' ? '30000' : (xmmcEndCode == undefined ? '10000' : xmmcEndCode))) |     //     : (examSubject == '3' ? '30000' : (xmmcEndCode == undefined ? '10000' : xmmcEndCode))) | ||||||
|       : project.projectCodeCenter |     //   : project.projectCodeCenter | ||||||
|  |     let ksxmD: string; | ||||||
|  |     if (!project) { | ||||||
|  |       if (commonKsxm) { | ||||||
|  |         ksxmD = Reflect.get(projectsObj, commonKsxm).projectCodeCenter; | ||||||
|  |       } else { | ||||||
|  |         if (examSubject == '3') { | ||||||
|  |           ksxmD = '30000'; | ||||||
|  |         } else { | ||||||
|  |           ksxmD = (xmmcEndCode == undefined ? '10000' : xmmcEndCode); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } else { | ||||||
|  |       ksxmD = project?.projectCodeCenter || ""; | ||||||
|  |     } | ||||||
|     const drvexam: DrvexamType = { |     const drvexam: DrvexamType = { | ||||||
|       lsh, |       lsh, | ||||||
|       kskm: examSubject, |       kskm: examSubject, | ||||||
| @ -1259,7 +1275,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), | ||||||
| @ -1278,7 +1294,7 @@ export default class Judge { | |||||||
|       this.isJudgeDisConnect = true |       this.isJudgeDisConnect = true | ||||||
|     } |     } | ||||||
|     console.info(judgeTag, '项目扣分 end') |     console.info(judgeTag, '项目扣分 end') | ||||||
|     promptWxCode('17C53', temp?.code||0) |     promptWxCode('17C53', temp?.code || 0) | ||||||
|   } |   } | ||||||
|   // 评判语音提示 |   // 评判语音提示 | ||||||
|   goJudgeVoice = async (sound: JudgeSound) => { |   goJudgeVoice = async (sound: JudgeSound) => { | ||||||
| @ -1369,9 +1385,9 @@ 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')||false |     const singlePlay = AppStorage.get<boolean>('singlePlay') || false | ||||||
|     const examSubject = carInfo?.examSubject||"2" |     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 | ||||||
| @ -1393,11 +1409,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||0; |     const d1 = ksjs?.d1 || 0; | ||||||
|     const d2 = ksjs?.d2||0; |     const d2 = ksjs?.d2 || 0; | ||||||
|     const d3 = ksjs?.d3||0; |     const d3 = ksjs?.d3 || 0; | ||||||
|     const d4 = ksjs?.d4||0; |     const d4 = ksjs?.d4 || 0; | ||||||
|     const d5 = ksjs?.d5||0; |     const d5 = ksjs?.d5 || 0; | ||||||
| 
 | 
 | ||||||
|     const drvexam: DrvexamType = { |     const drvexam: DrvexamType = { | ||||||
|       lsh, |       lsh, | ||||||
| @ -1422,11 +1438,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||0) |     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 = '当前的考试过程信息监管审核未通过,程序将退出!' | ||||||
| @ -1505,14 +1521,14 @@ 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&&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&&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() | ||||||
| @ -1682,8 +1698,8 @@ export default class Judge { | |||||||
|   //获取场地序号 |   //获取场地序号 | ||||||
|   getSbxh: GetgSbbm = (ksxm, xmxh) => { |   getSbxh: GetgSbbm = (ksxm, xmxh) => { | ||||||
|     const judgeUI = this.judgeUI; |     const judgeUI = this.judgeUI; | ||||||
|     const projectsObj = judgeUI.projectsObj; |     const projectsObj: object = judgeUI.projectsObj; | ||||||
|     const cdsbInfoObj = judgeUI.cdsbInfoObj; |     const cdsbInfoObj: CDSBInfos = judgeUI.cdsbInfoObj!; | ||||||
|     const project: ProjectInfo = Reflect.get(projectsObj, ksxm); |     const project: ProjectInfo = Reflect.get(projectsObj, ksxm); | ||||||
|     if (judgeUI.examSubject == '3') { |     if (judgeUI.examSubject == '3') { | ||||||
|       return '0000000000' |       return '0000000000' | ||||||
| @ -1693,24 +1709,24 @@ export default class Judge { | |||||||
|     } |     } | ||||||
|     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 currentCdsb: CDSBInfo = Reflect.get(cdsbInfoObj, projectKey) ?? {} as CDSBInfo; | ||||||
|     const sbxh: string = currentCdsb.sbbh || '0000000000' |     const sbxh: string = currentCdsb.sbbh || '0000000000' | ||||||
|     return sbxh |     return sbxh | ||||||
|   } |   } | ||||||
|   getSbbm: GetgSbbm = (ksxm, xmxh) => { |   getSbbm: GetgSbbm = (ksxm, xmxh) => { | ||||||
|     const judgeUI = this.judgeUI; |     const judgeUI = this.judgeUI; | ||||||
|     const cdsbInfoObj = judgeUI.cdsbInfoObj; |     const cdsbInfoObj = judgeUI.cdsbInfoObj; | ||||||
|     const projectsObj = judgeUI.projectsObj; |     const projectsObj: object = judgeUI.projectsObj; | ||||||
|     const project: ProjectInfo = Reflect.get(projectsObj, ksxm); |     const project: ProjectInfo = Reflect.get(projectsObj, ksxm); | ||||||
|     //科目三不需要 |     //科目三不需要 | ||||||
|     if (judgeUI.examSubject == '3') { |     if (judgeUI.examSubject == '3') { | ||||||
|       return undefined |       return "" | ||||||
|     } |     } | ||||||
|     if (project === undefined) { |     if (project === undefined) { | ||||||
|       return '00000000' |       return '00000000' | ||||||
|     } |     } | ||||||
|     const projectKey = `${ksxm}_${xmxh}`; |     const projectKey = `${ksxm}_${xmxh}`; | ||||||
|     const currentCdsb: CDSBInfo = Reflect.get(cdsbInfoObj, projectKey) || {} |     const currentCdsb: CDSBInfo = Reflect.get(cdsbInfoObj!, projectKey) || {} | ||||||
|     const sbxh: string = currentCdsb.sbbm || '00000000' |     const sbxh: string = currentCdsb.sbbm || '00000000' | ||||||
|     return sbxh |     return sbxh | ||||||
|   } |   } | ||||||
| @ -1757,7 +1773,7 @@ export default class Judge { | |||||||
|   } |   } | ||||||
|   // 统计必考项目、所有项目、已考数量 |   // 统计必考项目、所有项目、已考数量 | ||||||
|   setCountItems = async () => { |   setCountItems = async () => { | ||||||
|     const projectsObj = this.judgeUI.projectsObj; |     const projectsObj: object = this.judgeUI.projectsObj; | ||||||
|     //必考项目数量       必考项目已考数量 |     //必考项目数量       必考项目已考数量 | ||||||
|     let projectNum = 0, endProjectsNum = 0; |     let projectNum = 0, endProjectsNum = 0; | ||||||
|     // 所有考试项目数量  项目已考项目数量 |     // 所有考试项目数量  项目已考项目数量 | ||||||
| @ -1894,16 +1910,18 @@ export default class Judge { | |||||||
|       // globalThis.laneData = performInfo.lane; |       // globalThis.laneData = performInfo.lane; | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|     let beginExamInfo: JudgeBeginObj|undefined = undefined |     let beginExamInfo: JudgeBeginObj | undefined = undefined | ||||||
|     // 3.开始考试 |     // 3.开始考试 | ||||||
|     if (isTrajectoryOpen) { |     if (isTrajectoryOpen) { | ||||||
|       beginExamInfo = JSON.parse(strArr[1]) |       beginExamInfo = JSON.parse(strArr[1]) | ||||||
|       beginExamInfo.replay = 1 |       beginExamInfo && (beginExamInfo.replay = 1) | ||||||
|     } else { |     } else { | ||||||
|       beginExamInfo = await getJudgeBeginData() |       beginExamInfo = await getJudgeBeginData() | ||||||
|     } |     } | ||||||
|     await fileLog?.setExamJudgeData(JSON.stringify(beginExamInfo)) |     await fileLog?.setExamJudgeData(JSON.stringify(beginExamInfo)) | ||||||
|  |     if (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']) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ export function chunkArr<T>(arr: T[], size: number): T[][] { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //对象深拷贝 | //对象深拷贝 | ||||||
| export function deepClone<T>(target: T): T { | export function deepClone<T extends  Object>(target: T): T { | ||||||
|   // 如果是对象,且不是原始值null |   // 如果是对象,且不是原始值null | ||||||
|   if (typeof target === 'object' && target !== null) { |   if (typeof target === 'object' && target !== null) { | ||||||
|     // 创建容器 |     // 创建容器 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user