feat:评判修改

This commit is contained in:
surenjun 2024-08-28 16:39:18 +08:00
parent c3eecd2b1a
commit 9082c5169c
7 changed files with 58 additions and 46 deletions

View File

@ -92,13 +92,13 @@ export class voiceService {
}
// 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
avPlayerFdSrc(name) {
globalThis.context.resourceManager.getRawFd(name, (error, value) => {
globalThis.context.resourceManager.getRawFd(name,async (error, value) => {
if (error != null) {
console.log(`jiangsong callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
} else {
console.log('jiangsongjiangsong',this.avPlayer)
if (this.avPlayer) {
await this.avPlayer.reset()
this.avPlayer.fdSrc = value;
}

View File

@ -42,7 +42,7 @@ export default class GetDistance {
const content = await fileUtil.readFile(`${folderPath}/${date}.txt`) || '';
const contentArr = content.split('\n').filter(item => item)
console.info('surenjun contentArr',JSON.stringify(contentArr))
this.totalDistance += str * 1
this.totalDistance += (str * 1 > 200 ? 200 : str*1)
this.totalTime += 1;
contentArr[contentArr.length - 1] = `程序启动时间:${timeStr} 累计行驶距离:${(this.totalDistance).toFixed(2)}m 累计运行时常:${Math.ceil(this.totalTime/60)}min`+ '\n'
console.info('surenjun',contentArr.join('\n'))

View File

@ -62,6 +62,7 @@ export default async function request(req: any) {
//处理中心服务code
if(res.Envelope){
const msgXml = res.Envelope.Body.writeObjectOutResponse.return;
//Envelope.Body.writeObjectOutResponse.return
const dd = handleCenterCode(msgXml,isNewCenter);
return dd
}
@ -165,12 +166,14 @@ function handleCenterCode(msgXml,isNewCenter){
}
//正则匹配code message字段
const [code,message] = [/<code>(.*)<\/code>/i,/<message>(.*)<\/message>/i].map(pattern=>{
const [code,message,keystr] = [/<code>(.*)<\/code>/i,/<message>(.*)<\/message>/i,/<keystr>(.*)<\/keystr>/i].map(pattern=>{
const patternArr = pattern.exec(msgXml);
return patternArr[1]
});
if(code === ''){
console.info('surenjun =>request-prev',keystr)
if(code != '1'){
prompt.showToast({
message: decodeURIComponent(message as string),
duration: 3000
@ -180,7 +183,8 @@ function handleCenterCode(msgXml,isNewCenter){
// globalThis.errorDialog.open()
return {code,message:decodeURIComponent(message)}
}else{
return { code }
console.info('surenjun =>request',keystr)
return { code ,keystr, message }
}
}

View File

@ -30,10 +30,10 @@ export default class EntryAbility extends UIAbility {
globalThis.hasAuth = false
// globalThis.version = '2022.08.13.01'//洛阳
// globalThis.judgeVersion = '2022.12.05.1'
globalThis.judgeVersion = '2022.12.05.1'
globalThis.version = '2022.08.13.01'
// globalThis.version = '2024.11.22.14'//济南
// globalThis.judgeVersion = '2024.11.22.14'
// globalThis.judgeVersion = '2022.12.05.1'
// globalThis.version = '2022.08.13.01'
globalThis.version = '2024.11.22.14'//济南
globalThis.judgeVersion = '2024.11.22.14'
globalThis.videoVersion= '1.0'
// globalThis.version = '2023.12.13.01'
// globalThis.judgeVersion = '2023.09.30.1'

View File

@ -295,6 +295,7 @@ struct Index {
this.projectsCenterObj[txt2] = currentProject
this.projects.push(currentProject);
console.info('surenjun txt2=>',txt2)
//真实监管下发考试项目
if(isInExam && !kStringArr.includes(txt2)){
this.projectsObj[no2*1].type = '3'

View File

@ -650,6 +650,7 @@ struct UserInfo {
message,
duration: 4000
})
avPlayer.playAudio(['voice/监管审核未通过.mp3']);
return
}
this.currentUser.id = '0'

View File

@ -179,24 +179,15 @@ export default class Judge {
handDistance();
}
})
//TODO 监听远程扣分
}
//实时计算gps经纬度距离
handDistance= async ()=>{
const {jd,wd,hxj,dwzt} = this.tempData.gps;
const tJD = convertGpsCoord2(jd)
const tWD = convertGpsCoord2(wd)
const {prevJd,prevWd} = this
console.info('surenjun =>prevJd',prevJd)
console.info('surenjun =>dwzt',dwzt)
if(prevJd && dwzt == 4){
console.info('surenjun =>tJD',tJD)
console.info('surenjun =>tWD',tWD)
console.info('surenjun =>prevJd',prevJd)
console.info('surenjun =>preWd',prevWd)
console.info('surenjun =>hxj',hxj)
const distance = await examCalcGpsDistance({
jd1:prevJd,
wd1:prevWd,
@ -204,7 +195,6 @@ export default class Judge {
wd2:tWD,
h:hxj || 1,
})
console.info('surenjun =>distance',distance)
//@ts-ignore
globalThis.distanceClass.setTimeData(((distance / 100).toFixed(2)) * 1)
}
@ -802,18 +792,9 @@ export default class Judge {
//及格分
let passingGrade = passingScore
if (isManual) {
if (isAllProjectsEnd) {
// 考试合格
if (totalScore >= passingGrade) {
// 考试合格
await examJudgeEndExam();
this.isExamEnd = true
}
} else {
// 考试不合格
await examJudgeEndExam()
this.isExamEnd = true
}
// 考试不合格
await examJudgeEndExam()
this.isExamEnd = true
this.isManual = true
} else {
const param302 = judgeConfigObj['302'];
@ -824,17 +805,30 @@ export default class Judge {
if (singlePlay) {
console.info(judgeTag + ' isAllProjectsEnd => ',isAllProjectsEnd)
if (isAllProjectsEnd) {
if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) {
if(param512[7] != 0){
avPlayer.playAudio(['voice/综合评判.mp3'])
this.judgeUI.isDeductedPopShow = true
this.judgeUI.defaultTabIndex = 1
this.isEndTip = true
}
} else {
await examJudgeEndExam()
this.isExamEnd = true
}
//成绩合格
if(totalScore >= passingGrade && !isEndTip) {
if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) {
if(param512[7] != 0){
avPlayer.playAudio(['voice/综合评判.mp3'])
this.judgeUI.isDeductedPopShow = true
this.judgeUI.defaultTabIndex = 1
this.isEndTip = true
return
}
} else {
await examJudgeEndExam()
this.isExamEnd = true
return
}
}else{
if(examSubject == 3 && param302 == 4){
await examJudgeEndExam()
this.isExamEnd = true
return
}
}
await examJudgeEndExam()
this.isExamEnd = true
}
} else {
//成绩不合格
@ -850,6 +844,11 @@ export default class Judge {
}
//成绩合格
if (isAllProjectsEnd && totalScore >= passingGrade && !isEndTip) {
if(examSubject == 2){
await examJudgeEndExam()
this.isExamEnd = true
return
}
//考试合格自动退出
if(examSubject == 3 && param302 == 4){
await examJudgeEndExam()
@ -955,8 +954,15 @@ export default class Judge {
dwlc: [d1,d2,d3,d4,d5].map((d,index) => `${index+1},${Math.floor(d /100)}`).join(';'),
}
}
const temp = await writeObjectOut(data,filePath);
promptWxCode('17C56', temp.code)
const {code,keystr,message} = await writeObjectOut(data,filePath);
promptWxCode('17C56', code)
if(code != 1){
avPlayer.playAudio(['voice/监管失败.mp3'])
this.isUdpEnd = true
router.back();
return
}
console.info(judgeTag, '考试结束 end')
const param302 = judgeConfigObj['302'];
judgeUI.loadingPopupVisible = true;