886 lines
		
	
	
		
			31 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			886 lines
		
	
	
		
			31 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| import router from '@ohos.router'
 | |
| import prompt from '@ohos.prompt'
 | |
| import common from '@ohos.app.ability.common';
 | |
| import EndPoPup from './compontents/judge/end-popup'
 | |
| import LoadingPopup from './compontents/judge/loading-popup'
 | |
| import DeductedPopup from './compontents/judge/deduction-popup'
 | |
| import AmplifyPopup from './compontents/judge/amplify-popup'
 | |
| import Judge from './judgeSDK/judge'
 | |
| import {defaultJudgeConfigObj} from './judgeSDK/utils//judge-common'
 | |
| import {
 | |
|   Project, ProjectObj, MarkRule, CDSBInfo,
 | |
|   SYSTEMPARMARR,CARINFO ,MAPPOINT ,MAPITEMPOINTITEM,SYSSET
 | |
| } from './judgeSDK/api/judgeSDK.d'
 | |
| import { getCurrentTime, formatTime, getCurrentHourTime,chunkArr } from '../common/utils/tools'
 | |
| import { examJudgeEndExam } from './judgeSDK/api/index'
 | |
| import { getSyncData } from '../common/service/initable'
 | |
| import { judgeConfig } from './judgeSDK/utils/judge-config'
 | |
| import FileUtil from '../common/utils/File';
 | |
| import SignDisplayCom from './compontents/signDisplayCom'
 | |
| import {testMarkRules} from './judgeSDK/dataTest/index'
 | |
| 
 | |
| @Entry
 | |
| @Component
 | |
| struct Index {
 | |
|   scroller: Scroller = new Scroller()
 | |
|   private context = getContext(this) as common.UIAbilityContext;
 | |
|   private img: ImageBitmap = new ImageBitmap("/resources/base/media/1.png")
 | |
| 
 | |
|   async aboutToAppear() {
 | |
|     globalThis.windowClass.setWindowSystemBarEnable([''])
 | |
|     const time = await getCurrentTime()
 | |
| 
 | |
|     this.startTime = time.split(' ')[1]
 | |
|     this.startFullTime = await getCurrentTime(1);
 | |
|     this.startHourTime = await getCurrentHourTime()
 | |
| 
 | |
|     setInterval(async () => {
 | |
|       this.time = await getCurrentTime();
 | |
|       this.examTime += 1;
 | |
|     }, 1000);
 | |
| 
 | |
|     //初始化数据库表
 | |
|     await this.initDb()
 | |
| 
 | |
|     //断点续考
 | |
|     await this.goDdxkItems()
 | |
| 
 | |
|     //初始化评判
 | |
|     const judge = await this.initJudge();
 | |
|     this.judge = judge
 | |
|   }
 | |
| 
 | |
|   //初始化相关数据库表
 | |
|   async initDb(){
 | |
|     const examSubject = globalThis.carInfo.examSubject;
 | |
|     const {isTrajectoryOpen,trajectoryPath} = judgeConfig
 | |
|     await this.initStudent();
 | |
|     await this.initCar();
 | |
| 
 | |
|     //是否开启轨迹回放模式
 | |
|     if(isTrajectoryOpen){
 | |
|       this.initTrajectoryParam(trajectoryPath)
 | |
|     }else{
 | |
|       examSubject == 2
 | |
|         ? await this.initSystemKm2Param()
 | |
|         : await this.initSystemKm3Param()
 | |
|       await this.initMarkRules();
 | |
|       await this.initSysset();
 | |
|     }
 | |
|     await this.initCDSBInfo()
 | |
| 
 | |
|     // 科目三新增读取表数据
 | |
|     if(examSubject == 3){
 | |
|       await this.initMapPoint()
 | |
|       await this.initMapPointItem()
 | |
|     }
 | |
|   }
 | |
|   // 查询考车信息
 | |
|   async initCar() {
 | |
|     const result = await getSyncData('ES_CARINFO')
 | |
|     const carInfo = result[0] || {};
 | |
|     this.carName = decodeURI(carInfo.carclass)
 | |
|     this.carType = carInfo.kscx
 | |
|     this.carinfoArrr.push({
 | |
|       CARID:carInfo.carid,
 | |
|       IPADDR:'',
 | |
|       CARCLASS:decodeURI(carInfo.carclass),
 | |
|       KSCX:carInfo.kscx,
 | |
|       CARNAME:decodeURI(carInfo.carclass),
 | |
|       FLAG:carInfo.flag,
 | |
|       BK1:carInfo.bk1,
 | |
|       BK2:carInfo.bk2,
 | |
|     })
 | |
|   }
 | |
| 
 | |
|   // 获取考生信息
 | |
|   async initStudent() {
 | |
|     const students = await getSyncData('USER')
 | |
|     const stuInfo = students[0] || {};
 | |
|     const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx} = stuInfo;
 | |
|     this.name = xm;
 | |
|     this.idCard = sfzmhm;
 | |
|     this.lsh = lsh;
 | |
|     this.kszp = kszp;
 | |
|     this.ksdd = ksdd;
 | |
|     this.kssycs = kssycs;
 | |
|     this.kslx = kslx;
 | |
|   }
 | |
| 
 | |
|   // 获取扣分代码信息
 | |
|   async initMarkRules(markRules ?: MarkRule[]) {
 | |
|     const markRuleParams = markRules ||( await getSyncData('MA_MARKRULE') as MarkRule[])
 | |
| 
 | |
|     markRuleParams .forEach(mark => {
 | |
|       const tempObj = {
 | |
|         itemno:mark.itemno * 1,
 | |
|         markcatalog:mark.markcatalog,
 | |
|         markshow:decodeURI(mark.markshow),
 | |
|         markreal:mark.markreal * 1,
 | |
|         markserial:mark.markserial,
 | |
|         kfxh:mark.kfxh,
 | |
|         OnlyOneKind:mark.onlyoneid * 1,
 | |
|         NoCancelId:mark.nocancelid * 1,
 | |
|         GPS_SID:mark.gps_sid == 0 ? false : true
 | |
|       }
 | |
|       const markserial = mark.markserial * 1;
 | |
| 
 | |
|       //筛选出人工评判的扣分
 | |
|       if(markserial > 100 && markserial < 200){
 | |
|         this.manualMarkRules.push(tempObj)
 | |
|       }
 | |
|       this.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = {
 | |
|        ...tempObj,
 | |
|         markserial: mark.markserial,
 | |
|       };
 | |
|     })
 | |
|   }
 | |
| 
 | |
|   // 获取sysset表信息
 | |
|   async initSysset(sysset?:SYSSET[]) {
 | |
|     const syssetParams = sysset ||  await getSyncData('MA_SYSSET')
 | |
|     //@ts-ignore
 | |
|     const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901');
 | |
|     this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || '123456'
 | |
|     const {isTrajectoryOpen} = judgeConfig
 | |
|     const syssetJudgeConfigArr = []
 | |
| 
 | |
|     //@ts-ignore
 | |
|     syssetParams.forEach((sys) => {
 | |
|       if(isTrajectoryOpen){
 | |
|         sys.v_no = sys.key;
 | |
|         sys.v_name = sys.name;
 | |
|         sys.v_value = sys.value
 | |
|       }
 | |
| 
 | |
|       const {v_no,v_value} = sys;
 | |
|       const v_no_num = v_no * 1;
 | |
|       const value = decodeURIComponent(v_value)
 | |
|       if(v_no_num >= 10 &&v_no_num <= 900){
 | |
|         syssetJudgeConfigArr.push({
 | |
|           key: v_no_num,value: value,
 | |
|           name: decodeURI(sys.v_name)
 | |
|         })
 | |
|       }
 | |
|       //科目三应行驶距离参数
 | |
|       if(sys.v_no == '303'){
 | |
|         this.examMileage = sys.v_value + '';
 | |
|       }
 | |
| 
 | |
|       this.judgeConfigObj[sys.v_no] = value
 | |
|     });
 | |
|     this.judgeConfig = syssetJudgeConfigArr;
 | |
|   }
 | |
| 
 | |
|   // 初始化systemParam表
 | |
|   async initSystemKm2Param(sysParam?:SYSTEMPARMARR[]){
 | |
|     const systemParms:any = sysParam || await getSyncData('MA_SYSTEMPARM')
 | |
|     const carName = this.carName;
 | |
| 
 | |
|     let carNo2 = '',allItems = [];
 | |
|     systemParms.forEach((systemParm)=>{
 | |
|       const {no1,no2,no3} = systemParm;
 | |
| 
 | |
|       //获取当前考车的no2
 | |
|       if(no1 == 3 && no3 == 1){
 | |
|         const txt1 = decodeURI(systemParm.txt1)
 | |
|         if(txt1 === carName){
 | |
|           carNo2 = no2;
 | |
|         }
 | |
|       }
 | |
| 
 | |
|       //获取当前考车的考试项目
 | |
|       if(carNo2 !== '' && no2 == carNo2 && no3 == 10){
 | |
|         allItems = decodeURIComponent(systemParm.txt1).split(',')
 | |
|       }
 | |
| 
 | |
|       // 存储当前考车考试项目
 | |
|       if(allItems.length && no1 == 6 && allItems.includes(no2)){
 | |
|         const txt2 = decodeURIComponent(systemParm.txt2)
 | |
|         const currentProject = {
 | |
|           name:decodeURI(systemParm.txt1),
 | |
|           abbreviation:decodeURI(systemParm.txt3),
 | |
|           projectCode:no2,
 | |
|           projectCodeCenter:txt2
 | |
|           // sbxh:project.type
 | |
|         }
 | |
|         this.projectsObj[no2] = currentProject
 | |
|         this.projectsCenterObj[txt2] = currentProject
 | |
|         this.projects.push(currentProject)
 | |
|       }
 | |
|     })
 | |
| 
 | |
|     const projects = this.projects;
 | |
|     if(!projects.length){
 | |
|       prompt.showToast({
 | |
|         message: '读取数据库信息失败,请重新考试!',
 | |
|         duration: 8000
 | |
|       });
 | |
|       router.back();
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   //初始化systemParam表
 | |
|   async initSystemKm3Param(sysParam?:SYSTEMPARMARR[]) {
 | |
|     const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM')
 | |
| 
 | |
|     const {isTrajectoryOpen} = judgeConfig
 | |
| 
 | |
|     systemParms.forEach((systemParm) => {
 | |
| 
 | |
|       if(isTrajectoryOpen){
 | |
|         systemParm.no1 = systemParm.NO1;
 | |
|         systemParm.no2 = systemParm.NO2;
 | |
|         systemParm.no3 = systemParm.NO3;
 | |
|         systemParm.txt1 = systemParm.TXT1;
 | |
|         systemParm.txt2 = systemParm.TXT2;
 | |
|         systemParm.txt3 = systemParm.TXT3;
 | |
|       }
 | |
| 
 | |
|       const {no1,no2,no3,} = systemParm;
 | |
|       this.systemparmArr.push({
 | |
|         'NO1':no1*1,'NO2':no2*1,'NO3':no3*1,
 | |
|         'TXT1':decodeURIComponent(systemParm.txt1),
 | |
|         'TXT2':decodeURIComponent(systemParm.txt2),
 | |
|         'TXT3':decodeURIComponent(systemParm.txt3),
 | |
|       })
 | |
| 
 | |
|       const txt2 = decodeURIComponent(systemParm.txt2)
 | |
|       if (no1 == 6) {
 | |
|         const currentProject = {
 | |
|           name: decodeURI(systemParm.txt1),
 | |
|           abbreviation: decodeURI(systemParm.txt3),
 | |
|           projectCode: no2,
 | |
|           projectCodeCenter: txt2
 | |
|         }
 | |
|         this.projectsObj[no2] = currentProject
 | |
|         this.projectsCenterObj[txt2] = currentProject
 | |
|         this.projects.push(currentProject)
 | |
|       }
 | |
|       // if(no1 == 3 && no2 == 1 && no3 == 15){
 | |
|       //   this.examMileage = decodeURI(systemParm.txt1)
 | |
|       // }
 | |
|     })
 | |
|     const projects = this.projects;
 | |
|     if (!projects.length) {
 | |
|       prompt.showToast({
 | |
|         message: '读取数据库信息失败,请重新考试!',
 | |
|         duration: 8000
 | |
|       });
 | |
|       router.back();
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   // 获取场地设备信息
 | |
|   async initCDSBInfo() {
 | |
|     const cdsbParams = await getSyncData('MA_CDSBINFO')
 | |
|     //@ts-ignore
 | |
|     cdsbParams.forEach((cdsb) => {
 | |
|       const key = decodeURI(cdsb.itemsno);
 | |
|       const newKey = key.split('~').join('_')
 | |
|       this.cdsbInfoObj[newKey] = {
 | |
|         kdid: cdsb.kdid,
 | |
|         sbbh: cdsb.sbbh,
 | |
|         sbbm: cdsb.sbbm,
 | |
|         itemsno: key,
 | |
|         modelKey: newKey,
 | |
|         //@ts-ignore
 | |
|         xmdm: key.split('~')[0] * 1,
 | |
|         xmxh: key.split('~')[1],
 | |
|       }
 | |
|     })
 | |
|   }
 | |
| 
 | |
|   // 评判相关初始化
 | |
|   async initJudge() {
 | |
|     const judge = new Judge(this);
 | |
|     await judge.onJudgeFn(async (judgeData) => {
 | |
|       const {xmmcStr,carztStr,kfArr} = judgeData;
 | |
|       this.xmmcStr = xmmcStr;
 | |
|       this.carztStr = carztStr;
 | |
|       this.kfArr = kfArr;
 | |
|     });
 | |
|     return judge
 | |
|   }
 | |
| 
 | |
|   // 断点续考判断
 | |
|   async goDdxkItems() {
 | |
|     const judgeConfigObj = this.judgeConfigObj
 | |
|     if(judgeConfigObj['369'] != 1 || judgeConfigObj['432'] != 1){
 | |
|       return
 | |
|     }
 | |
|     //断点续考判断
 | |
|     let currentParams: any = router.getParams();
 | |
|     const examItems: string = currentParams?.examItems;
 | |
| 
 | |
|     // 2024-01-03 16:29:26;0;20300,;2,4^2,4;null;
 | |
|     if (examItems !== '' && examItems !== undefined) {
 | |
|       const examItemsArrs = examItems.split(';');
 | |
|       const startTime = examItemsArrs[0]
 | |
|       const ddxkKsxmArr = examItemsArrs[2]?.split(',').filter(item => item) || []
 | |
|       const ddxkKfArr = examItemsArrs[3]?.split('^').filter(item => item) || []
 | |
|       if (ddxkKsxmArr?.length) {
 | |
|         this.isDdxk = true
 | |
|         ddxkKsxmArr.forEach(xmdm => {
 | |
|           const projectCode = this.projectsCenterObj[xmdm].projectCode
 | |
|           this.projectsObj[projectCode].type = '3'
 | |
|         })
 | |
|         ddxkKfArr.forEach((kf) => {
 | |
|           const [xmdm, kfdm] = kf.split(',')
 | |
|           const currentKf = this.markRuleListObj[`${xmdm}_${kfdm}`]
 | |
|           const currentProject = this.projectsObj[xmdm]
 | |
|           this.projectsObj[xmdm].type = '4'
 | |
|           this.kfArr.push({
 | |
|             //扣分项目名称
 | |
|             xmmcStr: currentProject.name,
 | |
|             //@ts-ignore
 | |
|             xmdm,
 | |
|             desc: currentKf.markshow,
 | |
|             score: currentKf.markreal,
 | |
|             markcatalog: currentKf.markcatalog,
 | |
|             markserial: currentKf.markserial,
 | |
|             kfxh: currentKf.kfxh
 | |
|           })
 | |
|           this.totalScore += currentKf.markreal * 1;
 | |
|         })
 | |
|         this.ddxkKsxmArr = ddxkKsxmArr
 | |
|         this.ddxkKfArr = ddxkKfArr
 | |
|         this.ddxkTime = Date.parse(startTime);
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   // 初始化mapPoint表
 | |
|   async initMapPoint(){
 | |
|     const pointParams = await getSyncData('MA_MAP_POINT')
 | |
|     //@ts-ignore
 | |
|     pointParams.forEach(point=>{
 | |
|       const {point_no,gps_e,gps_n,point_no_f,point_type,road_code,gps_e_Location,gps_n_Location,f_gps_e,f_gps_n,passed} = point;
 | |
|       this.mapPointArr.push({
 | |
|         point_no:point_no * 1,
 | |
|         gps_e:gps_e * 1,
 | |
|         gps_n:gps_n * 1,
 | |
|         point_no_f:point_no_f * 1,
 | |
|         point_type:point_type * 1,
 | |
|         road_code,
 | |
|         gps_e_Location:(gps_e_Location || 0 ) * 1,
 | |
|         gps_n_Location:(gps_n_Location || 0 ) * 1,
 | |
|         f_gps_e:f_gps_e * 1,
 | |
|         f_gps_n:f_gps_n * 1,
 | |
|         passed:passed * 1
 | |
|       })
 | |
|     })
 | |
|   }
 | |
| 
 | |
|   // 初始化mapPointItem表
 | |
|   async initMapPointItem(){
 | |
|     const pointItemPoints = await getSyncData('MA_MAP_POINT_ITEM');
 | |
|     //@ts-ignore
 | |
|     pointItemPoints.forEach(itemPoint => {
 | |
|       const {point_no,itemno,itemno1,subname} = itemPoint
 | |
|       this.mapPointItemArr.push({
 | |
|        point_no:point_no * 1,
 | |
|        itemno:itemno * 1,
 | |
|        itemno1:itemno1 * 1,
 | |
|        subname
 | |
|       })
 | |
|     })
 | |
|   }
 | |
| 
 | |
|   // 初始化本地systemparam表、markrule表
 | |
|   async initTrajectoryParam(trajectoryPath:string){
 | |
|     const {isTrajectoryOpen} = judgeConfig
 | |
|     //轨迹回放读取 systemparam表、markrule表
 | |
|     const fileUtil  = new FileUtil(this.context);
 | |
|     const folderPath = await fileUtil.initFolder(trajectoryPath);
 | |
|     const str = await fileUtil.readFile(folderPath);
 | |
|     const strArr = str.split('\n');
 | |
|     const [initData,beginData] = [strArr[0],strArr[1]];
 | |
|     const initDataObj = JSON.parse(initData)
 | |
|     const systemparm = initDataObj.systemparm;
 | |
|     const examSubject = globalThis.carInfo.examSubject;
 | |
|     this.examSubject = isTrajectoryOpen ? (initDataObj.kskm*1):examSubject;
 | |
|     globalThis.carInfo.examSubject = this.examSubject
 | |
|     examSubject == 2
 | |
|       ? await this.initSystemKm2Param(systemparm)
 | |
|       : await this.initSystemKm3Param(systemparm)
 | |
|     //@ts-ignore
 | |
|     await this.initMarkRules(testMarkRules);
 | |
|     await this.initSysset(initDataObj.sysset);
 | |
|   }
 | |
| 
 | |
| 
 | |
|   build() {
 | |
|     Column() {
 | |
|       Row() {
 | |
|         Row() {
 | |
|           Image($rawfile('judge/signal_logoS.png')).width(120)
 | |
|           Text(this.time).fontColor('#CCB48F').fontSize(32).padding({ left: 10, right: 5 })
 | |
|           Image($rawfile('judge/xh_green.png')).width(50)
 | |
|         }.padding({left:20})
 | |
| 
 | |
|         Row() {
 | |
|           Text(`当前项目:${this.xmmcStr || '无'} `).fontColor('#E5CCA1').fontSize(32)
 | |
|         }
 | |
|       }
 | |
|       .width('100%')
 | |
|       .height('96')
 | |
|       .backgroundColor('#001A33')
 | |
|       .padding({ left: 15, right: 15 })
 | |
|       .justifyContent(FlexAlign.SpaceBetween)
 | |
|       .alignItems(VerticalAlign.Center)
 | |
| 
 | |
|       Row() {
 | |
|         Row() {
 | |
|           Column() {
 | |
|             Row() {
 | |
|               Column() {
 | |
|                 Row() {
 | |
|                   Text('考生姓名:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
 | |
|                   Text(this.name).fontColor('#FFF').fontSize(this.FONTSIZE)
 | |
|                 }.margin({ bottom: 10 })
 | |
| 
 | |
|                 Row() {
 | |
|                   Text('开始时间:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
 | |
|                   Text(this.startTime).fontColor('#FFF').fontSize(this.FONTSIZE)
 | |
|                 }.margin({ bottom: 10 })
 | |
| 
 | |
|                 if(this.examSubject == 3){
 | |
|                   Row() {
 | |
|                     Text('考试路线:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
 | |
|                     Text('线路6').fontColor('#FFAD33').fontSize(this.FONTSIZE)
 | |
|                   }
 | |
|                 }
 | |
| 
 | |
|               }.width('45%').alignItems(HorizontalAlign.Start)
 | |
| 
 | |
|               Column() {
 | |
|                 Row() {
 | |
|                   Text('身份证号:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
 | |
|                   Text(this.idCard).fontColor('#FFF').fontSize(this.FONTSIZE)
 | |
|                 }.margin({ bottom: 10 })
 | |
| 
 | |
|                 Row() {
 | |
|                   Text('考试用时:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
 | |
|                   Text(formatTime(this.examTime)).fontColor('#FFF').fontSize(this.FONTSIZE)
 | |
|                 }.margin({ bottom: 10 })
 | |
| 
 | |
|                 if(this.examSubject == 3){
 | |
|                   Row() {
 | |
|                     if(this.judgeConfigObj['375'] == '0'){
 | |
|                       Text(`应行驶:${this.examMileage}m`).fontColor('#E5CCA1').fontSize(this.FONTSIZE).padding({right:20})
 | |
|                     }
 | |
|                     Text(`已行驶:${this.jl}m`).fontColor('#FFAD33').fontSize(this.FONTSIZE)
 | |
|                   }
 | |
|                 }
 | |
| 
 | |
|               }.alignItems(HorizontalAlign.Start)
 | |
| 
 | |
|             }.width('100%')
 | |
| 
 | |
|             Column() {
 | |
|               Row(){
 | |
|                 Text(this.carztStr).fontColor('#FFA500').fontSize(this.FONTSIZE)
 | |
|               }.height(40)
 | |
|               Row() {
 | |
|                 Flex({ direction: FlexDirection.Column }) {
 | |
|                   List({}) {
 | |
|                     ForEach(this.kfArr, (item) => {
 | |
|                       ListItem() {
 | |
|                         Column() {
 | |
|                           Row() {
 | |
|                             Text(item.xmmcStr).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
 | |
|                             Text(`${item.score}分`).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
 | |
|                           }
 | |
|                           .width('100%')
 | |
|                           .backgroundColor('#38260B')
 | |
|                           .justifyContent(FlexAlign.SpaceBetween)
 | |
|                           .padding({ top: 12, bottom: 12, left: 8, right: 5 })
 | |
| 
 | |
|                           Text(item.desc)
 | |
|                             .fontSize(this.BIGFONTSIZE)
 | |
|                             .fontColor('#E5CBA1')
 | |
|                             .margin({ top: 10, bottom: 8, left: 5, right: 5 })
 | |
|                         }.margin({ top: 15 }).alignItems(HorizontalAlign.Start)
 | |
| 
 | |
|                       }.margin({bottom:25})
 | |
|                     })
 | |
|                   }.padding({left:15,right:15,top:30,bottom:5})
 | |
|                 }
 | |
|                   .backgroundImage($rawfile('judge/score_bg.png'), ImageRepeat.NoRepeat)
 | |
|                   .backgroundImageSize({ width: '100%', height: '100%' })
 | |
|                   .width(514)
 | |
|                   .height(618)
 | |
|                   .padding({ top: 18, bottom: 15, left: 13, right: 14 })
 | |
| 
 | |
|                 //科目二
 | |
|                 if(this.examSubject == 2){
 | |
|                   Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceBetween}){
 | |
|                     List({}){
 | |
|                       ForEach(chunkArr(this.projects,2),(item)=>{
 | |
|                         ListItem(){
 | |
|                           Row(){
 | |
|                             Row(){
 | |
|                               //#FF7566 #00FFD5 #E6DECF
 | |
|                               // Text(this.projectsObj[item[0].projectCode])
 | |
|                               Text(item[0].abbreviation).fontSize(item[0].abbreviation.length > 5?28:32).fontColor(this.getProjectColor(this.projectsObj[item[0].projectCode].type))
 | |
|                             }.backgroundImage($rawfile('judge/project_item.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('48.5%').height(115).margin({bottom:5}).justifyContent(FlexAlign.Center)
 | |
|                             if(item[1]){
 | |
|                               Row(){
 | |
|                                 //#FF7566 #00FFD5 #E6DECF
 | |
|                                 Text(item[1].abbreviation).fontSize(item[1].abbreviation.length > 5?28:32).fontColor(this.getProjectColor(this.projectsObj[item[1].projectCode].type))
 | |
|                               }.backgroundImage($rawfile('judge/project_item.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('48.5%').height(115).margin({left:5,bottom:5}).justifyContent(FlexAlign.Center)
 | |
|                             }
 | |
|                           }
 | |
|                         }
 | |
|                       });
 | |
|                     }
 | |
|                   }.backgroundImage($rawfile('judge/project_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('57%').height('100%').padding(30).margin({right:10})
 | |
|                 }
 | |
| 
 | |
|                 //科目三
 | |
|                 if(this.examSubject == 3){
 | |
|                   Column(){
 | |
|                     Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceBetween}){
 | |
|                       List({}){
 | |
|                         ForEach(this.projects,(project)=>{
 | |
|                           ListItem(){
 | |
|                             Text(project.name){
 | |
| 
 | |
|                             }.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type)).margin({bottom:5}).fontSize(26)
 | |
|                           }.margin({bottom:8})
 | |
|                         })
 | |
|                       }.lanes(2).margin({left:25})
 | |
|                     }.width('100%').height('50%').backgroundImage($rawfile('judge/project_km3_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).padding(30).margin({right:5})
 | |
| 
 | |
|                     Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceAround}){
 | |
|                       List(){
 | |
|                         ForEach(this.artSubject3Projects,(item,index)=>{
 | |
|                           ListItem(){}.backgroundImage(
 | |
|                             $rawfile(
 | |
|                               `judge/km3/${this.getIsExitManualProject(index) ? item : (item+'_gray')}.png`
 | |
|                             ),ImageRepeat.NoRepeat)
 | |
|                           .backgroundImageSize({width:'100%',height:'100%'}).width(174).height(118).margin({bottom:15})
 | |
|                           .onClick(()=>{
 | |
|                             if(this.getIsExitManualProject(index)){
 | |
|                               // 靠边停车时候可以触发
 | |
|                               if(this.judgeConfigObj['343'] == 0 ){
 | |
|                                 const xmmcStr = this.xmmcStr;
 | |
|                                 if(xmmcStr == '无' || xmmcStr == ''){
 | |
|                                   this.amplifiedImgIndex = index;this.isAmplifyPopShow = true
 | |
|                                 } else{
 | |
|                                   if(index === 5){
 | |
|                                     prompt.showToast({
 | |
|                                       message: `${xmmcStr}未结束,不允许靠边停车`,
 | |
|                                       duration: 8000
 | |
|                                     });
 | |
|                                   }
 | |
| 
 | |
|                                 }
 | |
|                               }else{
 | |
|                                 this.amplifiedImgIndex = index;this.isAmplifyPopShow = true
 | |
|                               }
 | |
|                             }
 | |
|                           })
 | |
|                         })
 | |
|                       }.lanes(3).margin({left:5,top:18})
 | |
|                     }
 | |
|                   }.backgroundImage($rawfile('judge/project_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(660).height(640).padding(44).margin({right:10})
 | |
|                 }
 | |
|               }.margin({ top: 15 }).height('80%').justifyContent(FlexAlign.SpaceBetween)
 | |
|             }.width('100%').height('100%').alignItems(HorizontalAlign.Start).margin({ top: 10 })
 | |
|           }.height('100%').alignItems(HorizontalAlign.Start)
 | |
|         }.width('75%').height('100%')
 | |
| 
 | |
|         Column() {
 | |
|           Column() {
 | |
|             Row() {
 | |
|               Text(this.totalScore + '').fontColor('#FFEECC').fontSize(55)
 | |
|               Text('分').fontColor('#FFEECC').fontSize(30).padding({ top: 5 })
 | |
|             }
 | |
|             .width(334)
 | |
|             .height(120)
 | |
|             .justifyContent(FlexAlign.Center)
 | |
|             .alignItems(VerticalAlign.Center)
 | |
|             .border({ width: 5, color: '#4D4136', radius: 30 })
 | |
|             .onClick(() => {
 | |
|               this.signDisplayComVisible = true
 | |
|             })
 | |
| 
 | |
|             Row() {
 | |
|               Image(this.kszp).width('85%').height('85%')
 | |
|             }
 | |
|             .width(226)
 | |
|             .height(312)
 | |
|             .backgroundImage($rawfile('judge/photo_bg.png'), ImageRepeat.NoRepeat)
 | |
|             .backgroundImageSize({ width: '100%', height: '100%' })
 | |
|             .justifyContent(FlexAlign.Center)
 | |
|             .alignItems(VerticalAlign.Center)
 | |
|             .margin({ top: 30 ,bottom:15})
 | |
|           }
 | |
| 
 | |
|           Column(){
 | |
|             if(this.examSubject == 3){
 | |
|               Row(){
 | |
|                 Row(){}.width(60).height(60).backgroundImage($rawfile('judge/manual_judge.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' })
 | |
|                 Text('人工评判').fontColor('#FFF').fontSize(32).padding({right:12})
 | |
|               }.width(334).height(110).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
 | |
|                .backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
 | |
|                .backgroundImageSize({ width: '100%', height: '100%' })
 | |
|                .margin({bottom:10})
 | |
|                .onClick(()=>{
 | |
|                 if(this.judgeConfigObj['342'] == 0){
 | |
|                   this.isDeductedPopShow = true
 | |
|                 }else{
 | |
|                   prompt.showToast({
 | |
|                     message: '平台配置不允许人工评判!',
 | |
|                     duration: 4000
 | |
|                   });
 | |
|                 }
 | |
|               })
 | |
|             }
 | |
| 
 | |
| 
 | |
|             Row(){
 | |
|               Row(){}.width(60).height(60).backgroundImage($rawfile('judge/phone.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' })
 | |
|               Text('呼叫请求').fontColor('#FFF').fontSize(32).padding({right:12})
 | |
|             }.width(334).height(110).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
 | |
|             .backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
 | |
|             .backgroundImageSize({ width: '100%', height: '100%' })
 | |
|             .margin({bottom:10})
 | |
| 
 | |
|             Row() {}
 | |
|             .width(334)
 | |
|             .height(100)
 | |
|             .backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
 | |
|             .backgroundImageSize({ width: '100%', height: '100%' })
 | |
|             .onClick(() => {
 | |
|               if(this.judgeConfigObj['353'] == '0' ){
 | |
|                 this.endPopupVisible = true
 | |
|               }else{
 | |
|                 prompt.showToast({
 | |
|                   message: '车上不允许手动结束考试!',
 | |
|                   duration: 4000
 | |
|                 });
 | |
|               }
 | |
|             })
 | |
|           }.margin({bottom:30})
 | |
| 
 | |
|         }
 | |
|         .width('25%')
 | |
|         .height('100%')
 | |
|         .justifyContent(FlexAlign.SpaceBetween)
 | |
|         .alignItems(HorizontalAlign.Center)
 | |
|         .margin({ bottom: 20 })
 | |
|       }.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 })
 | |
| 
 | |
|       //结束考试弹窗
 | |
|       if (this.endPopupVisible) {
 | |
|         EndPoPup({
 | |
|           title: '确定结束考试吗?',
 | |
|           cancelFn: () => {
 | |
|             this.endPopupVisible = false;
 | |
|           },
 | |
|           confirmFn: async () => {
 | |
|             this.endPopupVisible = false;
 | |
|             this.loadingPopupVisible = true
 | |
|             globalThis.isJudge = false
 | |
|             examJudgeEndExam();
 | |
|             clearInterval(this.timer);
 | |
|             clearInterval(globalThis.judgeTimer)
 | |
|             globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
 | |
|             const judge = this.judge
 | |
|             await judge.handEndExam(true);
 | |
|           }
 | |
|         })
 | |
|       }
 | |
| 
 | |
|       //loading 弹窗
 | |
|       if (this.loadingPopupVisible) {
 | |
|         LoadingPopup({
 | |
|           title: '正在生成考试记录,请稍后...',
 | |
|         })
 | |
|       }
 | |
| 
 | |
|       if (this.signDisplayComVisible) {
 | |
|         Column() {
 | |
|           SignDisplayCom({
 | |
|             showBack: false,
 | |
|             scaleNum: 1.5,
 | |
|             msgStr: this.judge.plcStr || ''
 | |
|           }).margin({ top: 100 })
 | |
| 
 | |
|           Row() {}
 | |
|           .width(240)
 | |
|           .height(240)
 | |
|           .position({ x: '81%', y: 80 })
 | |
|           .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat)
 | |
|           .backgroundImageSize({ width: '33.33%', height: '33.33%' })
 | |
|           .onClick(() => {
 | |
|             this.signDisplayComVisible = false
 | |
|           })
 | |
|         }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)')
 | |
|       }
 | |
| 
 | |
|       //科目三人工扣分弹窗
 | |
|       if (this.isDeductedPopShow) {
 | |
|         DeductedPopup({
 | |
|           currentItems:Reflect.ownKeys(this.projectsObj).map(projectKey => {
 | |
|             const project = this.projectsObj[projectKey]
 | |
|             return project.type == '2'?project.projectCode:''
 | |
|           }).filter(project => project !== ''),
 | |
|           markRules:this.manualMarkRules,
 | |
|           closePopup:()=>{this.isDeductedPopShow = false},
 | |
|           confirmMark:async (itemno,serial) => {
 | |
|             const judge = this.judge
 | |
|             await judge.setJudgeMark(itemno,serial);
 | |
|             this.isDeductedPopShow = false
 | |
|           }
 | |
|         })
 | |
|       }
 | |
| 
 | |
|       //科目三人工项目确认框
 | |
|       if(this.isAmplifyPopShow){
 | |
|         AmplifyPopup({
 | |
|           amplifyImgIndex:this.amplifiedImgIndex,
 | |
|           confirmAmplify:async (amplify)=>{
 | |
|             const judge = this.judge
 | |
|             await judge.setJudgeItem(amplify.projectCode);
 | |
|             this.isAmplifyPopShow = false
 | |
|           },
 | |
|           closeAmplifyPop:()=>{
 | |
|             this.isAmplifyPopShow = false
 | |
|           }
 | |
|         })
 | |
|       }
 | |
| 
 | |
|     }
 | |
|     .height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start)
 | |
|   }
 | |
| 
 | |
|   getProjectColor(type: string) {
 | |
|     switch (type) {
 | |
|       case '1':
 | |
|         return '#E6DECF';
 | |
|         break;
 | |
|       case '2':
 | |
|         return '#FFAD33';
 | |
|         break;
 | |
|       case '3':
 | |
|         return '#00FFD5';
 | |
|         break;
 | |
|       case '4':
 | |
|         return '#FF7566';
 | |
|         break;
 | |
|       default:
 | |
|         return '#E6DECF';break;
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   // 获取是否能人工进项目
 | |
|   getIsExitManualProject = (index:number)=>{
 | |
|     const {judgeConfigObj,artSubject3ProjectsCodesArr,projectsObj} = this;
 | |
| 
 | |
|     const unExitManualProjects = judgeConfigObj['332'].split(',') || [];
 | |
|     const param348 = judgeConfigObj['348'] || '0';
 | |
|     const param387 = judgeConfigObj['387'] || '0';
 | |
| 
 | |
|     if(judgeConfigObj['342'] === '3' || judgeConfigObj['342'] === '2'){
 | |
|       return false
 | |
|     }
 | |
| 
 | |
|     if(unExitManualProjects.includes(artSubject3ProjectsCodesArr[index])){
 | |
|       return false
 | |
|     }
 | |
| 
 | |
|     if(param348 == '0' && projectsObj['9']?.type == 2){
 | |
|       return index === 0 ? true : false
 | |
|     }
 | |
| 
 | |
|     if(param387 === '0' && index === 5){
 | |
|       const {examMileage,jl} = this
 | |
|       return jl >= Number(examMileage)
 | |
|     }
 | |
| 
 | |
|     return true
 | |
|   }
 | |
| 
 | |
|   //页面通用字体大小
 | |
|   @State FONTSIZE: number = 28
 | |
|   @State BIGFONTSIZE: number = 28
 | |
|   //结束考试弹窗
 | |
|   @State endPopupVisible: boolean = false
 | |
|   //等待弹窗(考试及格,考试不及格使用)
 | |
|   @State loadingPopupVisible: boolean = false
 | |
|   //实时轨迹弹窗
 | |
|   @State signDisplayComVisible: boolean = false
 | |
|   @State isDdxk: boolean = false;
 | |
|   @State time: string = ''
 | |
|   //考试用时
 | |
|   @State examTime: number = 0
 | |
|   //开始时间
 | |
|   @State startTime: string = '00:00:00'
 | |
|   @State startFullTime: string = ''
 | |
|   @State startHourTime: string = ''
 | |
|   //科目类型
 | |
|   @State examSubject: 2 | 3 = 3;
 | |
|   @State ddxkTime: number = 0;
 | |
|   @State ddxkKsxmArr: string[] = ['']
 | |
|   @State ddxkKfArr: string[] = ['']
 | |
|   @State xmmcStr: string = ''
 | |
|   @State carztStr: string = ''
 | |
|   @State kfArr: {
 | |
|     xmmcStr?: string,
 | |
|     score: string,
 | |
|     desc: string
 | |
|   }[] = []
 | |
| 
 | |
|   @State name: string = ''
 | |
|   @State idCard: string = ''
 | |
|   @State totalScore: number = 100
 | |
|   //模拟考试项目
 | |
|   @State projects: Project[] = []
 | |
|   @State projectsObj: ProjectObj = {}
 | |
|   @State projectsCenterObj: ProjectObj = {}
 | |
|   @State markRuleListObj: MarkRule = {}
 | |
|   @State cdsbInfoObj: CDSBInfo = {}
 | |
|   @State timer: number = 0
 | |
|   @State judgeConfig: {[k:string]:string}[] = []
 | |
|   @State judgeConfigObj: {[k:string]:any} = defaultJudgeConfigObj
 | |
| 
 | |
|   //流水号
 | |
|   @State lsh: string = ''
 | |
|   @State kszp: string = ''
 | |
|   @State ksdd: string = ''
 | |
|   @State kssycs: string = ''
 | |
|   @State kslx: string = ''
 | |
| 
 | |
|   //监管接口序列号
 | |
|   @State serialNumber: number = 0
 | |
|   @State carType: string = ''
 | |
|   @State carName: string = ''
 | |
|   @State isDeductedPopShow: boolean = false
 | |
|   @State isAmplifyPopShow: boolean = false
 | |
|   @State amplifiedImgIndex: number = 0
 | |
|   @State judge:any = {}
 | |
| 
 | |
|   //行驶距离
 | |
|   @State jl:number =0
 | |
|   //应考里程
 | |
|   @State examMileage:string = '0'
 | |
|   //已考的考试项目
 | |
|   private wantInfos = []
 | |
| 
 | |
|   @State artSubject3Projects: string[] = ['直线', '会车', '变道','超车', '掉头', '停车']
 | |
|   @State artSubject3ProjectsCodesArr: string[] = ['3', '9', '4','10', '12', '11']
 | |
| 
 | |
|   @State manualMarkRules:MarkRule[] = []
 | |
| 
 | |
|   //科目三评判初始化数据
 | |
|   @State systemparmArr:SYSTEMPARMARR[] = []
 | |
|   @State mapPointItemArr:MAPITEMPOINTITEM[] = []
 | |
|   @State carinfoArrr:CARINFO[] = []
 | |
|   @State mapPointArr:MAPPOINT[] = []
 | |
| 
 | |
| }
 |