diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index 76815dc8..6d28d3c3 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -28,7 +28,7 @@ import DeviceInfoTable from '../constants/DeviceInfoTable' import USER from '../constants/USER' import util from '@ohos.util'; import zlib from '@ohos.zlib'; -import FileModel from '../../pages/judgeSDK/utils/file-model'; +import FileModel from '../../pages/judgeSDK/utils/fileModel'; // @ts-nocheck //读表 //参数平台 diff --git a/entry/src/main/ets/common/utils/request.ts b/entry/src/main/ets/common/utils/request.ts index bb95ff22..732f6c04 100644 --- a/entry/src/main/ets/common/utils/request.ts +++ b/entry/src/main/ets/common/utils/request.ts @@ -1,7 +1,7 @@ import http from '@ohos.net.http'; import convertxml from '@ohos.convertxml'; import prompt from '@ohos.prompt' -import { sendGreen } from '../../pages/judgeSDK/utils/judge-common'; +import { sendGreen } from '../../pages/judgeSDK/utils/judgeCommon'; import {GlobalConfig} from '../../config/index' const config = { host:GlobalConfig.host, diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index 7ea3cdbd..931fe70a 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -6,7 +6,7 @@ import LoadingPopup from './compontents/judge/LoadingPopup'; import DeductedPopup from './compontents/judge/DeductionPopup'; import AmplifyPopup from './compontents/judge/AmplifyPopup'; import Judge from './judgeSDK/judge'; -import { defaultJudgeConfigObj } from './judgeSDK/utils//judge-common'; +import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon'; import { CARINFO, CDSBInfo, @@ -21,7 +21,7 @@ import { import { chunkArr, formatTime, getCurrentHourTime, getCurrentTime } from '../common/utils/tools'; import { examJudgeEndExam } from './judgeSDK/api/index'; import { getSyncData } from '../common/service/initable'; -import { judgeConfig } from './judgeSDK/utils/judge-config'; +import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import FileUtil from '../common/utils/File'; import SignDisplayCom from './compontents/signDisplayCom'; @@ -29,78 +29,6 @@ import SignDisplayCom from './compontents/signDisplayCom'; @Entry @Component struct Index { - scroller: Scroller = new Scroller() - //页面通用字体大小 - @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' - @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[] = [] - private context = getContext(this) as common.UIAbilityContext; - private img: ImageBitmap = new ImageBitmap("/resources/base/media/1.png") - //已考的考试项目 - private wantInfos = [] async aboutToAppear() { globalThis.windowClass.setWindowSystemBarEnable(['']) @@ -121,6 +49,8 @@ struct Index { //断点续考 await this.goDdxkItems() + + //初始化评判 const judge = await this.initJudge(); this.judge = judge @@ -200,10 +130,9 @@ struct Index { NoCancelId: mark.nocancelid * 1, GPS_SID: mark.gps_sid == 0 ? false : true } - const markserial = mark.markserial * 1; //筛选出人工评判的扣分 - if (markserial > 100 && markserial < 200) { + if (Number(tempObj.markserial) > 100 && Number(tempObj.markserial) < 200) { this.manualMarkRules.push(tempObj) } this.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = { @@ -244,6 +173,33 @@ struct Index { this.examMileage = sys.v_value + ''; } + //364 绕车一周评判时机(1-开始考试后判 2-开始考试前判) + if(sys.v_no == '364' && sys.v_value == 2 ){ + let currentParams: any = router.getParams(); + const {sczb,kfdm} = currentParams; + kfdm.forEach(kf => { + const {xmdm, kfdm} = kf + const currentKf = this.markRuleListObj[`${xmdm}_${kfdm}`]; + const currentProject = this.projectsObj[xmdm] + 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.projectsObj['1'].type = kfdm.length ? '4':'3'; + this.projectsObj = { + ...this.projectsObj + } + } + this.judgeConfigObj[sys.v_no] = value }); this.judgeConfig = syssetJudgeConfigArr; @@ -300,7 +256,8 @@ struct Index { //初始化systemParam表 async initSystemKm3Param(sysParam?: SYSTEMPARMARR[]) { const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM') - + let currentParams: any = router.getParams(); + this.wayno = currentParams.wayno const {isTrajectoryOpen} = judgeConfig systemParms.forEach((systemParm) => { @@ -538,7 +495,7 @@ struct Index { if (this.examSubject == 3) { Row() { Text('考试路线:').fontColor('#E5CCA1').fontSize(this.FONTSIZE) - Text(`线路${globalThis.carInfo.wayno}`).fontColor('#FFAD33').fontSize(this.FONTSIZE) + Text(`线路${this.wayno}`).fontColor('#FFAD33').fontSize(this.FONTSIZE) } } @@ -905,6 +862,7 @@ struct Index { if (this.isDeductedPopShow) { DeductedPopup({ currentItems: Reflect.ownKeys(this.projectsObj).map(projectKey => { + //@ts-ignore const project = this.projectsObj[projectKey] return project.type == '2' ? project.projectCode : '' }).filter(project => project !== ''), @@ -974,6 +932,7 @@ struct Index { return false } + //@ts-ignore if (param348 == '0' && projectsObj['9']?.type == 2) { return index === 0 ? true : false } @@ -985,4 +944,78 @@ struct Index { return true } + + scroller: Scroller = new Scroller() + //页面通用字体大小 + @State wayno:number = 0 + @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' + @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[] = [] + private context = getContext(this) as common.UIAbilityContext; + private img: ImageBitmap = new ImageBitmap("/resources/base/media/1.png") + //已考的考试项目 + private wantInfos = [] } diff --git a/entry/src/main/ets/pages/Roads.ets b/entry/src/main/ets/pages/Roads.ets index 3d0e2cf1..ee85a8ba 100644 --- a/entry/src/main/ets/pages/Roads.ets +++ b/entry/src/main/ets/pages/Roads.ets @@ -24,7 +24,6 @@ export default struct Index { const {no1,no2,no3,txt1,txt2} = systemParm; if (no1 == 4) { const temp = { no2, no3, txt1: decodeURI(txt1), txt2 } - console.info('surenjun', JSON.stringify(temp)) this.roadObj[no2] = no2 } }) @@ -57,10 +56,8 @@ export default struct Index { const roadArr = Reflect.ownKeys(this.roadObj).map((roadKey) => { return this.roadObj[roadKey] }); - globalThis.carInfo.wayno = roadArr[Math.floor(Math.random()*roadArr.length)]; - router.pushUrl({ - url: 'pages/Judge', - }, router.RouterMode.Single); + const wayno = roadArr[Math.floor(Math.random()*roadArr.length)]; + this.goJudge(wayno) }) ForEach(Reflect.ownKeys(this.roadObj), (roadIndex) => { ListItem() { @@ -81,10 +78,7 @@ export default struct Index { .height(220) .margin({ left: 5, bottom: 10 }) .onClick(async () => { - globalThis.carInfo.wayno = this.roadObj[roadIndex]; - router.pushUrl({ - url: 'pages/Judge', - }, router.RouterMode.Single); + this.goJudge(this.roadObj[roadIndex]) }) }) }.lanes(8).margin({ top: 50, left: 15 }) @@ -95,6 +89,18 @@ export default struct Index { } - outClick() { + goJudge(wayno) { + let currentParams: any = router.getParams() || {}; + const {sczb,kfdm} = currentParams; + router.replaceUrl({ + url: 'pages/Judge', + params:{ + sczb, + kfdm, + wayno + } + }, router.RouterMode.Single); + } + outClick(){} } \ No newline at end of file diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index b5f5cca0..d78c8ac0 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -14,8 +14,9 @@ import common from '@ohos.app.ability.common'; import { User } from './interfaces'; import WebRTCVoice from './webRTC/'; import promptAction from '@ohos.promptAction'; +import { getSyncData } from '../common/service/initable'; import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData'; - +import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup' @Entry @Component struct UserInfo { @@ -34,6 +35,10 @@ struct UserInfo { @State url: string = '' @State lsh: string = '' @State qkFlag: boolean = false + @State isBoardPrePareSetPopupOpen: boolean = false + @State isFirstBoardPrePareSetPopupBtnShow: boolean = false + @State isBoardPrePareSetPopupShow: boolean = false + @State sczbkf:{xmdm:number,kfdm:string}[] = [] @State currentUser: User = EmptyCandidateObject @State dataList: Array = [] @State list: Array = [] @@ -194,7 +199,9 @@ struct UserInfo { this.qkFn() } - initData() { + async initData() { + this.sczbkf = [] + this.isFirstBoardPrePareSetPopupBtnShow = false; this.stepFlag = false this.faceCompareSucess = 0 this.showFaceCompare = false @@ -216,6 +223,15 @@ struct UserInfo { } else { // this.getExaminationStudentInfoFn() } + const syssetParams = await getSyncData('MA_SYSSET'); + //@ts-ignore + syssetParams.forEach(sys => { + //364 绕车一周评判时机(1-开始考试后判 2-开始考试前判) + if(sys.v_no === '364'){ + this.isBoardPrePareSetPopupOpen = true; + } + }) + } async heartMsg() { @@ -531,6 +547,7 @@ struct UserInfo { build() { Column() { + TopLogo({ outFlag: $outFlag }).margin({ bottom: 10 }) Row() { Row() { @@ -627,54 +644,72 @@ struct UserInfo { .onClick(() => { this.qkFlag = true }) - Image($r('app.media.ksks_btn')) - .commStyle() - .onClick(() => { - this.faceCompareSucess = 0 - globalThis.statue = 2 - if (!this.currentUser.xm) { - return - } - // if(globalThis.spzdFlag){ - // promptAction.showToast({ - // message: '摄像头被遮挡', - // duration: 2000 - // }); - // return - // } - //TODO 科目三先写死 - globalThis.carInfo.examSubject = 3; - if (globalThis.singlePlay) { - const {examSubject} = globalThis.carInfo; - this.AccountTable.query('0', (result) => { - if (result.length == 0) { - this.AccountTable.insertData(this.currentUser, (id) => { - this.AccountTable.query('0', (result) => { - router.pushUrl({ - url: examSubject == 3 ? 'pages/Roads':'pages/Judge', - }, router.RouterMode.Single); - this.stopDeviceById() - }) - }) - } else { - this.AccountTable.updateData(this.currentUser, (id) => { - this.AccountTable.query('0', (result) => { - router.pushUrl({ - url: examSubject == 3?'pages/Roads':'pages/Judge', - }, router.RouterMode.Single); - this.stopDeviceById() - }) - }) - } - }) - return - } - if (this.FaceOpenStatue != '0') { - this.showFaceCompare = true - } else { - this.sfbdinterfaceFn() - } + + if( this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow){ + //上车准备 + Image($r('app.media.sczb_btn')).commStyle().onClick(()=>{ + this.isBoardPrePareSetPopupShow = true; + this.isFirstBoardPrePareSetPopupBtnShow = true; }) + }else{ + Image($r('app.media.ksks_btn')) + .commStyle() + .onClick(() => { + this.faceCompareSucess = 0 + globalThis.statue = 2 + if (!this.currentUser.xm) { + return + } + // if(globalThis.spzdFlag){ + // promptAction.showToast({ + // message: '摄像头被遮挡', + // duration: 2000 + // }); + // return + // } + //TODO 科目三先写死 + globalThis.carInfo.examSubject = 3; + if (globalThis.singlePlay) { + const {examSubject} = globalThis.carInfo; + this.AccountTable.query('0', (result) => { + if (result.length == 0) { + this.AccountTable.insertData(this.currentUser, (id) => { + this.AccountTable.query('0', (result) => { + router.pushUrl({ + url: examSubject == 3 ? 'pages/Roads':'pages/Judge', + params:{ + sczb:Number(this.isBoardPrePareSetPopupOpen), + kfdm:this.sczbkf + } + }, router.RouterMode.Single); + this.stopDeviceById() + }) + }) + } else { + this.AccountTable.updateData(this.currentUser, (id) => { + this.AccountTable.query('0', (result) => { + router.pushUrl({ + url: examSubject == 3?'pages/Roads':'pages/Judge', + params:{ + sczb:Number(this.isBoardPrePareSetPopupOpen), + kfdm:this.sczbkf + } + }, router.RouterMode.Single); + this.stopDeviceById() + }) + }) + } + }) + return + } + if (this.FaceOpenStatue != '0') { + this.showFaceCompare = true + } else { + this.sfbdinterfaceFn() + } + }) + } + } } @@ -719,6 +754,19 @@ struct UserInfo { .backgroundColor('#E6E3DF') .borderRadius(19 * this.ratio) } + + // 上车准备 + if(this.isBoardPrePareSetPopupShow){ + BoardPrePareSetPopup({ + closePopup:()=>{ + this.isBoardPrePareSetPopupShow = false + }, + confirmMark:(kfdm)=>{ + this.sczbkf= kfdm + } + }) + } + } .height('100%') .width('100%') diff --git a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets index cb308267..934bec84 100644 --- a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets +++ b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets @@ -1,6 +1,6 @@ import router from '@ohos.router'; import UdpClient from '../../common/utils/UdpClient'; -import FileLog from '../judgeSDK/utils/file-log'; +import FileLog from '../judgeSDK/utils/fileLog'; import RealTime from '../compontents/judge/RealTime'; import { GPSData, SignalData } from '../../mock'; import { SignalDataType } from '../../model'; diff --git a/entry/src/main/ets/pages/compontents/judge/BoardPrePareSetPopup.ets b/entry/src/main/ets/pages/compontents/judge/BoardPrePareSetPopup.ets new file mode 100644 index 00000000..96b87056 --- /dev/null +++ b/entry/src/main/ets/pages/compontents/judge/BoardPrePareSetPopup.ets @@ -0,0 +1,349 @@ +import { getSyncData } from '../../../common/service/initable'; +import { judgeConfig } from '../../judgeSDK/utils/judgeConfig'; +import FileUtil from '../../../common/utils/File'; +import common from '@ohos.app.ability.common'; +import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements'; + +import { + MarkRule, + SYSSET, +} from '../../judgeSDK/api/judgeSDK.d'; + +interface SEL { + fontColor: string + bgColor: string +} + +@Component +export default struct DeductedPopup { + private context = getContext(this) as common.UIAbilityContext; + private avPlayer + @State name: string = '' + @State idCard: string = '' + @State lsh: string = '' + @State kszp: string = '' + @State ksdd: string = '' + @State kssycs: string = '' + @State kslx: string = '' + @State kfdmArr: { + xmdm: number, + kfdm: string, + markreal: number + }[] = [] + //开始考试前判绕车一周评判是否开启 + @State isOpen: boolean = false + //监管序列号 + @State serialNumber: number = 0; + @State examSubject: number = 2; + @State markRuleListObj: MarkRule = {} + @State fontSize: number = 25 + @State unselected: SEL = { fontColor: '#000000', bgColor: '#CCC4B8' } + @State selected: SEL = { fontColor: '#FFAD33', bgColor: '#26231E' } + @State currentIndex: number = 0 + @State currentPageIndex: number = 0 + //通用评判扣分 + @State currentUniversalPageIndex: number = 0; + @State universalMarkRules: MarkRule[] = [] + @State manualMarkRules: MarkRule[] = [] + @State lineBg: Array = ['#4D4136', '#26231E'] + @State selectedLine: number = undefined + private closePopup: Function = () => { + } + private confirmMark: Function = (itemno: number, serial: string) => { + } + @State selectedLineStyle: SEL = { + fontColor: '#FFF', + bgColor: '#B36E00' + } + + aboutToAppear() { + //上车准备 + // this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+'')) + const {isTrajectoryOpen} = judgeConfig; + if (isTrajectoryOpen) { + this.initDb() + } else { + this.initSysset() + this.initMarkRules() + } + this.avPlayer = new VoiceAnnounce(); + } + + //本地数据初始化 + async initDb() { + const {isTrajectoryOpen,trajectoryPath} = judgeConfig + const examSubject = globalThis.carInfo.examSubject; + //轨迹回放读取 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); + this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject; + await this.initMarkRules(initDataObj.mark); + await this.initSysset(initDataObj.sysset); + await this.initStudent() + } + + //获取sysset表数据 + async initSysset(sysset?: SYSSET[]) { + const syssetParams = sysset || await getSyncData('MA_SYSSET'); + //@ts-ignore + syssetParams.forEach(sys => { + //监管序列号 + if (sys.v_no === '901') { + this.serialNumber = sys.v_value || '123456' + } + + //364 绕车一周评判时机(1-开始考试后判 2-开始考试前判) + if (sys.v_no === '364') { + const isOpen = sys.v_value == 2 + if (isOpen) { + this.avPlayer.playAudio(['voice/上车准备.mp3']) + } + + } + }) + } + + //获取markrule表数据 + 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, + markstandard: mark.markstandard * 1, + markserial: mark.markserial, + kfxh: mark.kfxh, + OnlyOneKind: mark.onlyoneid * 1, + NoCancelId: mark.nocancelid * 1, + GPS_SID: mark.gps_sid == 0 ? false : true + } + + if (mark.itemno == 1) { + this.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = { + ...tempObj, + markserial: mark.markserial, + }; + this.universalMarkRules.push(tempObj) + } + + }) + + } + + // 获取考生信息 + 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 || '01234567891010'; + this.lsh = lsh; + this.kszp = kszp; + this.ksdd = ksdd; + this.kssycs = kssycs; + this.kslx = kslx; + } + + //上一页 下一页 + goPage(typeIndex) { + const currentIndex = this.currentIndex + if (currentIndex) { + //通用评判 + typeIndex ? (this.currentUniversalPageIndex += 1) : (this.currentUniversalPageIndex -= 1) + } else { + typeIndex ? (this.currentPageIndex += 1) : (this.currentPageIndex -= 1) + } + this.selectedLine = -1 + } + + //选中扣分项 + getSelectedLine(index) { + const {selectedLine,selectedLineStyle,lineBg} = this; + if (selectedLine === index) { + return selectedLineStyle.bgColor + } + if (index % 2 === 0) { + return lineBg[0] + } else { + return lineBg[1] + } + } + + //获取当前页的数据 + getCurrentMarkRuleList() { + const {currentIndex,currentUniversalPageIndex,currentPageIndex,universalMarkRules} = this; + if (currentIndex) { + //通用评判 + return universalMarkRules.slice(currentUniversalPageIndex * 7, (currentUniversalPageIndex + 1) * 7) + } else { + return universalMarkRules.slice(currentPageIndex * 7, (currentPageIndex + 1) * 7) + } + } + + build() { + Column() { + Column() { + Column() { + Row() { + Row() { + ForEach(['人工评判'], (text, index) => { + + Row() { + Text(text) + .fontColor(index === this.currentIndex ? this.selected.fontColor : this.unselected.fontColor) + .fontSize(this.fontSize) + .fontWeight(500) + } + .width(180) + .height(70) + .backgroundColor(index === this.currentIndex ? this.selected.bgColor : this.unselected.bgColor) + .justifyContent(FlexAlign.Center) + .justifyContent(FlexAlign.Center) + .borderRadius({ topLeft: 20, topRight: 20 }) + .margin({ right: 10 }) + .onClick(() => { + this.currentIndex = index; + this.selectedLine = -1; + // if(index === 1) { + // this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 ) + // }else{ + // this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+'')) + // } + }) + }) + } + + Row() { + if ( + (Math.ceil(this.universalMarkRules.length / 7 - 1)) >= (this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) && + (this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) > 0 + ) { + Row() { + Row() { + }.width(36).height(36).backgroundImage($rawfile(`judge/km3/zuo_nor.png`)).margin({ left: 24, top: 4 }) + + Text('上一页') { + }.fontColor('#FFF').fontSize(this.fontSize) + } + .width(160) + .height(80) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .backgroundImage($rawfile(`judge/km3/button_nor.png`)) + .backgroundImageSize({ width: '100%', height: '100%' }) + .onClick(() => { + this.goPage(0) + }) + } + + if ( + (Math.ceil(this.universalMarkRules.length / 7 - 1)) > (this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) + ) { + Row() { + Text('下一页') { + }.fontColor('#FFF').fontSize(this.fontSize).padding({ left: 30 }) + + Row() { + }.width(36).height(36).backgroundImage($rawfile(`judge/km3/you_nor.png`)).margin({ left: 4, top: 4 }) + } + .width(160) + .height(80) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .backgroundImage($rawfile(`judge/km3/button_nor.png`)) + .backgroundImageSize({ width: '100%', height: '100%' }) + .onClick(() => { + this.goPage(1) + }) + } + + Row() { + Text('扣 分') { + }.fontColor('#FFF').fontSize(this.fontSize).padding({ left: 49 }) + } + .width(160) + .height(80) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .backgroundImage($rawfile(`judge/km3/button_nor.png`)) + .backgroundImageSize({ width: '100%', height: '100%' }) + .onClick(() => { + const index = this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex; + const mark = this.universalMarkRules[index * 7 + this.selectedLine]; + const {avPlayer,kssycs} = this; + this.kfdmArr.push({ xmdm: 1, kfdm: mark.markserial, markreal: mark.markreal }) + + //计算总扣分 + let score = this.kfdmArr.reduce((p, n) => { + p += n.markreal + return p + }, 0); + avPlayer.playAudio([`voice/${mark.markcatalog}.mp3`]); + console.info('surenjun',score) + if(!globalThis.singlePlay){ + if (score < -90) { + avPlayer.playAudio([ + 'voice/exam_waiting.mp3', + kssycs == '1' ? 'voice/unqualified_one.wav' : 'voice/unqualified_two.wav' + ]); + + }; + } + + this.confirmMark(this.kfdmArr.map((kf) => ({ + xmdm:kf.xmdm, + kfdm:kf.kfdm, + }))) + + }) + } + }.width('100%').justifyContent(FlexAlign.SpaceBetween) + + Column() { + ForEach(this.getCurrentMarkRuleList(), (item, index) => { + Row() { + Text(`${item.markshow} (${item.markcatalog})`).fontColor('#FFF').fontSize(this.fontSize).fontWeight(500) + Row() { + Text(item.markreal + '').fontColor('#FFF').fontSize(this.fontSize).fontWeight(500) + } + } + .width('100%') + .height(75) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Center) + .padding({ left: 20, right: 20 }) + .backgroundColor(this.getSelectedLine(index)) + .onClick(() => { + this.selectedLine = index + }) + }) + } + } + } + .width(1300) + .height(710) + .position({ x: '15%', y: '10%' }) + .backgroundColor('#E6E3DF') + .padding({ top: 15, bottom: 15, left: 25, right: 25 }) + .borderRadius(20) + + Row() { + } + .width(100) + .height(100) + .position({ y: '85%', x: '50%' }) + .backgroundImage($rawfile('judge/km3/close_nor.png')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .onClick(() => { + this.closePopup() + }) + }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.7)') + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/compontents/judge/RealTime.ets b/entry/src/main/ets/pages/compontents/judge/RealTime.ets index 9a69e4b2..7f17973a 100644 --- a/entry/src/main/ets/pages/compontents/judge/RealTime.ets +++ b/entry/src/main/ets/pages/compontents/judge/RealTime.ets @@ -1,5 +1,5 @@ import apiJudgeSdk from 'libJudgeSdk.so'; -import Judge from '../../judgeSDK/utils/judge-real'; +import Judge from '../../judgeSDK/utils/judgeReal'; import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d'; import common from '@ohos.app.ability.common'; diff --git a/entry/src/main/ets/pages/judgeSDK/api/index.ts b/entry/src/main/ets/pages/judgeSDK/api/index.ts index 6ca305c4..e9cb7df2 100644 --- a/entry/src/main/ets/pages/judgeSDK/api/index.ts +++ b/entry/src/main/ets/pages/judgeSDK/api/index.ts @@ -170,6 +170,26 @@ export async function examJudgeSetPerformCallback(fn){ const temp = libJudgeSdk.examJudgeSetPerformCallback(fn); return await handle(temp,'examJudgeSetPerformCallback') } + +/** + * + * @desc 语音播报结束 + * / + */ + +export async function examJudgeSoundEnd(param:{ + //项目代码 + itemno:number, + //语音码 + code:string, + //语音类型 + type:number, +}){ + const {itemno,code,type} = param; + const temp = libJudgeSdk.examJudgeSoundEnd(itemno,code,type); + return await handle(temp,'examJudgeSoundEnd') +} + /* * @desc通用处理函数 * diff --git a/entry/src/main/ets/pages/judgeSDK/api/judgeSDK.d.ts b/entry/src/main/ets/pages/judgeSDK/api/judgeSDK.d.ts index 4a49c751..ba4eace8 100644 --- a/entry/src/main/ets/pages/judgeSDK/api/judgeSDK.d.ts +++ b/entry/src/main/ets/pages/judgeSDK/api/judgeSDK.d.ts @@ -16,7 +16,8 @@ export interface MarkRule{ itemno?:number markcatalog?:string markshow?:string - markserial?:number + markserial?:string + markstandard?:number, markreal?:number kfxh?:string onlyoneid?:number @@ -118,7 +119,8 @@ export interface EXAMDATA{ sound:{ xmdm:number, //语音播放文件代码 - code:string + code:string, + type:number }, //模拟灯光 mndg:string @@ -138,7 +140,9 @@ export interface SOUND { //项目代码 xmdm:number //语音播放提示代码 - code:string + code:string, + //0:普通,1:模拟灯光 + type:number } export interface SYSSET { v_no:string, @@ -147,7 +151,7 @@ export interface SYSSET { } export interface ProjectObj { - [k:any]:Project + [k:string]:Project } diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 4330a17f..8d1d683d 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -6,15 +6,14 @@ import buffer from '@ohos.buffer'; import { testKmItems, testMarkRules } from './dataTest/index'; import { EXAMDATA, SOUND } from './api/judgeSDK'; -import VoiceAnnounce from './utils/voice-announcements'; -import FileModel from './utils/file-model'; -import FilePhoto from './utils/file-photo'; +import VoiceAnnounce from './utils/voiceAnnouncements'; +import FileModel from './utils/fileModel'; +import FilePhoto from './utils/filePhoto'; import FileUtil from '../../common/utils/File'; -import FileLog from '../judgeSDK/utils/file-log'; +import FileLog from './utils/fileLog'; -import JudgeTask from './utils/judge-task'; -import SimulateLights from './utils/simulate-lights'; -import { judgeConfig } from './utils/judge-config'; +import JudgeTask from './utils/judgeTask'; +import { judgeConfig } from './utils/judgeConfig'; import { uploadExamProgressData, writeObjectOut } from '../../api/judge'; import { @@ -36,35 +35,33 @@ import { plcStrToWXJson, promptWxCode, senorToWXDataStr -} from './utils/judge-common'; +} from './utils/judgeCommon'; import { examJudgeArtificialItem, examJudgeArtificialMark, examJudgeBeginExam, examJudgeEndExam, examJudgeInit, - examJudgeMapSetParam, - examJudgeMapSetScaling, + examJudgeSoundEnd, examJudgeRealExam, examJudgeSetLogCallback, examJudgeSetPerformCallback, examJudgeSetRealExamCallback } from './api/index'; import UsbService from '../../common/service/usbService'; + import Prompt from '@system.prompt'; const judgeTag = 'SURENJUN_JUDGE' export default class Judge { - constructor(judgeUI) { this.serialIndex = 1; this.judgeUI = judgeUI //语音播放工具 this.avPlayer = new VoiceAnnounce(); - new SimulateLights(this.avPlayer) //模型工具 this.fileModel = new FileModel(judgeUI.context); //文件工具 @@ -133,7 +130,7 @@ export default class Judge { console.info(judgeTag, '2.注册日志回调完成') let initInfo = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData(); - console.log('SURENJUN_JUDGE',isJudgeInitBool,isTrajectoryOpen,JSON.stringify(initInfo)) + //相关评判初始化只做一次 if (!isJudgeInitBool) { await fileLog.setExamJudgeData(initInfo) @@ -141,6 +138,7 @@ export default class Judge { globalThis.isJudgeInitBool = true console.info(judgeTag, '4.评判初始化完成') } else { + await fileLog.setExamJudgeData(initInfo) } globalThis.isJudge = true @@ -157,35 +155,140 @@ export default class Judge { this.performInfo = performInfo this.judgeUI.jl = Math.ceil((performInfo.qjjl + performInfo.dcjl) / 100) }) + // 3.开始考试 let beginExamInfo = isTrajectoryOpen ? { ...JSON.parse(strArr[1]), replay: 1 } : await getJudgeBeginData() - console.log(judgeTag,'22222',JSON.stringify(beginExamInfo),strArr[1]) - await fileLog.setExamJudgeData(beginExamInfo) - console.log(judgeTag,'333333') - await examJudgeBeginExam(beginExamInfo); - console.log(judgeTag,'4444444') + await fileLog.setExamJudgeData(beginExamInfo) + await examJudgeBeginExam(beginExamInfo); console.info(judgeTag, '6.开始考试注册完成') avPlayer.playAudio(['voice/ksks.WAV']) + this.judgeUI.draw = true + // 处理轨迹plc信息 if (isTrajectoryOpen) { handleTrajectoryUdp(strArr); return } + // 处理实时udp里的plc信号 globalThis.udpClient.onMessage(async (msg) => { handleUdp(msg) }) - } + // 获取评判初始化数据 + getJudgeInitData = async () => { + const {getModelData,getKm3JudgeInitConfig} = this + const carInfo = globalThis.carInfo; + const { examSubject,plateNo,carId } = carInfo; + const {fileLog} = this + const judgeUI = this.judgeUI + const {projectsObj,cdsbInfoObj,markRuleListObj,carType,carName} = judgeUI + const examType = examSubject == 2 ? 'km2' : 'km3' + + let allitems = []; + + if (examSubject == 2) { + allitems = Reflect.ownKeys(cdsbInfoObj).map(cdsbKey => { + const cdsb = cdsbInfoObj[cdsbKey]; + const {xmdm,xmxh,modelKey} = cdsb + return { + xmdm, xmxh, model: getModelData(`${examType}/${modelKey}.txt`) + } + }) + } + const initInfo = { + kskm: examSubject * 1, + kchp: plateNo, + kchm: carId * 1, + kscx: carType, + cxcode: '1', + name: carName, + carmodel: getModelData(`${examType}/${carType}.txt`), + allitems, + mark: Reflect.ownKeys(markRuleListObj).map(ruleKey => (markRuleListObj[ruleKey])) || testMarkRules, + sysset: judgeUI.judgeConfig, + }; + + let km3Config = {} + + if (examSubject) { + km3Config = await getKm3JudgeInitConfig(); + } + // 获取科目三的评判配置 + console.info(judgeTag, '3.获取评判初始化数据完成') + return { + ...initInfo, + ...km3Config, + } + } + // 获取开始考试数据 + getJudgeBeginData = async () => { + const {code,name:examinerName} = globalThis.examinerInfo; + let currentParams: any = router.getParams(); + const {sczb,kfdm} = currentParams; + const {isExam} = this; + const judgeUI = this.judgeUI + const {projects,carType,isDdxk,ddxkTime,projectsCenterObj,ddxkKsxmArr,ddxkKfArr} = judgeUI; + const beginInfo = { + kgid: '012', + kgxm: decodeURI(examinerName || ''), + exam: isExam ? 1 : 0, + //是否回放 + replay: 0, + //生成的轨迹文件 + track: '', + xm: judgeUI.name, + sex: 0, + kslsh: judgeUI.lsh, + sfzmhm: judgeUI.idCard, + ksyy: '', + kscx: carType, + kkcs: 1, + sfyk: 0, + ykkkcs: 1, + wayno: judgeUI.wayno * 1, + czlx: 0, + kskssj: await systemTime.getCurrentTime(), + ksxm: projects.map(project => { + return { + xmdm: project.projectCode * 1, + xmxh: '', + } + }), + //断点续考 + ddxk: isDdxk ? 1 : 0, + ddkssj: ddxkTime, + ykxm: isDdxk ? (ddxkKsxmArr?.map(projectCenterCode => (projectsCenterObj[projectCenterCode]?.projectCode) * 1)) : [], + kfxm: isDdxk ? (ddxkKfArr?.map(kf => { + const [xmdm, kfdm] = kf.split(',') + return { + xmdm: xmdm * 1, + kfdm + } + })) : [], + yklc: 0, + special: [], + //TODO 科目三参数临时写死 + sczb: (sczb === undefined || sczb == 0)?0:1, + sczbkf:kfdm, + dmndg: false, + nitem1: false, + nitem41: false, + mfxx: false, + mfxxn: false + } + console.info(judgeTag, '5.获取开始考试数据完成') + return beginInfo + } // 项目开始接口同步 beginProject = async (ksxm) => { const carInfo = globalThis.carInfo; @@ -326,28 +429,29 @@ export default class Judge { fileLog.setExamJudgeWuxiData(data) console.info(judgeTag, '上传照片 end') } - // 评判语音提示 goJudgeVoice = async (sound: SOUND) => { - const {avPlayer} = this; - const {xmdm,code} = sound; + const {avPlayer,fileLog} = this; + const {xmdm,code,type} = sound; //判断是不是模拟灯光语音 - const isLight = code.slice(0, 3) === '417'; - if (isLight) { + console.info(judgeTag,JSON.stringify(sound)) + if(type == 1){ console.info(judgeTag, '模拟灯光开始播放:' + code) } avPlayer.playAudio([`voice/${code}.mp3`], true, () => { - if (isLight) { + if (type == 1) { console.info(judgeTag, '播放结束:' + code) - setTimeout(() => { - this.wav = 1; + console.info(judgeTag,JSON.stringify({itemno:xmdm,code,type})) + examJudgeSoundEnd({itemno:xmdm,code,type}) + fileLog.setExamJudgeData({ + method: 'examJudgeArtificialItem', + itemno: xmdm, + type }) + this.wav = 0; } }) - - } - // 处理考试结束 public handEndExam = async (isManual?: Boolean) => { const {isExam,judgeUI,endExam,handleSEP,avPlayer} = this; @@ -380,26 +484,6 @@ export default class Judge { } } - - // 当前项目转换 - getDqxmStr = (type) => { - const projectsObj = this.judgeUI.projectsObj - return projectsObj[type]?.abbreviation || '通用评判' - } - - // 扣分项目转换 - getKfStr = (code) => { - const markRuleListObj = this.judgeUI.markRuleListObj; - const thisMark = markRuleListObj[code] - return { - desc: thisMark.markshow, - score: thisMark.markreal, - markcatalog: thisMark.markcatalog, - markserial: thisMark.markserial, - kfxh: thisMark.kfxh - } - } - // 考试结束 public endExam = async (isManual?: Boolean) => { const carInfo = globalThis.carInfo; @@ -449,55 +533,23 @@ export default class Judge { }, 3000) } - - // 获取评判初始化数据 - getJudgeInitData = async () => { - const {getModelData,getKm3JudgeInitConfig} = this - const carInfo = globalThis.carInfo; - const { examSubject,plateNo,carId } = carInfo; - const {fileLog} = this - const judgeUI = this.judgeUI - const {projectsObj,cdsbInfoObj,markRuleListObj,carType,carName} = judgeUI - - const examType = examSubject == 2 ? 'km2' : 'km3' - - let allitems = []; - - if (examSubject == 2) { - allitems = Reflect.ownKeys(cdsbInfoObj).map(cdsbKey => { - const cdsb = cdsbInfoObj[cdsbKey]; - const {xmdm,xmxh,modelKey} = cdsb - return { - xmdm, xmxh, model: getModelData(`${examType}/${modelKey}.txt`) - } - }) - } - const initInfo = { - kskm: examSubject * 1, - kchp: plateNo, - kchm: carId * 1, - kscx: carType, - cxcode: '1', - name: carName, - carmodel: getModelData(`${examType}/${carType}.txt`), - allitems, - mark: Reflect.ownKeys(markRuleListObj).map(ruleKey => (markRuleListObj[ruleKey])) || testMarkRules, - sysset: judgeUI.judgeConfig, - }; - - let km3Config = {} - - if (examSubject) { - km3Config = await getKm3JudgeInitConfig(); - } - // 获取科目三的评判配置 - console.info(judgeTag, '3.获取评判初始化数据完成') + // 当前项目转换 + getDqxmStr = (type) => { + const projectsObj = this.judgeUI.projectsObj + return projectsObj[type]?.abbreviation || '通用评判' + } + // 扣分项目转换 + getKfStr = (code) => { + const markRuleListObj = this.judgeUI.markRuleListObj; + const thisMark = markRuleListObj[code] return { - ...initInfo, - ...km3Config, + desc: thisMark.markshow, + score: thisMark.markreal, + markcatalog: thisMark.markcatalog, + markserial: thisMark.markserial, + kfxh: thisMark.kfxh } } - // 消息心跳发送 getMessageHeartbeat = async (isEnd?: Boolean) => { const carInfo = globalThis.carInfo; @@ -597,66 +649,6 @@ export default class Judge { this.serialIndex += 1; return Array2Byte(tempArr) } - - // 获取开始考试数据 - getJudgeBeginData = async () => { - console.log('globalThis.carInfo.wayno',globalThis.carInfo.wayno) - const {code,name:examinerName} = globalThis.examinerInfo; - const {isExam,isTrajectoryOpen} = this; - const judgeUI = this.judgeUI - const {projects,carType,isDdxk,ddxkTime,projectsCenterObj,ddxkKsxmArr,ddxkKfArr} = judgeUI; - const beginInfo = { - kgid: '012', - kgxm: decodeURI(examinerName || ''), - exam: isExam ? 1 : 0, - //是否回放 - replay: 0, - //生成的轨迹文件 - track: '', - xm: judgeUI.name, - sex: 0, - kslsh: judgeUI.lsh, - sfzmhm: judgeUI.idCard, - ksyy: '', - kscx: carType, - kkcs: 1, - sfyk: 0, - ykkkcs: 1, - wayno: Number(globalThis.carInfo.wayno)|| 0, - czlx: 0, - kskssj: await systemTime.getCurrentTime(), - ksxm: projects.map(project => { - return { - xmdm: project.projectCode * 1, - xmxh: '', - } - }), - //断点续考 - ddxk: isDdxk ? 1 : 0, - ddkssj: ddxkTime, - ykxm: isDdxk ? (ddxkKsxmArr?.map(projectCenterCode => (projectsCenterObj[projectCenterCode]?.projectCode) * 1)) : [], - kfxm: isDdxk ? (ddxkKfArr?.map(kf => { - const [xmdm, kfdm] = kf.split(',') - return { - xmdm: xmdm * 1, - kfdm - } - })) : [], - yklc: 0, - special: [], - //TODO 科目三参数临时写死 - sczb: 0, - sczbkf: [], - dmndg: false, - nitem1: false, - nitem41: false, - mfxx: false, - mfxxn: false - } - console.info(judgeTag, '5.获取开始考试数据完成') - return beginInfo - } - //获取场地序号 getSbxh = (ksxm, xmxh) => { const {judgeUI} = this; @@ -671,7 +663,6 @@ export default class Judge { const sbxh = currentCdsb.sbbh || '00000000' return sbxh } - getSbbm = (ksxm, xmxh) => { const {judgeUI} = this; const {cdsbInfoObj,projectsObj} = judgeUI; @@ -684,7 +675,6 @@ export default class Judge { const sbxh = currentCdsb.sbbm || '00000000' return sbxh } - // 中心所有项目转换 getTranslateProject = () => { // const {testKmItems} = this; @@ -707,13 +697,11 @@ export default class Judge { } return arr.map(numStr => parseInt(numStr, 2)); } - // 获取考试项目详情 getProjectInfo = (projectCode) => { const judgeUI = this.judgeUI; return judgeUI.projectsObj[projectCode] } - // 获取模型数据 getModelData = (modelName) => { const modelPath = this.modelPath @@ -744,7 +732,6 @@ export default class Judge { itemno: itemno * 1, type: 1 }) - console.info(judgeTag, `人工评判进入项目-${itemno}`) } @@ -864,8 +851,6 @@ export default class Judge { } } - public plcStr: string - private judgeUI // 更改考试状态 goVoiceAnnounce = async (event, xmdm, kf, xmjs) => { const {projectsObj,judgeConfigObj} = this.judgeUI; @@ -931,7 +916,6 @@ export default class Judge { break } } - // 获取plc数据 getPlcData = async (plc: string) => { const {fileLog,mndgStr,rmndg,wav} = this; @@ -960,7 +944,6 @@ export default class Judge { // 处理轨迹plc信号 handleTrajectoryUdp = async (strArr) => { const {fileLog} = this; - console.log('kkkkk') let num = 2; const {usbService} = this; const judgeTimer = setInterval(async () => { @@ -1088,7 +1071,8 @@ export default class Judge { judgeUI.projectsObj = deepClone(copyProjectsObj) } } - + public plcStr: string + private judgeUI private fileLog private totalScore: number private folderPath: string diff --git a/entry/src/main/ets/pages/judgeSDK/utils/file-log.ts b/entry/src/main/ets/pages/judgeSDK/utils/fileLog.ts similarity index 100% rename from entry/src/main/ets/pages/judgeSDK/utils/file-log.ts rename to entry/src/main/ets/pages/judgeSDK/utils/fileLog.ts diff --git a/entry/src/main/ets/pages/judgeSDK/utils/file-model.ts b/entry/src/main/ets/pages/judgeSDK/utils/fileModel.ts similarity index 100% rename from entry/src/main/ets/pages/judgeSDK/utils/file-model.ts rename to entry/src/main/ets/pages/judgeSDK/utils/fileModel.ts diff --git a/entry/src/main/ets/pages/judgeSDK/utils/file-photo.ts b/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts similarity index 100% rename from entry/src/main/ets/pages/judgeSDK/utils/file-photo.ts rename to entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judge-common.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeCommon.ts similarity index 100% rename from entry/src/main/ets/pages/judgeSDK/utils/judge-common.ts rename to entry/src/main/ets/pages/judgeSDK/utils/judgeCommon.ts diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judge-config.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts similarity index 92% rename from entry/src/main/ets/pages/judgeSDK/utils/judge-config.ts rename to entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts index 91a24376..08c40c34 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judge-config.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts @@ -9,7 +9,7 @@ export const judgeConfig = { // 本地模型地址 modelPath: 'models/model_enc', // 轨迹回放地址 - trajectoryPath: 'logs/2024_06_18/0000000000001_342323199501470011_测试学员1_2024_06_26_10_04_23/judge_exam_data.txt' + trajectoryPath: 'logs/2024_06_18/0000000000001_342323199501470011_测试学员1_2024_07_03_14_55_22/judge_exam_data.txt' } //0000000000001_342323199501470011_测试学员1_2024_04_28_10_59_44 // 模拟灯光轨迹 diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judge-real.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeReal.ts similarity index 87% rename from entry/src/main/ets/pages/judgeSDK/utils/judge-real.ts rename to entry/src/main/ets/pages/judgeSDK/utils/judgeReal.ts index 28ada877..76f23752 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judge-real.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeReal.ts @@ -5,7 +5,7 @@ import { import systemTime from '@ohos.systemDateTime'; import FileUtil from '../../../common/utils/File' -import FileModel from './../utils/file-model' +import FileModel from './fileModel' import {testRealExam} from '../dataTest/index' const judgeTag = 'SURENJUN_JUDGE' @@ -27,11 +27,14 @@ export default class JudgeImg { } async init(){ + const isJudgeInitBool = globalThis.isJudgeInitBool; const {judgeUI} = this; - console.info(judgeTag,'1.进入绘制入口') + console.info(judgeTag,'1.进入评判入口') + await examJudgeMapSetParam(640, 480); //设置参数宽、高 await examJudgeMapSetScaling(120); //设置缩放比例,一般默认填100(就是100%的意思) ,数字越大视野越大,数字越小视野越小,不能为0 judgeUI.draw = true + } //获取评判初始化数据 diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judge-task.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeTask.ts similarity index 100% rename from entry/src/main/ets/pages/judgeSDK/utils/judge-task.ts rename to entry/src/main/ets/pages/judgeSDK/utils/judgeTask.ts diff --git a/entry/src/main/ets/pages/judgeSDK/utils/simulate-lights.ts b/entry/src/main/ets/pages/judgeSDK/utils/simulate-lights.ts deleted file mode 100644 index 96903f15..00000000 --- a/entry/src/main/ets/pages/judgeSDK/utils/simulate-lights.ts +++ /dev/null @@ -1,27 +0,0 @@ -import VoiceAnnounce from './voice-announcements' - -// 模拟灯光 -export default class SimulateLights{ - - //模拟灯光播放5个 - private avPlayer - - //语音文件存放目录 - private voiceDir:string = 'judge/km3/lights' - - constructor(avPlayer) { - this.avPlayer = avPlayer; - this.playLight() - } - - //播放灯光语音 - public async playLight(){ - - } - - //获取随机播放序号 - private async getRandomIndex(){ - - } - -} \ No newline at end of file diff --git a/entry/src/main/ets/pages/judgeSDK/utils/voice-announcements.ts b/entry/src/main/ets/pages/judgeSDK/utils/voiceAnnouncements.ts similarity index 98% rename from entry/src/main/ets/pages/judgeSDK/utils/voice-announcements.ts rename to entry/src/main/ets/pages/judgeSDK/utils/voiceAnnouncements.ts index 16a14643..7be0b853 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/voice-announcements.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/voiceAnnouncements.ts @@ -16,7 +16,7 @@ export default class VoiceAnnounce{ this.queue = [] } - async playAudio(urls:string[],shit,callback:Function){ + async playAudio(urls:string[],shit?:boolean,callback?:Function){ const {isStopped,queue} = this; this.callback = callback if(shit){ diff --git a/entry/src/main/resources/base/media/sczb_btn.png b/entry/src/main/resources/base/media/sczb_btn.png new file mode 100644 index 00000000..bd3dee61 Binary files /dev/null and b/entry/src/main/resources/base/media/sczb_btn.png differ