diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 9a81e43b..8c3f3534 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -10,7 +10,7 @@ import { getUDP, getUDP2 } from '../common/utils/GlobalUdp'; import { initJudgeUdp } from '../common/utils/UdpJudge'; import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import { getTCP } from '../common/utils/GlobalTcp'; -import { getSingleCenterTable, setliushuiNum, takePhotoFn ,uploadLogFile} from '../common/service/indexService'; +import { getSingleCenterTable, setliushuiNum, takePhotoFn, uploadLogFile } from '../common/service/indexService'; import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; import promptAction from '@ohos.promptAction'; import errorMsgDialog from './compontents/errorMsgDialog'; @@ -19,9 +19,10 @@ import UdpEvent from '../common/utils/UdpEvent'; import { delPic } from '../common/service/videoService'; import imageBtn from './compontents/imageBtn'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; -import {updateModelAndCar} from '../common/autoUpdate/index' +import { updateModelAndCar } from '../common/autoUpdate/index' // import {uploadLogFile} from '../common/service/indexService' import { getModalValueCdAndCar } from '../api'; +import Want from '@ohos.app.ability.Want'; // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; @@ -342,7 +343,7 @@ struct Index { .width(80 * globalThis.ratio) .height(80 * globalThis.ratio) .position({ x: 288 * globalThis.ratio, y: 89 * globalThis.ratio }) - Text(this.loadingText ||'获取考车信息,请稍候……') + Text(this.loadingText || '获取考车信息,请稍候……') .fontSize(24 * globalThis.ratio) .margin({ top: 20 * globalThis.ratio }) .fontWeight(400) @@ -438,9 +439,9 @@ struct Index { this.loading = true console.log("sql 1111") - getSingleCenterTable(param).then(async (ret:any) => { + getSingleCenterTable(param).then(async (ret: any) => { - if(!this.isModelInit){ + if (!this.isModelInit) { this.loading = true this.loadingText = '正在下载考车模型,请稍候……' await updateModelAndCar(false) @@ -449,7 +450,7 @@ struct Index { this.isModelInit = true } - if(typeof ret == 'object' && ret.resultCode == '3'){ + if (typeof ret == 'object' && ret.resultCode == '3') { this.loadingText = '正在下载考车最新版本,请稍候……' this.loading = true await updateModelAndCar(true) @@ -469,7 +470,7 @@ struct Index { if (globalThis.singlePlay) { router.pushUrl({ url: 'pages/userInfo' - },router.RouterMode.Single) + }, router.RouterMode.Single) return } if (globalThis.singlePlay) { diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 7673b314..72b4426d 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -59,6 +59,7 @@ import { GlobalConfig } from '../../config'; import Want from '@ohos.app.ability.Want'; const judgeTag = 'SURENJUN_JUDGE' +const newAppTag = 'NewAppTag' function ifNeedRetry(code: number | string): boolean { let arr = ["B210010", "B210023", "B210024", "B210031", "B210033", "B210034", "B210041"] @@ -67,6 +68,7 @@ function ifNeedRetry(code: number | string): boolean { } return false } + export default class Judge { // 过程照片拍照 getPhoto = async (empty?: boolean) => { @@ -117,7 +119,7 @@ export default class Judge { const examDataArr = examDataStr.split('\n'); for (let examDataStr of examDataArr) { const examData = JSON.parse(examDataStr) - const code = await writeObjectOut(examData,false); + const code = await writeObjectOut(examData, false); } } //上传无锡所过程数据 @@ -392,10 +394,10 @@ export default class Judge { //成绩不合格 if (totalScore < passingGrade) { //科目三不合格报靠边停车 - if (examSubject == 3 ) { - if( param302 == 1){ + if (examSubject == 3) { + if (param302 == 1) { avPlayer.playAudio([`voice/考试结束.mp3`]); - }else if(param302 == 0){ + } else if (param302 == 0) { return } } @@ -471,7 +473,7 @@ export default class Judge { private testKmItems: any private plcData: any //特殊扣分标记 - private specialkf:string = '' + private specialkf: string = '' // 获取plc数据 getPlcData = async (plc: string) => { const {fileLog,mndgStr,rmndg} = this; @@ -542,7 +544,7 @@ export default class Judge { // 调代理接口是否断网了 private isJudgeDisConnect: boolean; // 项目开始接口同步 - beginProject = async (ksxm,xmxh?:string) => { + beginProject = async (ksxm, xmxh?: string) => { const carInfo = globalThis.carInfo; const { examSubject,plateNo } = carInfo; const {judgeUI,fileLog,getSbbm,filePath} = this; @@ -576,7 +578,7 @@ export default class Judge { promptWxCode('17C52', code) } // 项目结束接口同步 - endProject = async (ksxm,xmxh?:string) => { + endProject = async (ksxm, xmxh?: string) => { const carInfo = globalThis.carInfo; const deviceNo = globalThis.deviceNo; const { examSubject,plateNo,carNo } = carInfo; @@ -606,7 +608,7 @@ export default class Judge { const {code} = await this.sendWriteObjectOut(data, filePath) //科三 & 432=3 - if(examSubject == 3 && this.judgeUI.judgeConfigObj['432'] == 2){ + if (examSubject == 3 && this.judgeUI.judgeConfigObj['432'] == 2) { this.judgeUI.uploadMileage() } @@ -624,8 +626,6 @@ export default class Judge { private disConnectNum: number = 0; //调用监管接口 private externalTransmission: boolean = false - // 计算是否启动 - private whetherToStart: boolean //调用监管接口 sendWriteObjectOut = async (data, filePath) => { const temp = await writeObjectOut(data, this.externalTransmission, filePath); @@ -646,9 +646,10 @@ export default class Judge { return await this.sendWriteObjectOut(data, filePath) } if (this.disConnectNum >= 5) { + console.log(newAppTag, "大于5次,需要拉起app") this.externalTransmission = true let want: Want = { - bundleName: 'com.oh.upload', // 替换为你的应用包名 + bundleName: 'com.example.upload', // 替换为你的应用包名 abilityName: 'EntryAbility', // 你的 Service Ability 名称 moduleName: 'entry', // 你的模块名称,通常是 'entry', parameters: {} @@ -659,10 +660,10 @@ export default class Judge { .then(() => { }) .catch((error) => { - console.error(`拉起应用失败: ${error.code} - ${error.message}`); + console.error(newAppTag, `拉起应用失败: ${error.code} - ${error.message}`); }); } catch (error) { - console.error(`启动Ability异常: ${error.message}`); + console.error(newAppTag, `启动Ability异常: ${error.message}`); } return await this.sendWriteObjectOut(data, filePath) } @@ -670,9 +671,8 @@ export default class Judge { if (this.disConnectNum >= 5) { console.info('surenjun', '123') - this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; - this.judgeUI.disConnectErrorOpen = true - + // this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; + // this.judgeUI.disConnectErrorOpen = true } this.disConnectNum = 0 @@ -776,12 +776,12 @@ export default class Judge { allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { const cdsb = itemInfoObj[cdsbKey]; const {xmdm,xmxh,modelKey} = cdsb - const modelVal= getModelData(`${modelKey}.txt`) - if(modelVal){ + const modelVal = getModelData(`${modelKey}.txt`) + if (modelVal) { return { xmdm, xmxh, model: modelVal } - }else{ + } else { return undefined } }).filter(item => item !== undefined) @@ -875,7 +875,7 @@ export default class Judge { mfxx: false, mfxxn: false, //科目三特殊扣分项 - specialkf:judgeUI.specialkf, + specialkf: judgeUI.specialkf, } console.info(judgeTag, '5.获取开始考试数据完成') return beginInfo @@ -1100,7 +1100,7 @@ export default class Judge { if (!isEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) - await beginProject(xmdm,xmxh) + await beginProject(xmdm, xmxh) }, { isDelay: true }) @@ -1129,7 +1129,7 @@ export default class Judge { if (!projectIsEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) - await endProject(xmdm,xmxh) + await endProject(xmdm, xmxh) this.xmmcSingleCode = 0; this.xmmcEndCode = undefined; }, { @@ -1268,11 +1268,11 @@ export default class Judge { }) } else { //收到综合评判语音时,显示综合评判弹窗 - if(code[0] == 'zhpp'){ + if (code[0] == 'zhpp') { const param512 = (this.judgeUI.judgeConfigObj['512'] || '').split(','); this.judgeUI.isDeductedPopShow = false clearTimeout(this.deductedPopShowTimer) - if(param512[7] != 0){ + if (param512[7] != 0) { this.judgeUI.isDeductedPopShow = true this.judgeUI.defaultTabIndex = 1 } @@ -1864,7 +1864,7 @@ export default class Judge { //TODO 待优化 跨组件传值不生效 globalThis.laneData = performInfo.lane; //特殊扣分标记上传中心 - if(performInfo.specialkf !== this.specialkf){ + if (performInfo.specialkf !== this.specialkf) { this.judgeUI.uploadMileage(performInfo.specialkf) this.specialkf = performInfo.specialkf } @@ -1946,7 +1946,7 @@ export default class Judge { globalThis.udpEvent.onStopExam(async () => { const config392 = (this.judgeUI.judgeConfigObj['392'] || '20,81').split(','); console.info(judgeTag, '开始远程终止考试扣分') - this.setJudgeMark(config392[0]*1, config392[1], 2); + this.setJudgeMark(config392[0] * 1, config392[1], 2); }) this.checkExamIsEnd();