fix: 优化一些错误

This commit is contained in:
wangzhongjie 2025-03-31 10:36:57 +08:00
parent d836b58f9a
commit 4319805f45
4 changed files with 618 additions and 582 deletions

View File

@ -10,52 +10,39 @@ import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon';
import { uploadExamMileage } from '../api/judge'; import { uploadExamMileage } from '../api/judge';
import DwztErrorPopup from './compontents/judge/DwztErrorPopup'; import DwztErrorPopup from './compontents/judge/DwztErrorPopup';
import MsgPopup from './compontents/judge/MsgPopup'; import MsgPopup from './compontents/judge/MsgPopup';
import { import {
CARINFO, CARINFO,
CDSBInfo, CDSBInfo,
LANE, LANE,
MAPITEMPOINTITEM, MAPITEMPOINTITEM,
MAPPOINT, MAPPOINT,
MarkRule, MarkRule,
Project, Project, SYSTEMPARMARR
ProjectObj,
SYSTEMPARMARR
} from './judgeSDK/api/judgeSDK.d'; } from './judgeSDK/api/judgeSDK.d';
import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import SignDisplayCom from './compontents/signDisplayCom'; import SignDisplayCom from './compontents/signDisplayCom';
import { import {
CarInfoType, AmplifyItem,
CommonType, CarInfoType,
ES_CARINFOType, CDSBInfos, DefaultJudgeConfigObj,
KfdmType, ES_CARINFOType,
MA_CDSBINFOType, ItemInfos,
MA_ITEMINFOType, JudgeBeginObj,
MA_MAP_POINT_ITEMType, JudgeCallBacData,
MA_MAP_POINTType, JudgeInitObj,
MA_MARKRULEType, JudgeUI, MA_CDSBINFOType,
MA_SYSTEMPARMType, MA_ITEMINFOType,
MASYSSETTableType, MA_MAP_POINT_ITEMType,
RouteParamsType, MA_MAP_POINTType, MA_SYSTEMPARMType,
User, MarkRules,
SYSSET, MASYSSETTableType, ProjectInfo,
SyssetConfig, ProjectInfos,
ProjectInfo, ProjectRoads,
ProjectInfos, RouteParamsType,
ProjectCenterInfos, SYSSET,
JudgeInitObj, SyssetConfig, User
JudgeBeginObj,
UploadExamMileage,
AmplifyItem,
ProjectRoads,
JudgeCallBacData,
JudgeUI,
CDSBInfos,
ItemInfos,
MarkRules,
DefaultJudgeConfigObj
} from '../model'; } from '../model';
import { GetSyncData } from '../utils/table/Operation'; import { GetSyncData } from '../utils/table/Operation';
import dayTs from '../utils/Date'; import dayTs from '../utils/Date';
@ -168,23 +155,23 @@ struct Index {
@State carInfo: CarInfoType = {} @State carInfo: CarInfoType = {}
@State isErrorMsgEnd: boolean = false @State isErrorMsgEnd: boolean = false
@State disConnectErrorOpen: boolean = false @State disConnectErrorOpen: boolean = false
public context = getContext(this) as common.UIAbilityContext; public context = getContext(this) as common.UIAbilityContext;
async aboutToDisappear() { async aboutToDisappear() {
clearInterval(this.mileageTimer) clearInterval(this.mileageTimer)
} }
async aboutToAppear() { async aboutToAppear() {
const time = GetCurrentTime() const time = GetCurrentTime()
this.carInfo = AppStorage.get<CarInfoType>('carInfo') this.carInfo = AppStorage.get<CarInfoType>('carInfo')
this.singlePlay = AppStorage.get<boolean>('singlePlay') this.singlePlay = AppStorage.get<boolean>('singlePlay')
this.startTime = time.split(' ')[1] this.startTime = time.split(' ')[1]
this.startFullTime = GetCurrentTime(1); this.startFullTime = GetCurrentTime(1);
// this.startHourTime = await getCurrentHourTime() // this.startHourTime = await getCurrentHourTime()
this.startTime = dayTs().format("HHmmssSSS") this.startTime = dayTs().format("HHmmssSSS")
this.startExamTime = time this.startExamTime = time
setInterval(async () => { setInterval(async () => {
this.time = GetCurrentTime(); this.time = GetCurrentTime();
this.examTime += 1; this.examTime += 1;
}, 1000); }, 1000);
//初始化数据库表 //初始化数据库表
@ -251,7 +238,6 @@ struct Index {
async initStudent() { async initStudent() {
const students = await GetSyncData<User>('USER') const students = await GetSyncData<User>('USER')
const stuInfo = students[0]; const stuInfo = students[0];
// const { xm, sfzmhm, lsh, kszp, ksdd, kssycs, kslx, ksxl, xldm } = stuInfo;
this.name = stuInfo.xm || '测试考生'; this.name = stuInfo.xm || '测试考生';
this.idCard = stuInfo.sfzmhm || '01234567891010'; this.idCard = stuInfo.sfzmhm || '01234567891010';
this.lsh = this.singlePlay ? '0000000000000' : stuInfo.lsh; this.lsh = this.singlePlay ? '0000000000000' : stuInfo.lsh;
@ -269,7 +255,7 @@ struct Index {
const markRuleParams = markRules || await GetSyncData<MarkRule>('MA_MARKRULE') const markRuleParams = markRules || await GetSyncData<MarkRule>('MA_MARKRULE')
markRuleParams.forEach(mark => { markRuleParams.forEach(mark => {
const tempObj:MarkRule = { const tempObj: MarkRule = {
itemno: mark.itemno * 1, itemno: mark.itemno * 1,
markcatalog: mark.markcatalog, markcatalog: mark.markcatalog,
markshow: decodeURI(mark.markshow), markshow: decodeURI(mark.markshow),
@ -299,9 +285,9 @@ struct Index {
console.info('surenjun serialNumberArr' + JSON.stringify(serialNumberArr)) console.info('surenjun serialNumberArr' + JSON.stringify(serialNumberArr))
this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || ''; this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || '';
// const { isTrajectoryOpen } = judgeConfig // const { isTrajectoryOpen } = judgeConfig
const syssetJudgeConfigArr:SyssetConfig[] = [] const syssetJudgeConfigArr: SyssetConfig[] = []
syssetParams.forEach((sys:SYSSET) => { syssetParams.forEach((sys: SYSSET) => {
if (judgeConfig.isTrajectoryOpen) { if (judgeConfig.isTrajectoryOpen) {
sys.v_no = String(sys.key); sys.v_no = String(sys.key);
sys.v_name = sys.name; sys.v_name = sys.name;
@ -309,7 +295,7 @@ struct Index {
} }
// const { v_no, v_value } = sys; // const { v_no, v_value } = sys;
const v_no_num = Number(sys.v_no) const v_no_num = Number(sys.v_no)
const value = decodeURIComponent(sys.v_value) const value = decodeURIComponent(sys.v_value)
if (v_no_num >= 10 && v_no_num <= 900) { if (v_no_num >= 10 && v_no_num <= 900) {
const name = const name =
@ -342,8 +328,8 @@ struct Index {
currentParams.kfdm.forEach(kf => { currentParams.kfdm.forEach(kf => {
// const { xmdm, kfdm } = kf // const { xmdm, kfdm } = kf
const currentKf: MarkRule = Reflect.get(this.markRuleListObj,`${kf.xmdm}_${kf.kfdm}`) const currentKf: MarkRule = Reflect.get(this.markRuleListObj, `${kf.xmdm}_${kf.kfdm}`)
const currentProject:ProjectInfo = Reflect.get(this.projectsObj,kf.xmdm) const currentProject: ProjectInfo = Reflect.get(this.projectsObj, kf.xmdm)
// 过滤考前绕车一周上车准备的扣分 // 过滤考前绕车一周上车准备的扣分
if (currentParams.sczb == "1" && kf.xmdm == 1) { if (currentParams.sczb == "1" && kf.xmdm == 1) {
@ -353,7 +339,7 @@ struct Index {
this.kfArr.push({ this.kfArr.push({
//扣分项目名称 //扣分项目名称
xmmcStr: currentProject.name, xmmcStr: currentProject.name,
xmdm:kf.xmdm, xmdm: kf.xmdm,
desc: currentKf.markshow, desc: currentKf.markshow,
score: currentKf.markreal, score: currentKf.markreal,
markcatalog: currentKf.markcatalog, markcatalog: currentKf.markcatalog,
@ -362,9 +348,9 @@ struct Index {
}) })
this.totalScore += currentKf.markreal * 1; this.totalScore += currentKf.markreal * 1;
}) })
const project_1 = Reflect.get(this.projectsObj,1) const project_1 = Reflect.get(this.projectsObj, 1)
project_1.type = kfdm.length ? '4' : '3'; project_1.type = kfdm.length ? '4' : '3';
Reflect.set(this.projectsObj,1,project_1) Reflect.set(this.projectsObj, 1, project_1)
} }
Reflect.set(this.judgeConfigObj, sys.v_no, value) Reflect.set(this.judgeConfigObj, sys.v_no, value)
@ -388,7 +374,7 @@ struct Index {
console.info('surenjun kStringArr', JSON.stringify(kStringArr)) console.info('surenjun kStringArr', JSON.stringify(kStringArr))
let isInExam = kStringArr.length > 0; let isInExam = kStringArr.length > 0;
// const { isTrajectoryOpen } = judgeConfig // const { isTrajectoryOpen } = judgeConfig
let carNo = '', allItems:string[] = []; let carNo = '', allItems: string[] = [];
systemParms.forEach((systemParm) => { systemParms.forEach((systemParm) => {
if (judgeConfig.isTrajectoryOpen) { if (judgeConfig.isTrajectoryOpen) {
systemParm.no1 = systemParm.NO1 + ''; systemParm.no1 = systemParm.NO1 + '';
@ -439,7 +425,7 @@ struct Index {
if (sCarTypes.includes(this.carType) && name === '夜间行驶') { if (sCarTypes.includes(this.carType) && name === '夜间行驶') {
return return
} }
const currentProject:ProjectInfo = { const currentProject: ProjectInfo = {
name, name,
abbreviation: decodeURI(systemParm.txt3), abbreviation: decodeURI(systemParm.txt3),
projectCode: no2, projectCode: no2,
@ -495,10 +481,10 @@ struct Index {
cdsbParams.forEach((cdsb) => { cdsbParams.forEach((cdsb) => {
const key = decodeURI(cdsb.itemsno) const key = decodeURI(cdsb.itemsno)
const newKey = key.split('~').join('_') const newKey = key.split('~').join('_')
const xmdm = Number( key.split('~')[0] ) const xmdm = Number(key.split('~')[0])
const currentProject:ProjectInfo = Reflect.get(projectsObj, xmdm) const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
if (currentProject) { if (currentProject) {
const cdsbInfo:CDSBInfo = { const cdsbInfo: CDSBInfo = {
kdid: cdsb.kdid, kdid: cdsb.kdid,
sbbh: cdsb.sbbh, sbbh: cdsb.sbbh,
sbbm: cdsb.sbbm, sbbm: cdsb.sbbm,
@ -522,9 +508,9 @@ struct Index {
const carlistArr = info.carlist === '' ? [] : (decodeURI(info.carlist).split(',') || []); const carlistArr = info.carlist === '' ? [] : (decodeURI(info.carlist).split(',') || []);
const newKey = key.split('~').join('_') const newKey = key.split('~').join('_')
const xmdm = Number(key.split('~')[0]) const xmdm = Number(key.split('~')[0])
const currentProject:ProjectInfo = Reflect.get(projectsObj,xmdm) const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
if (currentProject && (carlistArr.length == 0 || carlistArr.includes(carlist))) { if (currentProject && (carlistArr.length == 0 || carlistArr.includes(carlist))) {
Reflect.set(this.itemInfoObj,newKey, { Reflect.set(this.itemInfoObj, newKey, {
modelKey: newKey, modelKey: newKey,
xmdm, xmdm,
xmxh: key.split('~')[1], xmxh: key.split('~')[1],
@ -535,10 +521,10 @@ struct Index {
// 评判相关初始化 // 评判相关初始化
async initJudge() { async initJudge() {
const JUDGEUI:JudgeUI = this; const JUDGEUI: JudgeUI = this;
const judge = new Judge(JUDGEUI); const judge = new Judge(JUDGEUI);
// await judge.init<typeof Index>() // await judge.init<typeof Index>()
await judge.onJudgeFn(async (judgeData:JudgeCallBacData) => { await judge.onJudgeFn(async (judgeData: JudgeCallBacData) => {
// const { xmmcStr, carztStr, kfArr } = judgeData; // const { xmmcStr, carztStr, kfArr } = judgeData;
this.xmmcStr = judgeData.xmmcStr; this.xmmcStr = judgeData.xmmcStr;
this.carztStr = judgeData.carztStr; this.carztStr = judgeData.carztStr;
@ -551,7 +537,7 @@ struct Index {
async goDdxkItems() { async goDdxkItems() {
const judgeConfigObj = this.judgeConfigObj const judgeConfigObj = this.judgeConfigObj
const config_432:string = Reflect.get(judgeConfigObj,'432') const config_432: string = Reflect.get(judgeConfigObj, '432')
//科目二强制开始断点续考 //科目二强制开始断点续考
if (config_432 != '0' || this.examSubject == "2") { if (config_432 != '0' || this.examSubject == "2") {
//断点续考判断 //断点续考判断
@ -569,9 +555,9 @@ struct Index {
if (ddxkKsxmArr?.length) { if (ddxkKsxmArr?.length) {
//断点续考 //断点续考
ddxkKsxmArr.forEach(xmdm => { ddxkKsxmArr.forEach(xmdm => {
const currentProjectCenter:Project = Reflect.get(this.projectsCenterObj, xmdm) const currentProjectCenter: Project = Reflect.get(this.projectsCenterObj, xmdm)
const projectCode = currentProjectCenter.projectCode const projectCode = currentProjectCenter.projectCode
const currentProject:Project = Reflect.get(this.projectsObj,projectCode) const currentProject: Project = Reflect.get(this.projectsObj, projectCode)
if (currentProject) { if (currentProject) {
currentProject.type = '3' currentProject.type = '3'
currentProject.isUpload = true currentProject.isUpload = true
@ -586,8 +572,8 @@ struct Index {
ddxkKfArr.forEach((kf) => { ddxkKfArr.forEach((kf) => {
const xmdm = kf.split(',')[0] const xmdm = kf.split(',')[0]
const kfdm = kf.split(',')[1] const kfdm = kf.split(',')[1]
const currentKf:MarkRule = Reflect.get(this.markRuleListObj, `${xmdm}_${kfdm}`) const currentKf: MarkRule = Reflect.get(this.markRuleListObj, `${xmdm}_${kfdm}`)
const currentProject:ProjectInfo = Reflect.get(this.projectsObj,xmdm) || { name: '通用评判' } const currentProject: ProjectInfo = Reflect.get(this.projectsObj, xmdm) || { name: '通用评判' }
if (currentProject) { if (currentProject) {
currentProject.type = '4' currentProject.type = '4'
@ -658,11 +644,11 @@ struct Index {
const initData = strArr[0] const initData = strArr[0]
const beginData = strArr[1] const beginData = strArr[1]
const initDataObj:JudgeInitObj = JSON.parse(initData) const initDataObj: JudgeInitObj = JSON.parse(initData)
const beginDataObj:JudgeBeginObj = JSON.parse(beginData) const beginDataObj: JudgeBeginObj = JSON.parse(beginData)
const examSubject = this.carInfo.examSubject; const examSubject = this.carInfo.examSubject;
this.examSubject =( isTrajectoryOpen ? (initDataObj.kskm) : examSubject) +''; this.examSubject = (isTrajectoryOpen ? (initDataObj.kskm) : examSubject) + '';
this.carInfo.examSubject = this.examSubject this.carInfo.examSubject = this.examSubject
this.singlePlay = beginDataObj.exam == 0; this.singlePlay = beginDataObj.exam == 0;
this.carName = initDataObj.name; this.carName = initDataObj.name;
@ -677,11 +663,11 @@ struct Index {
const carInfo = this.carInfo const carInfo = this.carInfo
await uploadExamMileage({ await uploadExamMileage({
carId:carInfo.carId, carId: carInfo.carId,
examinationRoomId:carInfo.examinationRoomId, examinationRoomId: carInfo.examinationRoomId,
lsh:this.lsh, lsh: this.lsh,
kskssj:this.startExamTime, kskssj: this.startExamTime,
kslc:this.jl kslc: this.jl
}) })
} }
} }
@ -744,7 +730,7 @@ struct Index {
if (this.examSubject == "3") { if (this.examSubject == "3") {
Row() { Row() {
if (Reflect.get(this.judgeConfigObj,'375') == '0') { if (Reflect.get(this.judgeConfigObj, '375') == '0') {
Text(`应行驶:${this.examMileage}m`) Text(`应行驶:${this.examMileage}m`)
.fontColor('#E5CCA1') .fontColor('#E5CCA1')
.fontSize(this.FONTSIZE) .fontSize(this.FONTSIZE)
@ -761,7 +747,7 @@ struct Index {
Column() { Column() {
Row() { Row() {
Text(this.carztStr).fontColor('#FFA500').fontSize(this.FONTSIZE) Text(this.carztStr).fontColor('#FFA500').fontSize(this.FONTSIZE)
if (Reflect.get(this.judgeConfigObj,'342') == '0') { if (Reflect.get(this.judgeConfigObj, '342') == '0') {
Text(`${this.dw}挡`).fontColor('#FFA500').fontSize(this.FONTSIZE).padding({ left: 15, right: 15 }) Text(`${this.dw}挡`).fontColor('#FFA500').fontSize(this.FONTSIZE).padding({ left: 15, right: 15 })
Text(`${this.sd}km/h`).fontColor('#FFA500').fontSize(this.FONTSIZE) Text(`${this.sd}km/h`).fontColor('#FFA500').fontSize(this.FONTSIZE)
} }
@ -771,7 +757,7 @@ struct Index {
Flex({ direction: FlexDirection.Column }) { Flex({ direction: FlexDirection.Column }) {
if (this.kfArr.length) { if (this.kfArr.length) {
List({ scroller: this.kfArrScroller }) { List({ scroller: this.kfArrScroller }) {
ForEach(this.kfArr, (item:MarkRule) => { ForEach(this.kfArr, (item: MarkRule) => {
ListItem() { ListItem() {
Column() { Column() {
Row() { Row() {
@ -840,7 +826,7 @@ struct Index {
if (this.examSubject == "2") { if (this.examSubject == "2") {
Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
List({}) { List({}) {
ForEach(chunkArr(this.projects, 2), (item:[ProjectInfo,ProjectInfo]) => { ForEach(chunkArr(this.projects, 2), (item: [ProjectInfo, ProjectInfo]) => {
ListItem() { ListItem() {
Row() { Row() {
Row() { Row() {
@ -892,7 +878,7 @@ struct Index {
justifyContent: FlexAlign.SpaceBetween justifyContent: FlexAlign.SpaceBetween
}) { }) {
List({}) { List({}) {
ForEach(this.projects, (project:ProjectInfo) => { ForEach(this.projects, (project: ProjectInfo) => {
ListItem() { ListItem() {
Text(project.name) { Text(project.name) {
} }
@ -917,7 +903,7 @@ struct Index {
justifyContent: FlexAlign.SpaceAround justifyContent: FlexAlign.SpaceAround
}) { }) {
List() { List() {
ForEach(this.artSubject3Projects, (item:string, index) => { ForEach(this.artSubject3Projects, (item: string, index) => {
ListItem() { ListItem() {
} }
.backgroundImage( .backgroundImage(
@ -1042,7 +1028,7 @@ struct Index {
// type: 1, // type: 1,
// name: 'button_media.wav' // name: 'button_media.wav'
// }) // })
if (Reflect.get(this.judgeConfigObj,'353') == '0') { if (Reflect.get(this.judgeConfigObj, '353') == '0') {
this.endPopupVisible = true this.endPopupVisible = true
} else { } else {
Prompt.showToast({ Prompt.showToast({
@ -1071,11 +1057,11 @@ struct Index {
//科目三人工扣分弹窗 //科目三人工扣分弹窗
if (this.isDeductedPopShow && this.examSubject == '3' && Reflect.get(this.judgeConfigObj,'342') == '0') { if (this.isDeductedPopShow && this.examSubject == '3' && Reflect.get(this.judgeConfigObj, '342') == '0') {
DeductedPopup({ DeductedPopup({
defaultTabIndex: this.defaultTabIndex, defaultTabIndex: this.defaultTabIndex,
currentItems: Reflect.ownKeys(this.projectsObj).map(projectKey => { currentItems: Reflect.ownKeys(this.projectsObj).map(projectKey => {
const project:ProjectInfo = Reflect.get(this.projectsObj,projectKey) const project: ProjectInfo = Reflect.get(this.projectsObj, projectKey)
return project.type == '2' ? project.projectCode : undefined return project.type == '2' ? project.projectCode : undefined
}).filter(project => project !== undefined), }).filter(project => project !== undefined),
markRules: this.manualMarkRules, markRules: this.manualMarkRules,
@ -1083,7 +1069,7 @@ struct Index {
this.isDeductedPopShow = false; this.isDeductedPopShow = false;
this.defaultTabIndex = 0; this.defaultTabIndex = 0;
}, },
confirmMark: async (itemno:string, serial:string) => { confirmMark: async (itemno: string, serial: string) => {
clearTimeout(this.popTimer) clearTimeout(this.popTimer)
this.popTimer = null this.popTimer = null
this.popTimer = setTimeout(async () => { this.popTimer = setTimeout(async () => {
@ -1126,7 +1112,7 @@ struct Index {
if (this.isAmplifyPopShow && this.examSubject == '3') { if (this.isAmplifyPopShow && this.examSubject == '3') {
AmplifyPopup({ AmplifyPopup({
amplifyImgIndex: this.amplifiedImgIndex, amplifyImgIndex: this.amplifiedImgIndex,
confirmAmplify: async (amplify:AmplifyItem) => { confirmAmplify: async (amplify: AmplifyItem) => {
clearTimeout(this.popTimer) clearTimeout(this.popTimer)
this.popTimer = null this.popTimer = null
this.popTimer = setTimeout(async () => { this.popTimer = setTimeout(async () => {
@ -1155,7 +1141,7 @@ struct Index {
router.back() router.back()
return return
} }
if (Reflect.get(this.judgeConfigObj,'344') == 1) { if (Reflect.get(this.judgeConfigObj, '344') == 1) {
Prompt.showToast({ Prompt.showToast({
message: '考试未结束,不允许手动退出!', message: '考试未结束,不允许手动退出!',
duration: 4000 duration: 4000
@ -1221,7 +1207,7 @@ struct Index {
} }
getProjectColor(project: ProjectInfo) { getProjectColor(project: ProjectInfo) {
const type = project.type; const type = project.type;
switch (type) { switch (type) {
case '1': case '1':
return '#E6DECF'; return '#E6DECF';
@ -1250,16 +1236,16 @@ struct Index {
const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr; const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr;
const projectsObj = this.projectsObj; const projectsObj = this.projectsObj;
const projectCode = Reflect.get(artSubject3ProjectsCodesArr,index) const projectCode = Reflect.get(artSubject3ProjectsCodesArr, index)
if (index === 5) { if (index === 5) {
console.info('surenjun 靠边停车状态=> ', getIsExitManualProject(index)) console.info('surenjun 靠边停车状态=> ', getIsExitManualProject(index))
} }
const currentProject:ProjectInfo = Reflect.get(projectsObj,projectCode) const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode)
if (getIsExitManualProject(index)) { if (getIsExitManualProject(index)) {
// 正在进行的项目 取消项目 // 正在进行的项目 取消项目
if (isManualProjectIn && currentProject.type == '2') { if (isManualProjectIn && currentProject.type == '2') {
//判断人工是否能取消项目 && 当前项目有扣分的不能取消 //判断人工是否能取消项目 && 当前项目有扣分的不能取消
if (Reflect.get(this.judgeConfigObj,'340') == 1) { if (Reflect.get(this.judgeConfigObj, '340') == 1) {
await this.judge.setJudgeItem(projectCode, 2); await this.judge.setJudgeItem(projectCode, 2);
Prompt.showToast({ Prompt.showToast({
message: '项目取消', message: '项目取消',
@ -1270,11 +1256,11 @@ struct Index {
} }
// 靠边停车时候可以触发 // 靠边停车时候可以触发
if (Reflect.get(this.judgeConfigObj,'343') === '0') { if (Reflect.get(this.judgeConfigObj, '343') === '0') {
const xmmcStr = this.xmmcStr; const xmmcStr = this.xmmcStr;
if (xmmcStr == '无' || xmmcStr == '') { if (xmmcStr == '无' || xmmcStr == '') {
//512[6] 人工项目按钮放大确认 //512[6] 人工项目按钮放大确认
const param512:string[] = (Reflect.get(this.judgeConfigObj,'512') || '').split(','); const param512: string[] = (Reflect.get(this.judgeConfigObj, '512') || '').split(',');
console.info('surenjun', param512) console.info('surenjun', param512)
if (param512[6] !== '0') { if (param512[6] !== '0') {
this.amplifiedImgIndex = index; this.amplifiedImgIndex = index;
@ -1310,24 +1296,24 @@ struct Index {
const getProjectIsInRoad = this.getProjectIsInRoad; const getProjectIsInRoad = this.getProjectIsInRoad;
const projectCode = artSubject3ProjectsCodesArr[index]; const projectCode = artSubject3ProjectsCodesArr[index];
const currentProject:ProjectInfo = Reflect.get(projectsObj,projectCode) const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode)
if (currentProject === undefined) { if (currentProject === undefined) {
return false return false
} }
const projectType = currentProject.type; const projectType = currentProject.type;
//不允许人工触发的项目列表,以","分隔 //不允许人工触发的项目列表,以","分隔
const unExitManualProjects:string[] = Reflect.get(this.judgeConfigObj,'332').split(',') || []; const unExitManualProjects: string[] = Reflect.get(this.judgeConfigObj, '332').split(',') || [];
//直线行驶中不进其他考试项目(0-否 1-是) //直线行驶中不进其他考试项目(0-否 1-是)
const param348:string = Reflect.get(this.judgeConfigObj,'348') || '0', const param348: string = Reflect.get(this.judgeConfigObj, '348') || '0',
//里程不够允许手工点靠边停车0-否 1-是) //里程不够允许手工点靠边停车0-否 1-是)
param387:string = Reflect.get(this.judgeConfigObj,'387') || '0', param387: string = Reflect.get(this.judgeConfigObj, '387') || '0',
//里程不够不报靠边停车0-否+1-是+2-必考项目未完成且里程不够不报项目) //里程不够不报靠边停车0-否+1-是+2-必考项目未完成且里程不够不报项目)
param319:string = Reflect.get(this.judgeConfigObj,'319') || '0', param319: string = Reflect.get(this.judgeConfigObj, '319') || '0',
//人工项目是否能取消 1:可取消; //人工项目是否能取消 1:可取消;
param340:string = Reflect.get(this.judgeConfigObj,'340') || '0', param340: string = Reflect.get(this.judgeConfigObj, '340') || '0',
//307参数里设置的项目项目已经做过后续不能人工触发 //307参数里设置的项目项目已经做过后续不能人工触发
param307:string[] = (Reflect.get(this.judgeConfigObj,'307') || '').split(','); param307: string[] = (Reflect.get(this.judgeConfigObj, '307') || '').split(',');
//非行驶状态(没有速度),人工项目不能触发(按钮灰色) //非行驶状态(没有速度),人工项目不能触发(按钮灰色)
if (carztStr === '停车') { if (carztStr === '停车') {
@ -1335,7 +1321,7 @@ struct Index {
} }
//车上是否能进行人工操作(0-能1-不能人工评判2-不能人工进项目3-都不能) //车上是否能进行人工操作(0-能1-不能人工评判2-不能人工进项目3-都不能)
if (Reflect.get(this.judgeConfigObj,'342') === '3' || Reflect.get(this.judgeConfigObj,'342') === '2') { if (Reflect.get(this.judgeConfigObj, '342') === '3' || Reflect.get(this.judgeConfigObj, '342') === '2') {
return false return false
} }
@ -1361,7 +1347,7 @@ struct Index {
return false return false
} }
const project_9:ProjectInfo = Reflect.get(projectsObj,'9') const project_9: ProjectInfo = Reflect.get(projectsObj, '9')
// 直线行驶中不进其他考试项目(0-否 1-是) // 直线行驶中不进其他考试项目(0-否 1-是)
if (param348 == '0' && project_9.type == '2') { if (param348 == '0' && project_9.type == '2') {
return index === 0 ? true : false return index === 0 ? true : false
@ -1390,14 +1376,14 @@ struct Index {
const num = lane.num; const num = lane.num;
const count = lane.count; const count = lane.count;
const param_3:string[] = (Reflect.get(this.judgeConfigObj,'514')?.split(',') || []); const param_3: string[] = (Reflect.get(this.judgeConfigObj, '514')?.split(',') || []);
const param_4:string[] = (Reflect.get(this.judgeConfigObj,'515')?.split(',') || []); const param_4: string[] = (Reflect.get(this.judgeConfigObj, '515')?.split(',') || []);
const param_10:string[] = (Reflect.get(this.judgeConfigObj,'516')?.split(',') || []); const param_10: string[] = (Reflect.get(this.judgeConfigObj, '516')?.split(',') || []);
const param_11:string[] = (Reflect.get(this.judgeConfigObj,'517')?.split(',') || []); const param_11: string[] = (Reflect.get(this.judgeConfigObj, '517')?.split(',') || []);
const param_9:string[] = (Reflect.get(this.judgeConfigObj,'518')?.split(',') || []); const param_9: string[] = (Reflect.get(this.judgeConfigObj, '518')?.split(',') || []);
const param_12:string[] = (Reflect.get(this.judgeConfigObj,'519')?.split(',') || []); const param_12: string[] = (Reflect.get(this.judgeConfigObj, '519')?.split(',') || []);
const projectRoads:ProjectRoads = { const projectRoads: ProjectRoads = {
//直线行驶 //直线行驶
param_3, param_3,
//变更车道 //变更车道
@ -1417,7 +1403,7 @@ struct Index {
if (road === '') { if (road === '') {
return false return false
} }
const currentProjectRoad:string[] = Reflect.get(projectRoads,`param_${projectCode}`) const currentProjectRoad: string[] = Reflect.get(projectRoads, `param_${projectCode}`)
if (currentProjectRoad.length == 0) { if (currentProjectRoad.length == 0) {
return true return true
} }
@ -1425,7 +1411,7 @@ struct Index {
//设置了514-519参数只能在设置的路段触发对应项目 //设置了514-519参数只能在设置的路段触发对应项目
if (currentProjectRoad.includes(road)) { if (currentProjectRoad.includes(road)) {
//如果525为1则514-519设置的路段不能触发对应项目 //如果525为1则514-519设置的路段不能触发对应项目
if (Reflect.get(this.judgeConfigObj,'525') == '1') { if (Reflect.get(this.judgeConfigObj, '525') == '1') {
return false return false
} }
} else { } else {
@ -1434,7 +1420,7 @@ struct Index {
//405参数为2是如果在最左侧车道超车项目不能触发; //405参数为2是如果在最左侧车道超车项目不能触发;
if (projectCode == '10' && if (projectCode == '10' &&
Reflect.get(this.judgeConfigObj,'405') == '2' && Reflect.get(this.judgeConfigObj, '405') == '2' &&
(num === count) && (num === count) &&
num > 0 num > 0
) { ) {
@ -1454,7 +1440,7 @@ struct Index {
getIsEndManualProject = (index: number) => { getIsEndManualProject = (index: number) => {
const projectName = this.artSubject3Projects[index]; const projectName = this.artSubject3Projects[index];
const projectCode = this.artSubject3ProjectsCodesArr[index]; const projectCode = this.artSubject3ProjectsCodesArr[index];
const currentProject:ProjectInfo = Reflect.get(this.projectsObj,projectCode) const currentProject: ProjectInfo = Reflect.get(this.projectsObj, projectCode)
const type = currentProject.type const type = currentProject.type
if (type == '2') { if (type == '2') {
return projectName return projectName
@ -1465,10 +1451,10 @@ struct Index {
getIsManualKf = () => { getIsManualKf = () => {
if (this.examSubject == '3') { if (this.examSubject == '3') {
//杭州训练模式不允许人工评判 //杭州训练模式不允许人工评判
if (this.singlePlay && Reflect.get(this.judgeConfigObj,'211') == 'zjhz') { if (this.singlePlay && Reflect.get(this.judgeConfigObj, '211') == 'zjhz') {
return false return false
} }
if (Reflect.get(this.judgeConfigObj,'342') == '0') { if (Reflect.get(this.judgeConfigObj, '342') == '0') {
return true return true
} }
} else { } else {

View File

@ -1,4 +1,5 @@
import libJudgeSdk from "libjudgesdk.so" import libJudgeSdk from 'libjudgesdk.so';
import { JudgeInitObj } from '../../../model';
// import libJudgeSdk from '@ohos.judgesdk' // import libJudgeSdk from '@ohos.judgesdk'
/** /**
@ -24,8 +25,8 @@ export async function examJudgeVersion(): Promise<string> {
* @params callBack 日志操作回调 * @params callBack 日志操作回调
* @desc 设置评判日志级别和日志回调函数 * @desc 设置评判日志级别和日志回调函数
*/ */
export async function examJudgeSetLogCallback(level: number, handleLog: Function): Promise<string> { export async function examJudgeSetLogCallback(level: number, handleLog: Function): Promise<number> {
const temp:number = libJudgeSdk.examJudgeSetLogCallback(level, handleLog); const temp: number = libJudgeSdk.examJudgeSetLogCallback(level, handleLog);
return await handle(temp, 'examJudgeSetLogCallback') return await handle(temp, 'examJudgeSetLogCallback')
} }
@ -33,9 +34,9 @@ export async function examJudgeSetLogCallback(level: number, handleLog: Function
* *
* @desc评判初始化 * @desc评判初始化
*/ */
export async function examJudgeInit(data) { export async function examJudgeInit(data: JudgeInitObj) {
const str = JSON.stringify(data); const str = JSON.stringify(data);
const temp:number = libJudgeSdk.examJudgeInit(str, str.length); const temp: number = libJudgeSdk.examJudgeInit(str, str.length);
return await handle(temp, 'examJudgeInit') return await handle(temp, 'examJudgeInit')
} }
@ -44,7 +45,7 @@ export async function examJudgeInit(data) {
* @desc 执行实时考试过程 实时传递传感信息 * @desc 执行实时考试过程 实时传递传感信息
*/ */
export async function examJudgeRealExam(data) { export async function examJudgeRealExam(data) {
const temp:number = libJudgeSdk.examJudgeRealExam(JSON.stringify(data), str.length); const temp: number = libJudgeSdk.examJudgeRealExam(JSON.stringify(data), str.length);
return await handle(temp, 'examJudgeRealExam') return await handle(temp, 'examJudgeRealExam')
} }
@ -53,8 +54,8 @@ export async function examJudgeRealExam(data) {
* @desc 设置评判输出的考试过程数据回调函数 * @desc 设置评判输出的考试过程数据回调函数
*/ */
//js_examJudgeSetRealExamCallback //js_examJudgeSetRealExamCallback
export async function examJudgeSetRealExamCallback(fn:Function) { export async function examJudgeSetRealExamCallback(fn: Function) {
const temp:number = libJudgeSdk.examJudgeSetRealExamCallback(fn); const temp: number = libJudgeSdk.examJudgeSetRealExamCallback(fn);
return await handle(temp, 'examJudgeSetRealExamCallback') return await handle(temp, 'examJudgeSetRealExamCallback')
} }
@ -62,8 +63,8 @@ export async function examJudgeSetRealExamCallback(fn:Function) {
* *
* @desc 设置轨迹图像回调函数 * @desc 设置轨迹图像回调函数
*/ */
export async function examJudgeMapImageSetCallback(fn:Function) { export async function examJudgeMapImageSetCallback(fn: Function) {
const temp:number = libJudgeSdk.examJudgeMapImageSetCallback(fn); const temp: number = libJudgeSdk.examJudgeMapImageSetCallback(fn);
return await handle(temp, 'examJudgeMapImageSetCallback') return await handle(temp, 'examJudgeMapImageSetCallback')
} }
@ -80,7 +81,7 @@ export async function examJudgeArtificialMark(
//扣分类型number //扣分类型number
type: number type: number
) { ) {
const temp:number= libJudgeSdk.examJudgeArtificialMark(itemno, serial, type); const temp: number = libJudgeSdk.examJudgeArtificialMark(itemno, serial, type);
return await handle(temp, 'examJudgeArtificialMark') return await handle(temp, 'examJudgeArtificialMark')
} }
@ -94,7 +95,7 @@ export async function examJudgeArtificialItem(
//操作类型 //操作类型
type: number = 0 type: number = 0
) { ) {
const temp:number = libJudgeSdk.examJudgeArtificialItem(itemno, type); const temp: number = libJudgeSdk.examJudgeArtificialItem(itemno, type);
return await handle(temp, 'examJudgeArtificialMark') return await handle(temp, 'examJudgeArtificialMark')
} }
@ -103,8 +104,8 @@ export async function examJudgeArtificialItem(
* *
* @desc 设置地图轨迹图像绘制的开关 * @desc 设置地图轨迹图像绘制的开关
*/ */
export async function examJudgeMapSetDrawing(bool:boolean) { export async function examJudgeMapSetDrawing(bool: boolean) {
const temp:number = libJudgeSdk.examJudgeMapSetDrawing(bool); const temp: number = libJudgeSdk.examJudgeMapSetDrawing(bool);
return await handle(temp, 'examJudgeMapSetDrawing') return await handle(temp, 'examJudgeMapSetDrawing')
} }
@ -115,7 +116,7 @@ export async function examJudgeMapSetDrawing(bool:boolean) {
*/ */
export async function examJudgeBeginExam(data) { export async function examJudgeBeginExam(data) {
const str = JSON.stringify(data); const str = JSON.stringify(data);
const temp:number = libJudgeSdk.examJudgeBeginExam(str, str.length); const temp: number = libJudgeSdk.examJudgeBeginExam(str, str.length);
return await handle(temp, 'examJudgeBeginExam') return await handle(temp, 'examJudgeBeginExam')
} }
@ -132,7 +133,7 @@ export async function examJudgeBeginExam(data) {
* *
*/ */
export async function examJudgeEndExam() { export async function examJudgeEndExam() {
const temp:number = libJudgeSdk.examJudgeEndExam(); const temp: number = libJudgeSdk.examJudgeEndExam();
return await handle(temp, 'examJudgeEndExam') return await handle(temp, 'examJudgeEndExam')
} }
@ -141,7 +142,7 @@ export async function examJudgeEndExam() {
* *
*/ */
export async function examJudgeDestroy() { export async function examJudgeDestroy() {
const temp:number = libJudgeSdk.examJudgeDestroy(); const temp: number = libJudgeSdk.examJudgeDestroy();
return await handle(temp, 'examJudgeDestroy') return await handle(temp, 'examJudgeDestroy')
} }
@ -150,7 +151,7 @@ export async function examJudgeDestroy() {
* *
*/ */
export async function examJudgeMapSetParam(width: number, height: number) { export async function examJudgeMapSetParam(width: number, height: number) {
const temp:number = libJudgeSdk.examJudgeMapSetParam(width, height); const temp: number = libJudgeSdk.examJudgeMapSetParam(width, height);
return await handle(temp, 'examJudgeMapSetParam') return await handle(temp, 'examJudgeMapSetParam')
} }
@ -159,7 +160,7 @@ export async function examJudgeMapSetParam(width: number, height: number) {
* *
*/ */
export async function examJudgeMapSetScaling(scaling?: number) { export async function examJudgeMapSetScaling(scaling?: number) {
const temp:number = libJudgeSdk.examJudgeMapSetScaling(scaling || 1); const temp: number = libJudgeSdk.examJudgeMapSetScaling(scaling || 1);
return await handle(temp, 'examJudgeMapSetScaling') return await handle(temp, 'examJudgeMapSetScaling')
} }
@ -168,7 +169,7 @@ export async function examJudgeMapSetScaling(scaling?: number) {
* *
*/ */
export async function examJudgeSetPerformCallback(fn) { export async function examJudgeSetPerformCallback(fn) {
const temp:number = libJudgeSdk.examJudgeSetPerformCallback(fn); const temp: number = libJudgeSdk.examJudgeSetPerformCallback(fn);
return await handle(temp, 'examJudgeSetPerformCallback') return await handle(temp, 'examJudgeSetPerformCallback')
} }
@ -177,16 +178,19 @@ export async function examJudgeSetPerformCallback(fn) {
* @desc 语音播报结束 * @desc 语音播报结束
* / * /
*/ */
interface SoundParam{ interface SoundParam {
//项目代码 //项目代码
xmdm: number, xmdm: number,
//语音码 //语音码
code: string, code: string,
//语音类型 //语音类型
type: 0|1, type: 0 | 1,
} }
export async function examJudgeSoundEnd(param: SoundParam) { export async function examJudgeSoundEnd(param: SoundParam) {
const temp:number = libJudgeSdk.examJudgeSoundEnd(param.xmdm, param.code, param.type); const temp: number = libJudgeSdk.examJudgeSoundEnd(param.xmdm, param.code, param.type);
return await handle(temp, 'examJudgeSoundEnd') return await handle(temp, 'examJudgeSoundEnd')
} }
@ -195,15 +199,16 @@ export async function examJudgeSoundEnd(param: SoundParam) {
* @desc 实时距离计算 * @desc 实时距离计算
* *
* */ * */
interface DistanceParam{ interface DistanceParam {
jd1: number, jd1: number,
wd1: number, wd1: number,
jd2: number, jd2: number,
wd2: number, wd2: number,
h: number h: number
} }
export async function examCalcGpsDistance(param:DistanceParam):Promise<number> {
const temp:number = libJudgeSdk.examCalcGpsDistance(param.jd1, param.wd1, param.jd2, param.wd2, param.h); export async function examCalcGpsDistance(param: DistanceParam): Promise<number> {
const temp: number = libJudgeSdk.examCalcGpsDistance(param.jd1, param.wd1, param.jd2, param.wd2, param.h);
return temp return temp
} }
@ -212,7 +217,7 @@ export async function examCalcGpsDistance(param:DistanceParam):Promise<number> {
* @desc通用处理函数 * @desc通用处理函数
* *
*/ */
async function handle(temp:number, fnName:string): Promise<string> { async function handle(temp: number, fnName: string): Promise<number> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (temp == 0) { if (temp == 0) {
resolve(temp); resolve(temp);

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,12 @@
import media from '@ohos.multimedia.media'; import media from '@ohos.multimedia.media';
import Prompt from '@system.prompt'; import Prompt from '@system.prompt';
import url from '@ohos.url';
import fileuri from "@ohos.file.fileuri";
import mediaLibrary from '@ohos.multimedia.mediaLibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { BusinessError } from '@ohos.base';
const TAG = 'VoiceAnnounce' const TAG = 'VoiceAnnounce'
interface Queue{ interface Queue {
url: string, url: string,
callback?: Function callback?: Function
} }
@ -32,13 +31,14 @@ export default class VoiceAnnounce {
const queue = this.queue; const queue = this.queue;
const tempUrls: Queue[] = urls.map((url, index) => { const tempUrls: Queue[] = urls.map((url, index) => {
const callback:Function|undefined = (index === urls.length - 1) ? callbackFn : undefined const callback: Function | undefined = (index === urls.length - 1) ? callbackFn : undefined
const temp:Queue = {url, callback} const temp: Queue = {
url, callback
}
return temp return temp
}); });
if (shit) { if (shit) {
//队列清空,重新初始化 //队列清空,重新初始化
this.isStopped = true; this.isStopped = true;
@ -92,7 +92,7 @@ class AVPlayer {
} }
// 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例 // 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
async play(name:string, callback:Function):Promise<boolean> { async play(name: string, callback: Function): Promise<boolean> {
try { try {
//检查SD中的语音 //检查SD中的语音
// console.info('surenjun name',name) // console.info('surenjun name',name)
@ -144,7 +144,7 @@ class AVPlayer {
} }
} }
async queryFile(displayName:string): Promise<mediaLibrary.FileAsset> { async queryFile(displayName: string): Promise<mediaLibrary.FileAsset> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const context = AppStorage.get<common.UIAbilityContext>('context') const context = AppStorage.get<common.UIAbilityContext>('context')
const mediaLib = mediaLibrary.getMediaLibrary(context); const mediaLib = mediaLibrary.getMediaLibrary(context);
@ -174,8 +174,9 @@ class AVPlayer {
} }
// 注册avplayer回调函数 // 注册avplayer回调函数
setAVPlayerCallback(callBack:Function) { setAVPlayerCallback(callBack: Function) {
this.avPlayer.on('error', (err) => { this.avPlayer.on('error', (err: BusinessError) => {
console.log(TAG, '播放器错误', JSON.stringify(err))
this.avPlayer && this.avPlayer.stop() this.avPlayer && this.avPlayer.stop()
this.avPlayer && this.avPlayer.reset() this.avPlayer && this.avPlayer.reset()
this.avPlayer && this.avPlayer.release() this.avPlayer && this.avPlayer.release()