feat:y优化

This commit is contained in:
surenjun 2025-01-12 19:44:59 +08:00
parent 4f1a4f894c
commit 3714ed2478
6 changed files with 25 additions and 11 deletions

View File

@ -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(',')

View File

@ -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)
}
/*

View File

@ -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',

View File

@ -986,6 +986,7 @@ struct Index {
},
confirmFn: async () => {
if(this.isErrorMsgEnd){
this.judge.closeAllFiles()
router.back()
return
}

View File

@ -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)
})

View File

@ -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) {