From 3714ed247827e8457adeb9e6b8a98f23d0a8997d Mon Sep 17 00:00:00 2001 From: surenjun Date: Sun, 12 Jan 2025 19:44:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:y=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/common/service/indexService.ts | 5 ++++- entry/src/main/ets/common/utils/File.ts | 3 ++- entry/src/main/ets/config/global.ts | 2 +- entry/src/main/ets/pages/Judge.ets | 1 + entry/src/main/ets/pages/judgeSDK/judge.ts | 21 +++++++++++++------ .../ets/pages/judgeSDK/utils/filePhoto.ts | 4 ++-- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index 26c509ae..f24b52fc 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -294,6 +294,7 @@ const devPath = "/dev/ttyS3" function openChuankouFn(callback) { console.log('SerialOpen in indexservice, path=' + devPath) + //TODO 自动挡车不读取串口 testNapi.SerialOpenAsync(devPath, (fd) => { globalThis.fd = fd; globalThis.num = 0 @@ -325,7 +326,9 @@ function getChuankouFnMsg() { // clearInterval(chuankou) testNapi.SerialClose(globalThis.fd); globalThis.fd = null - getChuankouFn() + setTimeout(()=>{ + getChuankouFn() + },2000) return } const msg = message?.split(',') diff --git a/entry/src/main/ets/common/utils/File.ts b/entry/src/main/ets/common/utils/File.ts index 8b1861bc..ba8353e5 100644 --- a/entry/src/main/ets/common/utils/File.ts +++ b/entry/src/main/ets/common/utils/File.ts @@ -12,7 +12,7 @@ export default class FileUtil{ private fileAccessHelper: fileAccess.FileAccessHelper //后续文件路径待替换 - private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files' + private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files/duolun' public destFile:string public filePathFdObj:Object = {} @@ -21,6 +21,7 @@ export default class FileUtil{ const {requestPermission} = this; this.wantInfos = wantInfos; requestPermission(); + fs.mkdir(this.absolutePath) } /* diff --git a/entry/src/main/ets/config/global.ts b/entry/src/main/ets/config/global.ts index 572f4cc8..ad653c37 100644 --- a/entry/src/main/ets/config/global.ts +++ b/entry/src/main/ets/config/global.ts @@ -7,7 +7,7 @@ * @Email: shutdown0630@163.com */ export const GlobalConfig={ - comoonfileWriteAddress:'/mnt/hmdfs/100/account/device_view/local/files', + comoonfileWriteAddress:'/mnt/hmdfs/100/account/device_view/local/files/duolun', picSavePath:'/storage/cloud/100/files/Photo/', videoSavePath:'/storage/cloud/100/files/Videos/', host:'http://172.37.55.1912:8082', diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index ae8c6864..31875fdb 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -986,6 +986,7 @@ struct Index { }, confirmFn: async () => { if(this.isErrorMsgEnd){ + this.judge.closeAllFiles() router.back() return } diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 2ffea422..3d4bdb03 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -639,10 +639,13 @@ export default class Judge { // 考试结束 case 5: console.info(judgeTag, '考试结束') + //关闭录像 + if(!globalThis.singlePlay){ + await endRecordVideo(this.videoData) + } judgeTask.addTask(async () => { console.info(judgeTag, '考试结束 start') globalThis.isJudge = false; - closeAllFiles() await handEndExam(ksjs) }) clearInterval(globalThis.judgeTimer) @@ -983,7 +986,7 @@ export default class Judge { this.judgeUI.endPopupVisible = false; this.judgeUI.isDeductedPopShow = false; const {qjjl,dcjl} = ksjs - const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual} = this; + const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual,closeAllFiles} = this; const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI; //计算考试分数 // this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0; @@ -998,6 +1001,8 @@ export default class Judge { //联网模式下手动结束的直接退出 if (!singlePlay && isManual && !isAllProjectsEnd) { avPlayer.playAudio(['voice/empty.mp3'], true, () => { + this.isUdpEnd = true; + setTimeout(()=>{ closeAllFiles();},1000) router.back(); }) return @@ -1037,7 +1042,7 @@ export default class Judge { const carInfo = globalThis.carInfo; const singlePlay = globalThis.singlePlay const { examSubject ,plateNo} = carInfo; - const {judgeUI,ksjs,getPhoto,uploadProgressData,uploadDisConnectData,avPlayer,kfArr,judgeTask,filePath} = this; + const {judgeUI,ksjs,getPhoto,uploadProgressData,uploadDisConnectData,avPlayer,kfArr,judgeTask,filePath,closeAllFiles} = this; const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI //TODO 断网考试结束补传 // await uploadDisConnectData(); @@ -1066,7 +1071,8 @@ export default class Judge { if(code != 1){ avPlayer.playAudio(['voice/监管失败.mp3']) this.judgeUI.errorMsg = decodeURIComponent(message) - this.isUdpEnd = true + this.isUdpEnd = true; + setTimeout(()=>{ closeAllFiles();},1000) return } @@ -1134,7 +1140,6 @@ export default class Judge { console.info(judgeTag, `考试成绩:${totalScore}`) if(!singlePlay){ - await endRecordVideo(this.videoData) await uploadProgressData(); } //语音播放扣分项 @@ -1150,7 +1155,8 @@ export default class Judge { if (score <= (examSubject == 3 ? 10 : 20)) { if (kfArr.length - 1 === index) { avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { - this.isUdpEnd = true + this.isUdpEnd = true; + setTimeout(()=>{ closeAllFiles();},1000) router.back(); }) throw new Error('End Loop') @@ -1158,6 +1164,8 @@ export default class Judge { avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`]) } else { avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { + this.isUdpEnd = true; + setTimeout(()=>{ closeAllFiles();},1000) router.back(); }) throw new Error('End Loop') @@ -1171,6 +1179,7 @@ export default class Judge { avPlayer.playAudio([voiceURL], true, () => { setTimeout(() => { this.isUdpEnd = true + setTimeout(()=>{ closeAllFiles();},1000) router.back(); }, param302 == 8 ? 3000 : 0) }) diff --git a/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts b/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts index f390071e..25563c36 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts @@ -23,7 +23,7 @@ export default class FilePhoto{ (async ()=>{ //TODO 309参数 获取拍照摄像头拍照通道 const fileUtil = new FileUtil(context) - const strConfig = await fileUtil.readFile('/mnt/hmdfs/100/account/device_view/local/files/config/config3.txt'); + const strConfig = await fileUtil.readFile('/mnt/hmdfs/100/account/device_view/local/files/duolun/config/config3.txt'); const config = JSON.parse(strConfig) const {userName,ip,pwd,port,rlls,pztd} = config this.params = {userName,pwd,ip,port,rlls,pztd} @@ -39,7 +39,7 @@ export default class FilePhoto{ }else{ try { console.info('surenjun','拍照开始') - const res = await takePhoto(params, this.context, null,2); + const res = await takePhoto(params, this.context, 'pz/',2); console.info('surenjun','拍照结束' + JSON.stringify(res)) return res.base64 } catch (e) {