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 "./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 common from '@ohos.app.ability.common';
import EndPoPup from './compontents/judge/end-popup'
import LoadingPopup from './compontents/judge/loading-popup'
import DeductedPopup from './compontents/judge/deduction-popup'
import AmplifyPopup from './compontents/judge/amplify-popup'
import Judge from './judgeSDK/judge'
import {defaultJudgeConfigObj} from './judgeSDK/utils//judge-common'
import EndPoPup from './compontents/judge/EndPopup';
import LoadingPopup from './compontents/judge/LoadingPopup';
import DeductedPopup from './compontents/judge/DeductionPopup';
import AmplifyPopup from './compontents/judge/AmplifyPopup';
import Judge from './judgeSDK/judge';
import { defaultJudgeConfigObj } from './judgeSDK/utils//judge-common';
import {
Project, ProjectObj, MarkRule, CDSBInfo,
SYSTEMPARMARR,CARINFO ,MAPPOINT ,MAPITEMPOINTITEM,SYSSET
} from './judgeSDK/api/judgeSDK.d'
import { getCurrentTime, formatTime, getCurrentHourTime,chunkArr } from '../common/utils/tools'
import { examJudgeEndExam } from './judgeSDK/api/index'
import { getSyncData } from '../common/service/initable'
import { judgeConfig } from './judgeSDK/utils/judge-config'
CARINFO,
CDSBInfo,
MAPITEMPOINTITEM,
MAPPOINT,
MarkRule,
Project,
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 SignDisplayCom from './compontents/signDisplayCom'
import {testMarkRules} from './judgeSDK/dataTest/index'
import SignDisplayCom from './compontents/signDisplayCom';
@Entry
@Component
struct Index {
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 img: ImageBitmap = new ImageBitmap("/resources/base/media/1.png")
//已考的考试项目
private wantInfos = []
async aboutToAppear() {
globalThis.windowClass.setWindowSystemBarEnable([''])
@ -51,16 +127,16 @@ struct Index {
}
//初始化相关数据库表
async initDb(){
async initDb() {
const examSubject = globalThis.carInfo.examSubject;
const {isTrajectoryOpen,trajectoryPath} = judgeConfig
await this.initStudent();
await this.initCar();
//是否开启轨迹回放模式
if(isTrajectoryOpen){
if (isTrajectoryOpen) {
this.initTrajectoryParam(trajectoryPath)
}else{
} else {
examSubject == 2
? await this.initSystemKm2Param()
: await this.initSystemKm3Param()
@ -70,11 +146,12 @@ struct Index {
await this.initCDSBInfo()
// 科目三新增读取表数据
if(examSubject == 3){
if (examSubject == 3) {
await this.initMapPoint()
await this.initMapPointItem()
}
}
// 查询考车信息
async initCar() {
const result = await getSyncData('ES_CARINFO')
@ -82,14 +159,14 @@ struct Index {
this.carName = decodeURI(carInfo.carclass)
this.carType = carInfo.kscx
this.carinfoArrr.push({
CARID:carInfo.carid,
IPADDR:'',
CARCLASS:decodeURI(carInfo.carclass),
KSCX:carInfo.kscx,
CARNAME:decodeURI(carInfo.carclass),
FLAG:carInfo.flag,
BK1:carInfo.bk1,
BK2:carInfo.bk2,
CARID: carInfo.carid,
IPADDR: '',
CARCLASS: decodeURI(carInfo.carclass),
KSCX: carInfo.kscx,
CARNAME: decodeURI(carInfo.carclass),
FLAG: carInfo.flag,
BK1: carInfo.bk1,
BK2: carInfo.bk2,
})
}
@ -109,36 +186,36 @@ struct Index {
// 获取扣分代码信息
async initMarkRules(markRules ?: MarkRule[]) {
const markRuleParams = markRules ||( await getSyncData('MA_MARKRULE') as MarkRule[])
const markRuleParams = markRules || (await getSyncData('MA_MARKRULE') as MarkRule[])
markRuleParams .forEach(mark => {
markRuleParams.forEach(mark => {
const tempObj = {
itemno:mark.itemno * 1,
markcatalog:mark.markcatalog,
markshow:decodeURI(mark.markshow),
markreal:mark.markreal * 1,
markserial:mark.markserial,
kfxh:mark.kfxh,
OnlyOneKind:mark.onlyoneid * 1,
NoCancelId:mark.nocancelid * 1,
GPS_SID:mark.gps_sid == 0 ? false : true
itemno: mark.itemno * 1,
markcatalog: mark.markcatalog,
markshow: decodeURI(mark.markshow),
markreal: mark.markreal * 1,
markserial: mark.markserial,
kfxh: mark.kfxh,
OnlyOneKind: mark.onlyoneid * 1,
NoCancelId: mark.nocancelid * 1,
GPS_SID: mark.gps_sid == 0 ? false : true
}
const markserial = mark.markserial * 1;
//筛选出人工评判的扣分
if(markserial > 100 && markserial < 200){
if (markserial > 100 && markserial < 200) {
this.manualMarkRules.push(tempObj)
}
this.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = {
...tempObj,
...tempObj,
markserial: mark.markserial,
};
})
}
// 获取sysset表信息
async initSysset(sysset?:SYSSET[]) {
const syssetParams = sysset || await getSyncData('MA_SYSSET')
async initSysset(sysset?: SYSSET[]) {
const syssetParams = sysset || await getSyncData('MA_SYSSET')
//@ts-ignore
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901');
this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || '123456'
@ -147,7 +224,7 @@ struct Index {
//@ts-ignore
syssetParams.forEach((sys) => {
if(isTrajectoryOpen){
if (isTrajectoryOpen) {
sys.v_no = sys.key;
sys.v_name = sys.name;
sys.v_value = sys.value
@ -156,14 +233,14 @@ struct Index {
const {v_no,v_value} = sys;
const v_no_num = v_no * 1;
const value = decodeURIComponent(v_value)
if(v_no_num >= 10 &&v_no_num <= 900){
if (v_no_num >= 10 && v_no_num <= 900) {
syssetJudgeConfigArr.push({
key: v_no_num,value: value,
key: v_no_num, value: value,
name: decodeURI(sys.v_name)
})
}
//科目三应行驶距离参数
if(sys.v_no == '303'){
if (sys.v_no == '303') {
this.examMileage = sys.v_value + '';
}
@ -173,35 +250,35 @@ struct Index {
}
// 初始化systemParam表
async initSystemKm2Param(sysParam?:SYSTEMPARMARR[]){
const systemParms:any = sysParam || await getSyncData('MA_SYSTEMPARM')
async initSystemKm2Param(sysParam?: SYSTEMPARMARR[]) {
const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM')
const carName = this.carName;
let carNo2 = '',allItems = [];
systemParms.forEach((systemParm)=>{
let carNo2 = '', allItems = [];
systemParms.forEach((systemParm) => {
const {no1,no2,no3} = systemParm;
//获取当前考车的no2
if(no1 == 3 && no3 == 1){
if (no1 == 3 && no3 == 1) {
const txt1 = decodeURI(systemParm.txt1)
if(txt1 === carName){
if (txt1 === carName) {
carNo2 = no2;
}
}
//获取当前考车的考试项目
if(carNo2 !== '' && no2 == carNo2 && no3 == 10){
if (carNo2 !== '' && no2 == carNo2 && no3 == 10) {
allItems = decodeURIComponent(systemParm.txt1).split(',')
}
// 存储当前考车考试项目
if(allItems.length && no1 == 6 && allItems.includes(no2)){
if (allItems.length && no1 == 6 && allItems.includes(no2)) {
const txt2 = decodeURIComponent(systemParm.txt2)
const currentProject = {
name:decodeURI(systemParm.txt1),
abbreviation:decodeURI(systemParm.txt3),
projectCode:no2,
projectCodeCenter:txt2
name: decodeURI(systemParm.txt1),
abbreviation: decodeURI(systemParm.txt3),
projectCode: no2,
projectCodeCenter: txt2
// sbxh:project.type
}
this.projectsObj[no2] = currentProject
@ -211,7 +288,7 @@ struct Index {
})
const projects = this.projects;
if(!projects.length){
if (!projects.length) {
Prompt.showToast({
message: '读取数据库信息失败,请重新考试!',
duration: 8000
@ -221,14 +298,14 @@ struct Index {
}
//初始化systemParam表
async initSystemKm3Param(sysParam?:SYSTEMPARMARR[]) {
async initSystemKm3Param(sysParam?: SYSTEMPARMARR[]) {
const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM')
const {isTrajectoryOpen} = judgeConfig
systemParms.forEach((systemParm) => {
if(isTrajectoryOpen){
if (isTrajectoryOpen) {
systemParm.no1 = systemParm.NO1;
systemParm.no2 = systemParm.NO2;
systemParm.no3 = systemParm.NO3;
@ -239,10 +316,12 @@ struct Index {
const {no1,no2,no3,} = systemParm;
this.systemparmArr.push({
'NO1':no1*1,'NO2':no2*1,'NO3':no3*1,
'TXT1':decodeURIComponent(systemParm.txt1),
'TXT2':decodeURIComponent(systemParm.txt2),
'TXT3':decodeURIComponent(systemParm.txt3),
'NO1': no1 * 1,
'NO2': no2 * 1,
'NO3': no3 * 1,
'TXT1': decodeURIComponent(systemParm.txt1),
'TXT2': decodeURIComponent(systemParm.txt2),
'TXT3': decodeURIComponent(systemParm.txt3),
})
const txt2 = decodeURIComponent(systemParm.txt2)
@ -306,7 +385,7 @@ struct Index {
// 断点续考判断
async goDdxkItems() {
const judgeConfigObj = this.judgeConfigObj
if(judgeConfigObj['369'] != 1 || judgeConfigObj['432'] != 1){
if (judgeConfigObj['369'] != 1 || judgeConfigObj['432'] != 1) {
return
}
//断点续考判断
@ -351,55 +430,67 @@ struct Index {
}
// 初始化mapPoint表
async initMapPoint(){
async initMapPoint() {
const pointParams = await getSyncData('MA_MAP_POINT')
//@ts-ignore
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;
this.mapPointArr.push({
point_no:point_no * 1,
gps_e:gps_e * 1,
gps_n:gps_n * 1,
point_no_f:point_no_f * 1,
point_type:point_type * 1,
pointParams.forEach(point => {
const {
point_no,
gps_e,
gps_n,
point_no_f,
point_type,
road_code,
gps_e_Location:(gps_e_Location || 0 ) * 1,
gps_n_Location:(gps_n_Location || 0 ) * 1,
f_gps_e:f_gps_e * 1,
f_gps_n:f_gps_n * 1,
passed:passed * 1
gps_e_Location,
gps_n_Location,
f_gps_e,
f_gps_n,
passed
} = point;
this.mapPointArr.push({
point_no: point_no * 1,
gps_e: gps_e * 1,
gps_n: gps_n * 1,
point_no_f: point_no_f * 1,
point_type: point_type * 1,
road_code,
gps_e_Location: (gps_e_Location || 0) * 1,
gps_n_Location: (gps_n_Location || 0) * 1,
f_gps_e: f_gps_e * 1,
f_gps_n: f_gps_n * 1,
passed: passed * 1
})
})
}
// 初始化mapPointItem表
async initMapPointItem(){
async initMapPointItem() {
const pointItemPoints = await getSyncData('MA_MAP_POINT_ITEM');
//@ts-ignore
pointItemPoints.forEach(itemPoint => {
const {point_no,itemno,itemno1,subname} = itemPoint
this.mapPointItemArr.push({
point_no:point_no * 1,
itemno:itemno * 1,
itemno1:itemno1 * 1,
subname
point_no: point_no * 1,
itemno: itemno * 1,
itemno1: itemno1 * 1,
subname
})
})
}
// 初始化本地systemparam表、markrule表
async initTrajectoryParam(trajectoryPath:string){
async initTrajectoryParam(trajectoryPath: string) {
const {isTrajectoryOpen} = judgeConfig
//轨迹回放读取 systemparam表、markrule表
const fileUtil = new FileUtil(this.context);
const fileUtil = new FileUtil(this.context);
const folderPath = await fileUtil.initFolder(trajectoryPath);
const str = await fileUtil.readFile(folderPath);
const strArr = str.split('\n');
const [initData,beginData] = [strArr[0],strArr[1]];
const [initData, beginData] = [strArr[0], strArr[1]];
const initDataObj = JSON.parse(initData)
const systemparm = initDataObj.systemparm;
const examSubject = globalThis.carInfo.examSubject;
this.examSubject = isTrajectoryOpen ? (initDataObj.kskm*1):examSubject;
this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject;
globalThis.carInfo.examSubject = this.examSubject
examSubject == 2
? await this.initSystemKm2Param(systemparm)
@ -409,7 +500,6 @@ struct Index {
await this.initSysset(initDataObj.sysset);
}
build() {
Column() {
Row() {
@ -417,7 +507,7 @@ struct Index {
Image($rawfile('judge/signal_logoS.png')).width(120)
Text(this.time).fontColor('#CCB48F').fontSize(32).padding({ left: 10, right: 5 })
Image($rawfile('judge/xh_green.png')).width(50)
}.padding({left:20})
}.padding({ left: 20 })
Row() {
Text(`当前项目:${this.xmmcStr || '无'} `).fontColor('#E5CCA1').fontSize(32)
@ -445,7 +535,7 @@ struct Index {
Text(this.startTime).fontColor('#FFF').fontSize(this.FONTSIZE)
}.margin({ bottom: 10 })
if(this.examSubject == 3){
if (this.examSubject == 3) {
Row() {
Text('考试路线:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
Text('线路6').fontColor('#FFAD33').fontSize(this.FONTSIZE)
@ -465,10 +555,13 @@ struct Index {
Text(formatTime(this.examTime)).fontColor('#FFF').fontSize(this.FONTSIZE)
}.margin({ bottom: 10 })
if(this.examSubject == 3){
if (this.examSubject == 3) {
Row() {
if(this.judgeConfigObj['375'] == '0'){
Text(`应行驶:${this.examMileage}m`).fontColor('#E5CCA1').fontSize(this.FONTSIZE).padding({right:20})
if (this.judgeConfigObj['375'] == '0') {
Text(`应行驶:${this.examMileage}m`)
.fontColor('#E5CCA1')
.fontSize(this.FONTSIZE)
.padding({ right: 20 })
}
Text(`已行驶:${this.jl}m`).fontColor('#FFAD33').fontSize(this.FONTSIZE)
}
@ -479,13 +572,14 @@ struct Index {
}.width('100%')
Column() {
Row(){
Row() {
Text(this.carztStr).fontColor('#FFA500').fontSize(this.FONTSIZE)
}.height(40)
Row() {
Flex({ direction: FlexDirection.Column }) {
if(this.kfArr.length){
if (this.kfArr.length) {
List({}) {
ForEach(this.kfArr, (item) => {
ListItem() {
@ -505,10 +599,10 @@ struct Index {
.margin({ top: 10, bottom: 8, left: 5, right: 5 })
}.margin({ top: 15 }).alignItems(HorizontalAlign.Start)
}.margin({bottom:25})
}.margin({ bottom: 25 })
})
}.padding({left:15,right:15,top:30,bottom:5})
}else{
}.padding({ left: 15, right: 15, top: 30, bottom: 5 })
} else {
Column() {
Row() {
Text('暂无扣分项').fontSize(this.BIGFONTSIZE).fontColor('#FFF')
@ -518,73 +612,115 @@ struct Index {
.justifyContent(FlexAlign.SpaceBetween)
.padding({ top: 12, bottom: 12, left: 8, right: 3 })
}.margin({ top: 35 }).padding({left:20,right:20}).alignItems(HorizontalAlign.Start)
}.margin({ top: 35 }).padding({ left: 20, right: 20 }).alignItems(HorizontalAlign.Start)
}
}
.backgroundImage($rawfile('judge/score_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(514)
.height(618)
.padding({ top: 18, bottom: 15, left: 13, right: 14 })
.backgroundImage($rawfile('judge/score_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(514)
.height(618)
.padding({ top: 18, bottom: 15, left: 13, right: 14 })
//科目二
if(this.examSubject == 2){
Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceBetween}){
List({}){
ForEach(chunkArr(this.projects,2),(item)=>{
ListItem(){
Row(){
Row(){
if (this.examSubject == 2) {
Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
List({}) {
ForEach(chunkArr(this.projects, 2), (item) => {
ListItem() {
Row() {
Row() {
//#FF7566 #00FFD5 #E6DECF
// 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))
}.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]){
Row(){
Text(item[0].abbreviation)
.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]) {
Row() {
//#FF7566 #00FFD5 #E6DECF
Text(item[1].abbreviation).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)
Text(item[1].abbreviation)
.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){
Column(){
Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceBetween}){
List({}){
ForEach(this.projects,(project)=>{
ListItem(){
Text(project.name){
if (this.examSubject == 3) {
Column() {
Flex({
wrap: FlexWrap.Wrap,
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween
}) {
List({}) {
ForEach(this.projects, (project) => {
ListItem() {
Text(project.name) {
}.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type)).margin({bottom:5}).fontSize(26)
}.margin({bottom:8})
}
.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type))
.margin({ bottom: 5 })
.fontSize(26)
}.margin({ bottom: 8 })
})
}.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})
}.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 })
Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceAround}){
List(){
ForEach(this.artSubject3Projects,(item,index)=>{
ListItem(){}.backgroundImage(
Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceAround }) {
List() {
ForEach(this.artSubject3Projects, (item, index) => {
ListItem() {
}
.backgroundImage(
$rawfile(
`judge/km3/${this.getIsExitManualProject(index) ? item : (item+'_gray')}.png`
),ImageRepeat.NoRepeat)
.backgroundImageSize({width:'100%',height:'100%'}).width(174).height(118).margin({bottom:15})
.onClick(()=>{
if(this.getIsExitManualProject(index)){
`judge/km3/${this.getIsExitManualProject(index) ? item : (item + '_gray')}.png`
), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(174)
.height(118)
.margin({ bottom: 15 })
.onClick(() => {
if (this.getIsExitManualProject(index)) {
// 靠边停车时候可以触发
if(this.judgeConfigObj['343'] == 0 ){
if (this.judgeConfigObj['343'] == 0) {
const xmmcStr = this.xmmcStr;
if(xmmcStr == '无' || xmmcStr == ''){
this.amplifiedImgIndex = index;this.isAmplifyPopShow = true
} else{
if(index === 5){
if (xmmcStr == '无' || xmmcStr == '') {
this.amplifiedImgIndex = index;
this.isAmplifyPopShow = true
} else {
if (index === 5) {
Prompt.showToast({
message: `${xmmcStr}未结束,不允许靠边停车`,
duration: 8000
@ -592,15 +728,22 @@ struct Index {
}
}
}else{
this.amplifiedImgIndex = index;this.isAmplifyPopShow = true
} else {
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)
}.width('100%').height('100%').alignItems(HorizontalAlign.Start).margin({ top: 10 })
@ -631,22 +774,32 @@ struct Index {
.backgroundImageSize({ width: '100%', height: '100%' })
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.margin({ top: 30 ,bottom:15})
.margin({ top: 30, bottom: 15 })
}
Column(){
if(this.examSubject == 3){
Row(){
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})
}.width(334).height(110).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
.backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({bottom:10})
.onClick(()=>{
if(this.judgeConfigObj['342'] == 0){
Column() {
if (this.examSubject == 3) {
Row() {
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 })
}
.width(334)
.height(110)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 10 })
.onClick(() => {
if (this.judgeConfigObj['342'] == 0) {
this.isDeductedPopShow = true
}else{
} else {
Prompt.showToast({
message: '平台配置不允许人工评判!',
duration: 4000
@ -655,30 +808,41 @@ struct Index {
})
}
Row(){
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})
}.width(334).height(110).justifyContent(FlexAlign.Center).alignItems(VerticalAlign.Center)
Row() {
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 })
}
.width(334)
.height(110)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.backgroundImage($rawfile('judge/button_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({bottom:10})
.margin({ bottom: 10 })
Row() {}
Row() {
}
.width(334)
.height(100)
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => {
if(this.judgeConfigObj['353'] == '0' ){
if (this.judgeConfigObj['353'] == '0') {
this.endPopupVisible = true
}else{
} else {
Prompt.showToast({
message: '车上不允许手动结束考试!',
duration: 4000
});
}
})
}.margin({bottom:30})
}.margin({ bottom: 30 })
}
.width('25%')
@ -724,7 +888,8 @@ struct Index {
msgStr: this.judge.plcStr || ''
}).margin({ top: 100 })
Row() {}
Row() {
}
.width(240)
.height(240)
.position({ x: '81%', y: 80 })
@ -739,30 +904,32 @@ struct Index {
//科目三人工扣分弹窗
if (this.isDeductedPopShow) {
DeductedPopup({
currentItems:Reflect.ownKeys(this.projectsObj).map(projectKey => {
currentItems: Reflect.ownKeys(this.projectsObj).map(projectKey => {
const project = this.projectsObj[projectKey]
return project.type == '2'?project.projectCode:''
return project.type == '2' ? project.projectCode : ''
}).filter(project => project !== ''),
markRules:this.manualMarkRules,
closePopup:()=>{this.isDeductedPopShow = false},
confirmMark:async (itemno,serial) => {
markRules: this.manualMarkRules,
closePopup: () => {
this.isDeductedPopShow = false
},
confirmMark: async (itemno, serial) => {
const judge = this.judge
await judge.setJudgeMark(itemno,serial);
await judge.setJudgeMark(itemno, serial);
this.isDeductedPopShow = false
}
})
}
//科目三人工项目确认框
if(this.isAmplifyPopShow){
if (this.isAmplifyPopShow) {
AmplifyPopup({
amplifyImgIndex:this.amplifiedImgIndex,
confirmAmplify:async (amplify)=>{
amplifyImgIndex: this.amplifiedImgIndex,
confirmAmplify: async (amplify) => {
const judge = this.judge
await judge.setJudgeItem(amplify.projectCode);
this.isAmplifyPopShow = false
},
closeAmplifyPop:()=>{
closeAmplifyPop: () => {
this.isAmplifyPopShow = false
}
})
@ -792,108 +959,30 @@ struct Index {
}
// 获取是否能人工进项目
getIsExitManualProject = (index:number)=>{
getIsExitManualProject = (index: number) => {
const {judgeConfigObj,artSubject3ProjectsCodesArr,projectsObj} = this;
const unExitManualProjects = judgeConfigObj['332'].split(',') || [];
const param348 = judgeConfigObj['348'] || '0';
const param387 = judgeConfigObj['387'] || '0';
if(judgeConfigObj['342'] === '3' || judgeConfigObj['342'] === '2'){
if (judgeConfigObj['342'] === '3' || judgeConfigObj['342'] === '2') {
return false
}
if(unExitManualProjects.includes(artSubject3ProjectsCodesArr[index])){
if (unExitManualProjects.includes(artSubject3ProjectsCodesArr[index])) {
return false
}
if(param348 == '0' && projectsObj['9']?.type == 2){
if (param348 == '0' && projectsObj['9']?.type == 2) {
return index === 0 ? true : false
}
if(param387 === '0' && index === 5){
if (param387 === '0' && index === 5) {
const {examMileage,jl} = this
return jl >= Number(examMileage)
}
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 util from '@ohos.util';
import { voiceService } from '../../common/service/voiceService'
import { faceCompare } from '../../api/userInfo'
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 { string2Bytes } from '../../common/utils/tools'
import { takePhoto } from '../../common/service/videoService'
import { GlobalConfig } from '../../config/index'
import { string2Bytes } from '../../common/utils/tools';
import { takePhoto } from '../../common/service/videoService';
import { GlobalConfig } from '../../config/index';
import { VideoConfigData } from '../../mock';
@Component
export default struct FaceCompare {
constructor() {
super()
}
@State imageBase64: string = 'data:image/jpeg;base64,'
@Prop sfzh: string;
@Prop lsh: string;
@ -27,46 +20,26 @@ export default struct FaceCompare {
@Link getqkFlag: boolean;
@Link faceCatchImg: string;
@State imageThumbnail: string = '';
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对需要点击重新打开重新触发
private vocObj = null;
@State callBackFlag: 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 previewUri: Resource = $r('app.media.2_nor')
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
@State showControls: boolean = false
private controller: VideoController = new VideoController()
@State isAutoPlay: boolean = true
@State signNum: number = 0;
@State param: VideoConfig = VideoConfigData
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对需要点击重新打开重新触发
private vocObj = null;
private controller: VideoController = new VideoController()
private fileUtil: FileUtil
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;
constructor() {
super()
}
build() {
Column() {
Column() {
@ -162,7 +135,7 @@ export default struct FaceCompare {
this.controller.stop()
this.vocObj && this.vocObj.releasePlayer()
this.showFaceCompare = !this.showFaceCompare
this.showFaceCompareFlag=!this.showFaceCompareFlag
this.showFaceCompareFlag = !this.showFaceCompareFlag
this.faceCompareSucess = -1
globalThis.statue = 2
@ -203,9 +176,9 @@ export default struct FaceCompare {
}
async faceComparFn() {
console.log('mmmmm0',1)
console.log('mmmmm0', 1)
takePhoto(this.param, this.context, 'jt/',0,({base64})=>{
takePhoto(this.param, this.context, 'jt/', 0, ({base64}) => {
faceCompare({
sfzh: this.sfzh,
firstImage: this.firstImage.substr(22),
@ -213,12 +186,12 @@ export default struct FaceCompare {
type: 2,
verifyType: 1
}).then(res => {
console.log('mmmmm8',res)
console.log('mmmmm8', res)
if (res) {
this.controller.stop()
this.showFaceCompare = !this.showFaceCompare
this.showFaceCompareFlag=!this.showFaceCompareFlag
this.showFaceCompareFlag = !this.showFaceCompareFlag
this.faceCompareSucess = 1;
// this.faceCatchImg = result
this.vocObj.playAudio({
@ -236,9 +209,7 @@ export default struct FaceCompare {
}
})
})
console.log('mmmmm8',9)
console.log('mmmmm8', 9)
}
@ -246,7 +217,7 @@ export default struct FaceCompare {
async heartMsg(context) {
let tmpList = []
const str = this.lsh
for (let i = 0;i < str.length; i++) {
for (let i = 0; i < str.length; i++) {
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
}
const param = {
@ -274,7 +245,7 @@ export default struct FaceCompare {
globalThis.udpClient2.setMsgCallBack((val) => {
if (val.id == '48') {
if (val.body[13] == '1') {
this.showFaceCompareFlag=!this.showFaceCompareFlag
this.showFaceCompareFlag = !this.showFaceCompareFlag
this.showFaceCompare = !this.showFaceCompare
this.vocObj && this.vocObj.releasePlayer()
this.faceCompareSucess = 1
@ -311,7 +282,7 @@ export default struct FaceCompare {
}
} else if (val == 'yzcg.wav') {
this.showFaceCompare = !this.showFaceCompare
this.showFaceCompareFlag=!this.showFaceCompareFlag
this.showFaceCompareFlag = !this.showFaceCompareFlag
globalThis.statue = 4
this.faceCompareSucess = 1;
this.vocObj && this.vocObj.releasePlayer()
@ -320,13 +291,13 @@ export default struct FaceCompare {
this.vocObj && this.vocObj.releasePlayer()
this.faceCompareSucess = -1
this.showFaceCompare = !this.showFaceCompare
this.showFaceCompareFlag=!this.showFaceCompareFlag
this.showFaceCompareFlag = !this.showFaceCompareFlag
}
}
});
const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
console.log('faceEnterIn,data',data)
console.log('faceEnterIn,data', data)
setTimeout(() => {
this.vocObj && this.vocObj.playAudio({
@ -343,8 +314,6 @@ export default struct FaceCompare {
this.controller.start()
}
async aboutToDisappear() {
}

View File

@ -1,95 +1,36 @@
import router from '@ohos.router'
import router from '@ohos.router';
import UdpClient from '../../common/utils/UdpClient';
import FileLog from '../judgeSDK/utils/file-log'
import { voiceService } from '../../common/service/voiceService'
import prompt from '@ohos.prompt'
import RealTime from '../compontents/judge/real-time'
import FileLog from '../judgeSDK/utils/file-log';
import RealTime from '../compontents/judge/RealTime';
import { GPSData, SignalData } from '../../mock';
import { SignalDataType } from '../../model';
@Component
export default struct SignDisplayCom {
constructor() {
super()
}
@State showBack: boolean = false
@State scaleNum: number = 1
@State msg: string = ''
@State signArr: Array<any> = []
@State sjxhColum: Array<any> = [
{ 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'
}]
@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 sjxhColum: Array<SignalDataType> = SignalData
@State GPSColum: Array<SignalDataType> = GPSData
@State ratio: number = 850 / 960
@State gpsActive: number = 1
@Prop active: number = 0
@State msgStr: string = ''
@State interval: number=0
@State interval: number = 0
@State @Watch('outClick') outFlag: boolean = false;
@State url: string = ''
private timer = null
private udpClient: UdpClient = null
private FileLog: FileLog
private vocObj = null;
@State url: string = ''
constructor() {
super()
}
build() {
Column(){
Column() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() {
@ -137,7 +78,7 @@ export default struct SignDisplayCom {
}
Row() {
if(this.showBack){
if (this.showBack) {
Image($r('app.media.topB_back')).height('12.2%')
.onClick(() => {
router.back()
@ -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[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[88]).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[88])
.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[91]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('航向角状态-收星数:' + this.signArr[92])
@ -293,16 +240,17 @@ export default struct SignDisplayCom {
Row() {
Text('GPS').fontColor(this.gpsActive == 0 ? '#2D3C5A' : '#fff')
}
.width(316*this.ratio)
.height(24*this.ratio)
.width(316 * this.ratio)
.height(24 * this.ratio)
.backgroundColor(this.gpsActive == 0 ? '#fff' : '#1A1A1A')
.margin({ left: 10*this.ratio, right: 10*this.ratio })
.margin({ left: 10 * this.ratio, right: 10 * this.ratio })
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.gpsActive = 0
})
}.margin({ top: 10*this.ratio })
}.margin({ top: 10 * this.ratio })
Flex({ direction: FlexDirection.Column }) {
ForEach(this.GPSColum, (item) => {
Column() {
@ -314,7 +262,7 @@ export default struct SignDisplayCom {
})
}
}
.width(168 *2* this.ratio)
.width(168 * 2 * this.ratio)
.height(380 * this.ratio)
.backgroundColor('#282828')
.margin({ top: 6 * this.ratio, left: 10 * this.ratio })
@ -325,8 +273,8 @@ export default struct SignDisplayCom {
Row() {
RealTime({
width:Math.floor(550 * this.ratio),
height:Math.floor(380 * this.ratio),
widthNumber: Math.floor(550 * this.ratio),
heightNumber: Math.floor(380 * this.ratio),
})
}
.width(550 * this.ratio)
@ -352,63 +300,64 @@ export default struct SignDisplayCom {
aboutToDisappear() {
clearInterval(this.interval)
}
aboutToAppear(){
aboutToAppear() {
this.ratio = this.ratio * (this.scaleNum || 1);
const that = this
const {showBack,getSignal} = this
if(showBack){
if (showBack) {
globalThis.udpClient.onMessage((msg) => {
console.log('msgmsg',msg)
if(msg){
console.log('msgmsg', msg)
if (msg) {
getSignal(msg)
}
})
}else{
} else {
clearInterval(globalThis.signalTimer)
globalThis.signalTimer = setInterval(()=>{
globalThis.signalTimer = setInterval(() => {
const msgStr = globalThis.msgStr
if(msgStr){
if (msgStr) {
getSignal(msgStr)
}
},200)
}, 200)
}
}
onPageShow() {
console.info('SURENJUN',123)
console.info('SURENJUN', 123)
const getSignal = this.getSignal;
const that = this
const showBack = this.showBack;
if(showBack){
if (showBack) {
globalThis.udpClient.onMessage((msg) => {
getSignal(msg)
})
}else{
} else {
clearInterval(globalThis.signalTimer)
globalThis.signalTimer = setInterval(()=>{
globalThis.signalTimer = setInterval(() => {
//TODO 临时方案
const msgStr = globalThis.msgStr
getSignal(msgStr)
},200)
}, 200)
}
}
getSignal= (msg)=> {
console.log('msgmsgmsg',msg)
getSignal = (msg) => {
console.log('msgmsgmsg', msg)
const that = this;
that.msg = msg
const strachArr=msg.split(',')
const strachArr = msg.split(',')
if (strachArr[0] != '#DN_GD') {
return
}
this.signArr = strachArr
for (let i = 0;i <= 12; i++) {
for (let i = 0; i <= 12; i++) {
this.sjxhColum[i].value = this.signArr[i+2]
}
@ -417,7 +366,7 @@ export default struct SignDisplayCom {
this.sjxhColum[15].value = this.signArr[19]
this.sjxhColum[16].value = this.signArr[20]
this.sjxhColum[17].value = this.signArr[23] //车速
this.sjxhColum[18].value=this.signArr[28]
this.sjxhColum[18].value = this.signArr[28]
this.sjxhColum[19].value = this.signArr[29]
this.sjxhColum[20].value = this.signArr[30]
this.sjxhColum[21].value = this.signArr[15] //NC
@ -433,11 +382,11 @@ export default struct SignDisplayCom {
this.sjxhColum[31].value = this.signArr[33]
this.sjxhColum[32].value = this.signArr[34]
this.sjxhColum[33].value = this.signArr[35]
for (let i = 34;i <= 46; i++) {
for (let i = 34; i <= 46; i++) {
this.sjxhColum[i].value = this.signArr[i+2]
}
let t=0
for (let i = 83;i <= 97; i++) {
let t = 0
for (let i = 83; i <= 97; i++) {
this.GPSColum[t].value = this.signArr[i]
t++
}
@ -445,11 +394,11 @@ export default struct SignDisplayCom {
that.signArr = JSON.parse(JSON.stringify((this.signArr)))
that.GPSColum = JSON.parse(JSON.stringify((this.GPSColum)))
}
outClick() {
}
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 '@ohos.judgesdk';
import Judge from '../../judgeSDK/utils/judge-real'
import {Project,ProjectObj,MarkRule} from '../../judgeSDK/api/judgeSDK.d'
import Judge from '../../judgeSDK/utils/judge-real';
import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d';
import common from '@ohos.app.ability.common';
@Component
struct RealTime {
constructor() {
super()
}
private height:number = 0
private width:number = 0
export default struct RealTime {
@State message: string = '开始绘制'
// 控制XComponent组件的创建和销毁
@State draw: boolean = false
//监管接口序列号
@State serialNumber:number = 0
@State serialNumber: number = 0
//模拟考试项目
@State projects:Project[] = []
@State projectsObj:ProjectObj = {}
@State markRuleListObj:MarkRule ={}
@State projects: Project[] = []
@State projectsObj: ProjectObj = {}
@State markRuleListObj: MarkRule = {}
private widthNumber: string | number | Resource = 0
private heightNumber: string | number | Resource = 0
private context = getContext(this) as common.UIAbilityContext;
constructor() {
super()
}
// xcomponentController: XComponentController = new XComponentController()
build() {
@ -41,8 +34,8 @@ struct RealTime {
libraryname: 'JudgeSdk'
// libraryname: 'judgesdk'
})
.width(this.width)
.height(this.height)
.width(this.widthNumber)
.height(this.heightNumber)
.onLoad(() => {
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制
})
@ -52,9 +45,10 @@ struct RealTime {
clearInterval(globalThis.realTimer)
})
} else {
Column() {}
.width(this.width)
.height(this.height)
Column() {
}
.width(this.widthNumber)
.height(this.heightNumber)
}
}
.width('100%')
@ -72,7 +66,5 @@ struct RealTime {
//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()})
}
}