fix:优化了部分代码

This commit is contained in:
wangzhongjie 2024-07-02 11:10:33 +08:00
parent b82d3ff6bc
commit 998a1adb0d
14 changed files with 594 additions and 496 deletions

View File

@ -0,0 +1,17 @@
export const AmplifyArr = [
{ name: '直线', projectCode: '3', projectCodeCenter: '40300' },
{ name: '会车', projectCode: '9', projectCodeCenter: '41300' },
{ name: '变道', projectCode: '4', projectCodeCenter: '40500' },
{ name: '超车', projectCode: '10', projectCodeCenter: '41400' },
{ name: '掉头', projectCode: '12', projectCodeCenter: '41500' },
{ name: '停车', projectCode: '11', projectCodeCenter: '40600' },
]
export const AmplifyImages = [
'km_zxB.png',
'km_hcB.png',
'km_bdB.png',
'km_ccB.png',
'km_dtB.png',
'km_tcB.png',
]

View File

@ -0,0 +1,67 @@
export const SignalData = [
{ key: '左方向灯', value: '0' },
{ key: '右方向灯', value: '0' },
{ key: '喇叭', value: '0' },
{ key: '点火1', value: '0' },
{ key: '点火2', value: '0' },
{ key: '近光灯', value: '0' },
{ key: '远光灯', value: '0' },
{ key: '示廓灯', value: '0' },
{ key: '雾灯', value: '0' },
{ key: '雨刮器', value: '0' },
{ key: '脚刹', value: '0' },
{ key: '手刹', value: '0' },
{ key: '主驾驶门', value: '0' },
{ key: '离合', value: '0' },
{ key: '副刹车', value: '0' },
{ key: '安全带', value: '0' },
{ key: '双跳灯', value: '0' },
{ key: '车速', value: '0' },
{ key: '档位', value: '0' },
{ key: '超声波1', value: '0' },
{ key: '超声波2', value: '0' },
{ key: 'NC', value: '0' },
{ key: 'SA15', value: '0' },
{ key: '其他门', value: '0' },
{ key: '转速过高', value: '0' },
{ key: '累计脉冲', value: '0' },
{ key: '熄火次数', value: '0' },
{ key: '发动机转速', value: '0' },
{ key: '方向盘角度', value: '0' },
{ key: '超声波3', value: '0' },
{ key: '超声波4', value: '0' },
{ key: '触摸1', value: '0' },
{ key: '触摸2', value: '0' },
{ key: '触摸3', value: '0' },
{ key: 'SCIO', value: '0' },
{ key: 'SC1A_C', value: '0' },
{ key: 'SC1B_C', value: '0' },
{ key: 'SC2A_C', value: '0' },
{ key: 'SC2B_C', value: '0' },
{ key: 'SC3A_C', value: '0' },
{ key: 'SC3B_C', value: '0' },
{ key: 'SC4A_C', value: '0' },
{ key: 'SC4B_C', value: '0' },
{ key: 'SC5A_C', value: '0' },
{ key: 'SC5B_C', value: '0' },
{ key: 'SC6A_C', value: '0' },
{ key: 'SC6B_C', value: '0' }
]
export const GPSData = [
{ key: '状态', value: '0' },
{ key: '收星数', value: '0' },
{ key: '海拔高', value: '0' },
{ key: '高度差', value: '0' },
{ key: '龄期', value: '0' },
{ key: '维度因子', value: '0' },
{ key: '经度因子', value: '0' },
{ key: '航向角', value: '0' },
{ key: '俯仰角', value: '0' },
{ key: '航向角状态-收星数', value: '0' },
{ key: '年月日', value: '0' },
{ key: '时分秒', value: '0' },
{ key: '经度', value: '0' },
{ key: '纬度', value: '0' },
{ key: '速度', value: '0' },
]

View File

@ -1,3 +1,7 @@
export * from "./CandidateData" export * from "./CandidateData"
export * from "./VideoData" export * from "./VideoData"
export * from "./Judge"
export * from "./SignDisplay"

View File

@ -0,0 +1,4 @@
export type SignalDataType = {
key: string;
value: string;
};

View File

@ -0,0 +1 @@
export * from "./SignDisplay"

View File

@ -1,30 +1,106 @@
import router from '@ohos.router' import router from '@ohos.router';
import Prompt from '@system.prompt'; import Prompt from '@system.prompt';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import EndPoPup from './compontents/judge/end-popup' import EndPoPup from './compontents/judge/EndPopup';
import LoadingPopup from './compontents/judge/loading-popup' import LoadingPopup from './compontents/judge/LoadingPopup';
import DeductedPopup from './compontents/judge/deduction-popup' import DeductedPopup from './compontents/judge/DeductionPopup';
import AmplifyPopup from './compontents/judge/amplify-popup' import AmplifyPopup from './compontents/judge/AmplifyPopup';
import Judge from './judgeSDK/judge' import Judge from './judgeSDK/judge';
import {defaultJudgeConfigObj} from './judgeSDK/utils//judge-common' import { defaultJudgeConfigObj } from './judgeSDK/utils//judge-common';
import { import {
Project, ProjectObj, MarkRule, CDSBInfo, CARINFO,
SYSTEMPARMARR,CARINFO ,MAPPOINT ,MAPITEMPOINTITEM,SYSSET CDSBInfo,
} from './judgeSDK/api/judgeSDK.d' MAPITEMPOINTITEM,
import { getCurrentTime, formatTime, getCurrentHourTime,chunkArr } from '../common/utils/tools' MAPPOINT,
import { examJudgeEndExam } from './judgeSDK/api/index' MarkRule,
import { getSyncData } from '../common/service/initable' Project,
import { judgeConfig } from './judgeSDK/utils/judge-config' ProjectObj,
SYSSET,
SYSTEMPARMARR
} from './judgeSDK/api/judgeSDK.d';
import { chunkArr, formatTime, getCurrentHourTime, getCurrentTime } from '../common/utils/tools';
import { examJudgeEndExam } from './judgeSDK/api/index';
import { getSyncData } from '../common/service/initable';
import { judgeConfig } from './judgeSDK/utils/judge-config';
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import SignDisplayCom from './compontents/signDisplayCom' import SignDisplayCom from './compontents/signDisplayCom';
import {testMarkRules} from './judgeSDK/dataTest/index'
@Entry @Entry
@Component @Component
struct Index { struct Index {
scroller: Scroller = new Scroller() scroller: Scroller = new Scroller()
//页面通用字体大小
@State FONTSIZE: number = 28
@State BIGFONTSIZE: number = 28
//结束考试弹窗
@State endPopupVisible: boolean = false
//等待弹窗(考试及格,考试不及格使用)
@State loadingPopupVisible: boolean = false
//实时轨迹弹窗
@State signDisplayComVisible: boolean = false
@State isDdxk: boolean = false;
@State time: string = ''
//考试用时
@State examTime: number = 0
//开始时间
@State startTime: string = '00:00:00'
@State startFullTime: string = ''
@State startHourTime: string = ''
//科目类型
@State examSubject: 2 | 3 = 3;
@State ddxkTime: number = 0;
@State ddxkKsxmArr: string[] = ['']
@State ddxkKfArr: string[] = ['']
@State xmmcStr: string = ''
@State carztStr: string = ''
@State kfArr: {
xmmcStr?: string,
score: string,
desc: string
}[] = []
@State name: string = ''
@State idCard: string = ''
@State totalScore: number = 100
//模拟考试项目
@State projects: Project[] = []
@State projectsObj: ProjectObj = {}
@State projectsCenterObj: ProjectObj = {}
@State markRuleListObj: MarkRule = {}
@State cdsbInfoObj: CDSBInfo = {}
@State timer: number = 0
@State judgeConfig: { [k: string]: string }[] = []
@State judgeConfigObj: { [k: string]: any } = defaultJudgeConfigObj
//流水号
@State lsh: string = ''
@State kszp: string = ''
@State ksdd: string = ''
@State kssycs: string = ''
@State kslx: string = ''
//监管接口序列号
@State serialNumber: number = 0
@State carType: string = ''
@State carName: string = ''
@State isDeductedPopShow: boolean = false
@State isAmplifyPopShow: boolean = false
@State amplifiedImgIndex: number = 0
@State judge: any = {}
//行驶距离
@State jl: number = 0
//应考里程
@State examMileage: string = '0'
@State artSubject3Projects: string[] = ['直线', '会车', '变道', '超车', '掉头', '停车']
@State artSubject3ProjectsCodesArr: string[] = ['3', '9', '4', '10', '12', '11']
@State manualMarkRules: MarkRule[] = []
//科目三评判初始化数据
@State systemparmArr: SYSTEMPARMARR[] = []
@State mapPointItemArr: MAPITEMPOINTITEM[] = []
@State carinfoArrr: CARINFO[] = []
@State mapPointArr: MAPPOINT[] = []
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private img: ImageBitmap = new ImageBitmap("/resources/base/media/1.png") private img: ImageBitmap = new ImageBitmap("/resources/base/media/1.png")
//已考的考试项目
private wantInfos = []
async aboutToAppear() { async aboutToAppear() {
globalThis.windowClass.setWindowSystemBarEnable(['']) globalThis.windowClass.setWindowSystemBarEnable([''])
@ -75,6 +151,7 @@ struct Index {
await this.initMapPointItem() await this.initMapPointItem()
} }
} }
// 查询考车信息 // 查询考车信息
async initCar() { async initCar() {
const result = await getSyncData('ES_CARINFO') const result = await getSyncData('ES_CARINFO')
@ -239,7 +316,9 @@ struct Index {
const {no1,no2,no3,} = systemParm; const {no1,no2,no3,} = systemParm;
this.systemparmArr.push({ this.systemparmArr.push({
'NO1':no1*1,'NO2':no2*1,'NO3':no3*1, 'NO1': no1 * 1,
'NO2': no2 * 1,
'NO3': no3 * 1,
'TXT1': decodeURIComponent(systemParm.txt1), 'TXT1': decodeURIComponent(systemParm.txt1),
'TXT2': decodeURIComponent(systemParm.txt2), 'TXT2': decodeURIComponent(systemParm.txt2),
'TXT3': decodeURIComponent(systemParm.txt3), 'TXT3': decodeURIComponent(systemParm.txt3),
@ -355,7 +434,19 @@ struct Index {
const pointParams = await getSyncData('MA_MAP_POINT') const pointParams = await getSyncData('MA_MAP_POINT')
//@ts-ignore //@ts-ignore
pointParams.forEach(point => { pointParams.forEach(point => {
const {point_no,gps_e,gps_n,point_no_f,point_type,road_code,gps_e_Location,gps_n_Location,f_gps_e,f_gps_n,passed} = point; const {
point_no,
gps_e,
gps_n,
point_no_f,
point_type,
road_code,
gps_e_Location,
gps_n_Location,
f_gps_e,
f_gps_n,
passed
} = point;
this.mapPointArr.push({ this.mapPointArr.push({
point_no: point_no * 1, point_no: point_no * 1,
gps_e: gps_e * 1, gps_e: gps_e * 1,
@ -409,7 +500,6 @@ struct Index {
await this.initSysset(initDataObj.sysset); await this.initSysset(initDataObj.sysset);
} }
build() { build() {
Column() { Column() {
Row() { Row() {
@ -468,7 +558,10 @@ struct Index {
if (this.examSubject == 3) { if (this.examSubject == 3) {
Row() { Row() {
if (this.judgeConfigObj['375'] == '0') { if (this.judgeConfigObj['375'] == '0') {
Text(`应行驶:${this.examMileage}m`).fontColor('#E5CCA1').fontSize(this.FONTSIZE).padding({right:20}) Text(`应行驶:${this.examMileage}m`)
.fontColor('#E5CCA1')
.fontSize(this.FONTSIZE)
.padding({ right: 20 })
} }
Text(`已行驶:${this.jl}m`).fontColor('#FFAD33').fontSize(this.FONTSIZE) Text(`已行驶:${this.jl}m`).fontColor('#FFAD33').fontSize(this.FONTSIZE)
} }
@ -482,6 +575,7 @@ struct Index {
Row() { Row() {
Text(this.carztStr).fontColor('#FFA500').fontSize(this.FONTSIZE) Text(this.carztStr).fontColor('#FFA500').fontSize(this.FONTSIZE)
}.height(40) }.height(40)
Row() { Row() {
Flex({ direction: FlexDirection.Column }) { Flex({ direction: FlexDirection.Column }) {
@ -538,51 +632,93 @@ struct Index {
Row() { Row() {
//#FF7566 #00FFD5 #E6DECF //#FF7566 #00FFD5 #E6DECF
// Text(this.projectsObj[item[0].projectCode]) // Text(this.projectsObj[item[0].projectCode])
Text(item[0].abbreviation).fontSize(item[0].abbreviation.length > 5?28:32).fontColor(this.getProjectColor(this.projectsObj[item[0].projectCode].type)) Text(item[0].abbreviation)
}.backgroundImage($rawfile('judge/project_item.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('48.5%').height(115).margin({bottom:5}).justifyContent(FlexAlign.Center) .fontSize(item[0].abbreviation.length > 5 ? 28 : 32)
.fontColor(this.getProjectColor(this.projectsObj[item[0].projectCode].type))
}
.backgroundImage($rawfile('judge/project_item.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width('48.5%')
.height(115)
.margin({ bottom: 5 })
.justifyContent(FlexAlign.Center)
if (item[1]) { if (item[1]) {
Row() { Row() {
//#FF7566 #00FFD5 #E6DECF //#FF7566 #00FFD5 #E6DECF
Text(item[1].abbreviation).fontSize(item[1].abbreviation.length > 5?28:32).fontColor(this.getProjectColor(this.projectsObj[item[1].projectCode].type)) Text(item[1].abbreviation)
}.backgroundImage($rawfile('judge/project_item.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('48.5%').height(115).margin({left:5,bottom:5}).justifyContent(FlexAlign.Center) .fontSize(item[1].abbreviation.length > 5 ? 28 : 32)
.fontColor(this.getProjectColor(this.projectsObj[item[1].projectCode].type))
}
.backgroundImage($rawfile('judge/project_item.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width('48.5%')
.height(115)
.margin({ left: 5, bottom: 5 })
.justifyContent(FlexAlign.Center)
} }
} }
} }
}); });
} }
}.backgroundImage($rawfile('judge/project_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width('57%').height('100%').padding(30).margin({right:10}) }
.backgroundImage($rawfile('judge/project_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width('57%')
.height('100%')
.padding(30)
.margin({ right: 10 })
} }
//科目三 //科目三
if (this.examSubject == 3) { if (this.examSubject == 3) {
Column() { Column() {
Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceBetween}){ Flex({
wrap: FlexWrap.Wrap,
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween
}) {
List({}) { List({}) {
ForEach(this.projects, (project) => { ForEach(this.projects, (project) => {
ListItem() { ListItem() {
Text(project.name) { Text(project.name) {
}.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type)).margin({bottom:5}).fontSize(26) }
.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type))
.margin({ bottom: 5 })
.fontSize(26)
}.margin({ bottom: 8 }) }.margin({ bottom: 8 })
}) })
}.lanes(2).margin({ left: 25 }) }.lanes(2).margin({ left: 25 })
}.width('100%').height('50%').backgroundImage($rawfile('judge/project_km3_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).padding(30).margin({right:5}) }
.width('100%')
.height('50%')
.backgroundImage($rawfile('judge/project_km3_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.padding(30)
.margin({ right: 5 })
Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceAround }) { Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceAround }) {
List() { List() {
ForEach(this.artSubject3Projects, (item, index) => { ForEach(this.artSubject3Projects, (item, index) => {
ListItem(){}.backgroundImage( ListItem() {
}
.backgroundImage(
$rawfile( $rawfile(
`judge/km3/${this.getIsExitManualProject(index) ? item : (item + '_gray')}.png` `judge/km3/${this.getIsExitManualProject(index) ? item : (item + '_gray')}.png`
), ImageRepeat.NoRepeat) ), ImageRepeat.NoRepeat)
.backgroundImageSize({width:'100%',height:'100%'}).width(174).height(118).margin({bottom:15}) .backgroundImageSize({ width: '100%', height: '100%' })
.width(174)
.height(118)
.margin({ bottom: 15 })
.onClick(() => { .onClick(() => {
if (this.getIsExitManualProject(index)) { if (this.getIsExitManualProject(index)) {
// 靠边停车时候可以触发 // 靠边停车时候可以触发
if (this.judgeConfigObj['343'] == 0) { if (this.judgeConfigObj['343'] == 0) {
const xmmcStr = this.xmmcStr; const xmmcStr = this.xmmcStr;
if (xmmcStr == '无' || xmmcStr == '') { if (xmmcStr == '无' || xmmcStr == '') {
this.amplifiedImgIndex = index;this.isAmplifyPopShow = true this.amplifiedImgIndex = index;
this.isAmplifyPopShow = true
} else { } else {
if (index === 5) { if (index === 5) {
Prompt.showToast({ Prompt.showToast({
@ -593,14 +729,21 @@ struct Index {
} }
} else { } else {
this.amplifiedImgIndex = index;this.isAmplifyPopShow = true this.amplifiedImgIndex = index;
this.isAmplifyPopShow = true
} }
} }
}) })
}) })
}.lanes(3).margin({ left: 5, top: 18 }) }.lanes(3).margin({ left: 5, top: 18 })
} }
}.backgroundImage($rawfile('judge/project_bg.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(660).height(640).padding(44).margin({right:10}) }
.backgroundImage($rawfile('judge/project_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(660)
.height(640)
.padding(44)
.margin({ right: 10 })
} }
}.margin({ top: 15 }).height('80%').justifyContent(FlexAlign.SpaceBetween) }.margin({ top: 15 }).height('80%').justifyContent(FlexAlign.SpaceBetween)
}.width('100%').height('100%').alignItems(HorizontalAlign.Start).margin({ top: 10 }) }.width('100%').height('100%').alignItems(HorizontalAlign.Start).margin({ top: 10 })
@ -637,9 +780,19 @@ struct Index {
Column() { Column() {
if (this.examSubject == 3) { if (this.examSubject == 3) {
Row() { Row() {
Row(){}.width(60).height(60).backgroundImage($rawfile('judge/manual_judge.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' }) Row() {
}
.width(60)
.height(60)
.backgroundImage($rawfile('judge/manual_judge.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
Text('人工评判').fontColor('#FFF').fontSize(32).padding({ right: 12 }) Text('人工评判').fontColor('#FFF').fontSize(32).padding({ right: 12 })
}.width(334).height(110).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center) }
.width(334)
.height(110)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat) .backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 10 }) .margin({ bottom: 10 })
@ -656,14 +809,25 @@ struct Index {
} }
Row() { Row() {
Row(){}.width(60).height(60).backgroundImage($rawfile('judge/phone.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' }) Row() {
}
.width(60)
.height(60)
.backgroundImage($rawfile('judge/phone.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
Text('呼叫请求').fontColor('#FFF').fontSize(32).padding({ right: 12 }) Text('呼叫请求').fontColor('#FFF').fontSize(32).padding({ right: 12 })
}.width(334).height(110).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center) }
.width(334)
.height(110)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat) .backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 10 }) .margin({ bottom: 10 })
Row() {} Row() {
}
.width(334) .width(334)
.height(100) .height(100)
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat) .backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
@ -724,7 +888,8 @@ struct Index {
msgStr: this.judge.plcStr || '' msgStr: this.judge.plcStr || ''
}).margin({ top: 100 }) }).margin({ top: 100 })
Row() {} Row() {
}
.width(240) .width(240)
.height(240) .height(240)
.position({ x: '81%', y: 80 }) .position({ x: '81%', y: 80 })
@ -744,7 +909,9 @@ struct Index {
return project.type == '2' ? project.projectCode : '' return project.type == '2' ? project.projectCode : ''
}).filter(project => project !== ''), }).filter(project => project !== ''),
markRules: this.manualMarkRules, markRules: this.manualMarkRules,
closePopup:()=>{this.isDeductedPopShow = false}, closePopup: () => {
this.isDeductedPopShow = false
},
confirmMark: async (itemno, serial) => { confirmMark: async (itemno, serial) => {
const judge = this.judge const judge = this.judge
await judge.setJudgeMark(itemno, serial); await judge.setJudgeMark(itemno, serial);
@ -818,82 +985,4 @@ struct Index {
return true return true
} }
//页面通用字体大小
@State FONTSIZE: number = 28
@State BIGFONTSIZE: number = 28
//结束考试弹窗
@State endPopupVisible: boolean = false
//等待弹窗(考试及格,考试不及格使用)
@State loadingPopupVisible: boolean = false
//实时轨迹弹窗
@State signDisplayComVisible: boolean = false
@State isDdxk: boolean = false;
@State time: string = ''
//考试用时
@State examTime: number = 0
//开始时间
@State startTime: string = '00:00:00'
@State startFullTime: string = ''
@State startHourTime: string = ''
//科目类型
@State examSubject: 2 | 3 = 3;
@State ddxkTime: number = 0;
@State ddxkKsxmArr: string[] = ['']
@State ddxkKfArr: string[] = ['']
@State xmmcStr: string = ''
@State carztStr: string = ''
@State kfArr: {
xmmcStr?: string,
score: string,
desc: string
}[] = []
@State name: string = ''
@State idCard: string = ''
@State totalScore: number = 100
//模拟考试项目
@State projects: Project[] = []
@State projectsObj: ProjectObj = {}
@State projectsCenterObj: ProjectObj = {}
@State markRuleListObj: MarkRule = {}
@State cdsbInfoObj: CDSBInfo = {}
@State timer: number = 0
@State judgeConfig: {[k:string]:string}[] = []
@State judgeConfigObj: {[k:string]:any} = defaultJudgeConfigObj
//流水号
@State lsh: string = ''
@State kszp: string = ''
@State ksdd: string = ''
@State kssycs: string = ''
@State kslx: string = ''
//监管接口序列号
@State serialNumber: number = 0
@State carType: string = ''
@State carName: string = ''
@State isDeductedPopShow: boolean = false
@State isAmplifyPopShow: boolean = false
@State amplifiedImgIndex: number = 0
@State judge:any = {}
//行驶距离
@State jl:number =0
//应考里程
@State examMileage:string = '0'
//已考的考试项目
private wantInfos = []
@State artSubject3Projects: string[] = ['直线', '会车', '变道','超车', '掉头', '停车']
@State artSubject3ProjectsCodesArr: string[] = ['3', '9', '4','10', '12', '11']
@State manualMarkRules:MarkRule[] = []
//科目三评判初始化数据
@State systemparmArr:SYSTEMPARMARR[] = []
@State mapPointItemArr:MAPITEMPOINTITEM[] = []
@State carinfoArrr:CARINFO[] = []
@State mapPointArr:MAPPOINT[] = []
} }

View File

@ -1,23 +1,16 @@
//@ts-ignore import { voiceService } from '../../common/service/voiceService';
import { faceCompare } from '../../api/userInfo';
import util from '@ohos.util'; import FileUtil from '../../common/utils/File';
import { VideoConfig } from '../interfaces';
import { voiceService } from '../../common/service/voiceService'
import { faceCompare } from '../../api/userInfo'
import FileUtil from '../../common/utils/File'
import { VideoConfig } from '../interfaces'
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { string2Bytes } from '../../common/utils/tools' import { string2Bytes } from '../../common/utils/tools';
import { takePhoto } from '../../common/service/videoService' import { takePhoto } from '../../common/service/videoService';
import { GlobalConfig } from '../../config/index' import { GlobalConfig } from '../../config/index';
import { VideoConfigData } from '../../mock';
@Component @Component
export default struct FaceCompare { export default struct FaceCompare {
constructor() {
super()
}
@State imageBase64: string = 'data:image/jpeg;base64,' @State imageBase64: string = 'data:image/jpeg;base64,'
@Prop sfzh: string; @Prop sfzh: string;
@Prop lsh: string; @Prop lsh: string;
@ -27,46 +20,26 @@ export default struct FaceCompare {
@Link getqkFlag: boolean; @Link getqkFlag: boolean;
@Link faceCatchImg: string; @Link faceCatchImg: string;
@State imageThumbnail: string = ''; @State imageThumbnail: string = '';
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对需要点击重新打开重新触发
private vocObj = null;
@State callBackFlag: boolean = false; @State callBackFlag: boolean = false;
@State @Watch('clearIntervalFn') showFaceCompareFlag: Boolean = false; @State @Watch('clearIntervalFn') showFaceCompareFlag: Boolean = false;
@State video_url: string = 'rtsp://admin:12345qwe@192.168.5.41:8000/h264/ch2/main/av_stream' @State video_url: string = 'rtsp://admin:12345qwe@192.168.5.41:8000/h264/ch2/main/av_stream'
@State previewUri: Resource = $r('app.media.2_nor') @State previewUri: Resource = $r('app.media.2_nor')
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
@State showControls: boolean = false @State showControls: boolean = false
private controller: VideoController = new VideoController()
@State isAutoPlay: boolean = true @State isAutoPlay: boolean = true
@State signNum: number = 0; @State signNum: number = 0;
@State param: VideoConfig = VideoConfigData
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对需要点击重新打开重新触发
private vocObj = null;
private controller: VideoController = new VideoController()
private fileUtil: FileUtil private fileUtil: FileUtil
private interval: any private interval: any
@State param: VideoConfig = {
spls: '',
videoNum: '1',
faceFlag: false,
pztd: '1',
ljlx: '',
ip: '192.168.7.112',
port: '554',
userName: 'admin',
pwd: '12345qwe',
td1: '1',
td2: '2',
td3: '3',
td4: '4',
videoRecord1: false,
videoRecord2: false,
videoRecord3: false,
videoRecord4: false,
rlls: '1',
spzd4:false,
spzd3:false,
spzd2:false,
spzd1:false,
zdyz:'500',
}
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
constructor() {
super()
}
build() { build() {
Column() { Column() {
Column() { Column() {
@ -239,8 +212,6 @@ export default struct FaceCompare {
console.log('mmmmm8', 9) console.log('mmmmm8', 9)
} }
async heartMsg(context) { async heartMsg(context) {
@ -343,8 +314,6 @@ export default struct FaceCompare {
this.controller.start() this.controller.start()
} }
async aboutToDisappear() { async aboutToDisappear() {
} }

View File

@ -1,93 +1,34 @@
import router from '@ohos.router' import router from '@ohos.router';
import UdpClient from '../../common/utils/UdpClient'; import UdpClient from '../../common/utils/UdpClient';
import FileLog from '../judgeSDK/utils/file-log' import FileLog from '../judgeSDK/utils/file-log';
import { voiceService } from '../../common/service/voiceService' import RealTime from '../compontents/judge/RealTime';
import prompt from '@ohos.prompt' import { GPSData, SignalData } from '../../mock';
import RealTime from '../compontents/judge/real-time' import { SignalDataType } from '../../model';
@Component @Component
export default struct SignDisplayCom { export default struct SignDisplayCom {
constructor() {
super()
}
@State showBack: boolean = false @State showBack: boolean = false
@State scaleNum: number = 1 @State scaleNum: number = 1
@State msg: string = '' @State msg: string = ''
@State signArr: Array<any> = [] @State signArr: Array<any> = []
@State sjxhColum: Array<any> = [ @State sjxhColum: Array<SignalDataType> = SignalData
{ key: '左方向灯', value: '0' }, { key: '右方向灯', value: '0' }, { @State GPSColum: Array<SignalDataType> = GPSData
key: '喇叭',
value: '0'
}, { key: '点火1', value: '0' }, { key: '点火2', value: '0' }, { key: '近光灯', value: '0' }, {
key: '远光灯',
value: '0'
}, { key: '示廓灯', value: '0' }, { key: '雾灯', value: '0' }, { key: '雨刮器', value: '0' }, {
key: '脚刹',
value: '0'
}, { key: '手刹', value: '0' }, { key: '主驾驶门', value: '0' }, { key: '离合', value: '0' }, {
key: '副刹车',
value: '0'
}, {
key: '安全带',
value: '0'
}, { key: '双跳灯', value: '0' }, { key: '车速', value: '0' }, { key: '档位', value: '0' }, {
key: '超声波1',
value: '0'
}, {
key: '超声波2',
value: '0'
}, {
key: 'NC',
value: '0'
}, { key: 'SA15', value: '0' }, { key: '其他门', value: '0' }, { key: '转速过高', value: '0' }, {
key: '累计脉冲',
value: '0'
}, { key: '熄火次数', value: '0' }, { key: '发动机转速', value: '0' }, { key: '方向盘角度', value: '0' }, {
key: '超声波3',
value: '0'
}, { key: '超声波4', value: '0' }, { key: '触摸1', value: '0' }, { key: '触摸2', value: '0' }, {
key: '触摸3',
value: '0'
}, { key: 'SCIO', value: '0' }
, { key: 'SC1A_C', value: '0' }, { key: 'SC1B_C', value: '0' }, { key: 'SC2A_C', value: '0' }, {
key: 'SC2B_C',
value: '0'
}, { key: 'SC3A_C', value: '0' }, { key: 'SC3B_C', value: '0' }, { key: 'SC4A_C', value: '0' }, {
key: 'SC4B_C',
value: '0'
}, { key: 'SC5A_C', value: '0' }, { key: 'SC5B_C', value: '0' }, { key: 'SC6A_C', value: '0' }, {
key: 'SC6B_C',
value: '0'
}]
@State GPSColum:Array<any>=[
{ key: '状态', value: '0' },
{ key: '收星数', value: '0' },
{ key: '海拔高', value: '0' },
{ key: '高度差', value: '0' },
{ key: '龄期', value: '0' },
{ key: '维度因子', value: '0' },
{ key: '经度因子', value: '0' },
{ key: '航向角', value: '0' },
{ key: '俯仰角', value: '0' },
{ key: '航向角状态-收星数', value: '0' },
{ key: '年月日', value: '0' },
{ key: '时分秒', value: '0' },
{ key: '经度', value: '0' },
{ key: '纬度', value: '0' },
{ key: '速度', value: '0' },
]
@State ratio: number = 850 / 960 @State ratio: number = 850 / 960
@State gpsActive: number = 1 @State gpsActive: number = 1
@Prop active: number = 0 @Prop active: number = 0
@State msgStr: string = '' @State msgStr: string = ''
@State interval: number = 0 @State interval: number = 0
@State @Watch('outClick') outFlag: boolean = false; @State @Watch('outClick') outFlag: boolean = false;
@State url: string = ''
private timer = null private timer = null
private udpClient: UdpClient = null private udpClient: UdpClient = null
private FileLog: FileLog private FileLog: FileLog
private vocObj = null; private vocObj = null;
@State url: string = ''
constructor() {
super()
}
build() { build() {
Column() { Column() {
Column() { Column() {
@ -259,8 +200,14 @@ export default struct SignDisplayCom {
Text('海拔高:' + this.signArr[85]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('海拔高:' + this.signArr[85]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('高度差:' + this.signArr[86]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('高度差:' + this.signArr[86]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('龄期:' + this.signArr[87]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('龄期:' + this.signArr[87]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('维度因子:' + this.signArr[88]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('维度因子:' + this.signArr[88])
Text('经度因子:' + this.signArr[89]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) .fontColor('#FFB433')
.fontSize(14 * this.ratio)
.height(18 * this.ratio)
Text('经度因子:' + this.signArr[89])
.fontColor('#FFB433')
.fontSize(14 * this.ratio)
.height(18 * this.ratio)
Text('航向角:' + this.signArr[90]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('航向角:' + this.signArr[90]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('俯仰角:' + this.signArr[91]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('俯仰角:' + this.signArr[91]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('航向角状态-收星数:' + this.signArr[92]) Text('航向角状态-收星数:' + this.signArr[92])
@ -303,6 +250,7 @@ export default struct SignDisplayCom {
}) })
}.margin({ top: 10 * this.ratio }) }.margin({ top: 10 * this.ratio })
Flex({ direction: FlexDirection.Column }) { Flex({ direction: FlexDirection.Column }) {
ForEach(this.GPSColum, (item) => { ForEach(this.GPSColum, (item) => {
Column() { Column() {
@ -325,8 +273,8 @@ export default struct SignDisplayCom {
Row() { Row() {
RealTime({ RealTime({
width:Math.floor(550 * this.ratio), widthNumber: Math.floor(550 * this.ratio),
height:Math.floor(380 * this.ratio), heightNumber: Math.floor(380 * this.ratio),
}) })
} }
.width(550 * this.ratio) .width(550 * this.ratio)
@ -352,6 +300,7 @@ export default struct SignDisplayCom {
aboutToDisappear() { aboutToDisappear() {
clearInterval(this.interval) clearInterval(this.interval)
} }
aboutToAppear() { aboutToAppear() {
this.ratio = this.ratio * (this.scaleNum || 1); this.ratio = this.ratio * (this.scaleNum || 1);
const that = this const that = this
@ -445,11 +394,11 @@ export default struct SignDisplayCom {
that.signArr = JSON.parse(JSON.stringify((this.signArr))) that.signArr = JSON.parse(JSON.stringify((this.signArr)))
that.GPSColum = JSON.parse(JSON.stringify((this.GPSColum))) that.GPSColum = JSON.parse(JSON.stringify((this.GPSColum)))
} }
outClick() { outClick() {
} }
saveLog() { saveLog() {
} }
} }

View File

@ -0,0 +1,43 @@
import { AmplifyArr, AmplifyImages } from '../../../mock'
const folder = 'judge/km3/amplify/'
@Component
export default struct EndPopup {
private amplifyImgIndex: number = 0
constructor() {
super()
}
build() {
Column() {
Column() {
}
.width(530)
.height(386)
.backgroundImage($rawfile(`${folder}${AmplifyImages[this.amplifyImgIndex]}`))
.backgroundImageSize({ width: '100%', height: '100%' })
.position({ y: '25%', x: '37%' })
.justifyContent(FlexAlign.Center)
.onClick((e: ClickEvent) => {
this.confirmAmplify(AmplifyArr[this.amplifyImgIndex])
})
}
.width('100%')
.height('100%')
.position({ y: 0 })
.backgroundColor('rgba(0,0,0,0.9)')
.onClick(() => {
this.closeAmplifyPop()
})
}
private closeAmplifyPop: Function = () => {
}
private confirmAmplify: Function = () => {
}
}

View File

@ -1,34 +1,27 @@
// @ts-nocheck
import hilog from '@ohos.hilog';
import apiJudgeSdk from 'libJudgeSdk.so'; import apiJudgeSdk from 'libJudgeSdk.so';
// import apiJudgeSdk from '@ohos.judgesdk'; import Judge from '../../judgeSDK/utils/judge-real';
import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d';
import Judge from '../../judgeSDK/utils/judge-real'
import {Project,ProjectObj,MarkRule} from '../../judgeSDK/api/judgeSDK.d'
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
@Component @Component
struct RealTime { export default struct RealTime {
constructor() {
super()
}
private height:number = 0
private width:number = 0
@State message: string = '开始绘制' @State message: string = '开始绘制'
// 控制XComponent组件的创建和销毁 // 控制XComponent组件的创建和销毁
@State draw: boolean = false @State draw: boolean = false
//监管接口序列号 //监管接口序列号
@State serialNumber: number = 0 @State serialNumber: number = 0
//模拟考试项目 //模拟考试项目
@State projects: Project[] = [] @State projects: Project[] = []
@State projectsObj: ProjectObj = {} @State projectsObj: ProjectObj = {}
@State markRuleListObj: MarkRule = {} @State markRuleListObj: MarkRule = {}
private widthNumber: string | number | Resource = 0
private heightNumber: string | number | Resource = 0
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
constructor() {
super()
}
// xcomponentController: XComponentController = new XComponentController() // xcomponentController: XComponentController = new XComponentController()
build() { build() {
@ -41,8 +34,8 @@ struct RealTime {
libraryname: 'JudgeSdk' libraryname: 'JudgeSdk'
// libraryname: 'judgesdk' // libraryname: 'judgesdk'
}) })
.width(this.width) .width(this.widthNumber)
.height(this.height) .height(this.heightNumber)
.onLoad(() => { .onLoad(() => {
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制 apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制
}) })
@ -52,9 +45,10 @@ struct RealTime {
clearInterval(globalThis.realTimer) clearInterval(globalThis.realTimer)
}) })
} else { } else {
Column() {} Column() {
.width(this.width) }
.height(this.height) .width(this.widthNumber)
.height(this.heightNumber)
} }
} }
.width('100%') .width('100%')
@ -72,7 +66,5 @@ struct RealTime {
//apiJudgeSdk.stopRender(); //apiJudgeSdk.stopRender();
} }
} }
export default RealTime

View File

@ -1,37 +0,0 @@
const folder = 'judge/km3/amplify/'
const amplifyImgs = [
'km_zxB.png','km_hcB.png',
'km_bdB.png',
'km_ccB.png','km_dtB.png','km_tcB.png',
]
const amplifyArrs = [
{name:'直线',projectCode:'3',projectCodeCenter:'40300'},
{name:'会车',projectCode:'9',projectCodeCenter:'41300'},
{name:'变道',projectCode:'4',projectCodeCenter:'40500'},
{name:'超车',projectCode:'10',projectCodeCenter:'41400'},
{name:'掉头',projectCode:'12',projectCodeCenter:'41500'},
{name:'停车',projectCode:'11',projectCodeCenter:'40600'},
]
@Component
export default struct EndPopup {
constructor() {
super()
}
private amplifyImgIndex:number = 0
private closeAmplifyPop:Function = ()=>{}
private confirmAmplify:Function = ()=>{}
build(){
Column(){
Column(){
}.width(530).height(386).backgroundImage($rawfile(`${folder}${amplifyImgs[this.amplifyImgIndex]}`)).backgroundImageSize({width:'100%',height:'100%'}).position({y:'25%',x:'37%'}).justifyContent(FlexAlign.Center)
.onClick((e:ClickEvent)=>{
this.confirmAmplify(amplifyArrs[this.amplifyImgIndex])
})
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.9)')
.onClick(()=>{this.closeAmplifyPop()})
}
}