fix: 优化首页获取车辆后才可以进入联网以及单机逻辑

This commit is contained in:
wangzhongjie 2025-07-02 17:34:25 +08:00
parent b0692d358c
commit f03ace7f04
6 changed files with 27 additions and 19 deletions

View File

@ -582,10 +582,6 @@ export interface ItemInfos {
'1'?: ItemInfo '1'?: ItemInfo
} }
// export const defaultCdsbInfoObj:DefaultJudgeConfigObj = {
//
// }
/****** 评判初始化数据*****/ /****** 评判初始化数据*****/
export interface JudgeInitObj extends Km3JudgeInitConfig { export interface JudgeInitObj extends Km3JudgeInitConfig {

View File

@ -15,10 +15,10 @@ import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
import HeaderComponent from './compontents/Header'; import HeaderComponent from './compontents/Header';
import CardComponent from './Index/Card'; import CardComponent from './Index/Card';
import BottomMessageComponent from './Index/BottomMessage'; import BottomMessageComponent from './Index/BottomMessage';
import LoadingComponent from './Index/Loading';
import Prompt from '@system.prompt'; import Prompt from '@system.prompt';
import { DifferentialAndSignal } from '../utils/business/DifferentialAndSignalWorker'; import { DifferentialAndSignal } from '../utils/business/DifferentialAndSignalWorker';
import { dConsole } from '../utils/LogWorker'; import { dConsole } from '../utils/LogWorker';
import CarLoadingComponent from './Index/Loading';
@Entry @Entry
@Component @Component
@ -41,7 +41,7 @@ struct Index {
@State initWork: boolean = false @State initWork: boolean = false
// 请求网络表等待弹窗 // 请求网络表等待弹窗
customDialogController: CustomDialogController = new CustomDialogController({ customDialogController: CustomDialogController = new CustomDialogController({
builder: LoadingComponent(), builder: CarLoadingComponent(),
customStyle: true, customStyle: true,
alignment: DialogAlignment.Center, alignment: DialogAlignment.Center,
autoCancel: true autoCancel: true
@ -222,10 +222,24 @@ struct Index {
CardComponent({ CardComponent({
isSingle: this.singlePlay, isSingle: this.singlePlay,
singleClick: () => { singleClick: () => {
if (this.deviceId === "") {
Prompt.showToast({
message: `未获取到车辆信息,请检查网络!`,
duration: 3000
});
return
}
dConsole.log(HomeTag, "单机模式点击") dConsole.log(HomeTag, "单机模式点击")
this.singlePlayerTraining() this.singlePlayerTraining()
}, },
networkingClick: () => { networkingClick: () => {
if (this.deviceId === "") {
Prompt.showToast({
message: `未获取到车辆信息,请检查网络!`,
duration: 3000
});
return
}
dConsole.log(HomeTag, "联网考试点击") dConsole.log(HomeTag, "联网考试点击")
this.onlineExam() this.onlineExam()
} }

View File

@ -1,5 +1,5 @@
@CustomDialog @CustomDialog
export default struct LoadingComponent { export default struct CarLoadingComponent {
@State angle: number = 0 @State angle: number = 0
private controller?: CustomDialogController; private controller?: CustomDialogController;

View File

@ -63,9 +63,6 @@ struct JudgePage {
//页面通用字体大小 //页面通用字体大小
@State wayno: number = 0 @State wayno: number = 0
@State isDdxk: boolean = false; @State isDdxk: boolean = false;
@State time: string = ''
//考试用时
@State examTime: number = 0
//开始时间 //开始时间
@State startTime: string = '00:00:00' @State startTime: string = '00:00:00'
@State startFullTime: string = '' @State startFullTime: string = ''
@ -200,7 +197,6 @@ struct JudgePage {
}) })
async aboutToDisappear() { async aboutToDisappear() {
this.generateExamRecordsDialogController.close()
clearInterval(this.mileageTimer) clearInterval(this.mileageTimer)
} }
@ -208,13 +204,9 @@ struct JudgePage {
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.startFullTime = GetCurrentTime(1); this.startFullTime = GetCurrentTime(1);
// this.startHourTime = await getCurrentHourTime()
this.startTime = dayTs().format("YYYY-MM-DD HH:mm:ss") this.startTime = dayTs().format("YYYY-MM-DD HH:mm:ss")
this.startExamTime = dayTs().format("YYYY-MM-DD HH:mm:ss") this.startExamTime = dayTs().format("YYYY-MM-DD HH:mm:ss")
setInterval(async () => {
this.time = dayTs().format("YYYY-MM-DD HH:mm:ss");
this.examTime += 1;
}, 1000);
//初始化数据库表 //初始化数据库表
await this.initDb() await this.initDb()
//断点续考 //断点续考
@ -690,7 +682,6 @@ struct JudgePage {
name: this.name, name: this.name,
idCard: this.idCard, idCard: this.idCard,
startTime: this.startTime, startTime: this.startTime,
examTime: this.examTime,
examSubject: this.examSubject, examSubject: this.examSubject,
examMileage: this.examMileage, examMileage: this.examMileage,
jl: this.jl, jl: this.jl,

View File

@ -6,13 +6,19 @@ export default struct MessageComponent {
@Prop name: string @Prop name: string
@Prop startTime: string @Prop startTime: string
@Prop idCard: string @Prop idCard: string
@Prop examTime: number @State examTime: number = 0
@Prop examSubject: string @Prop examSubject: string
@Prop examMileage: string @Prop examMileage: string
@Prop jl: number @Prop jl: number
@Prop wayno: number @Prop wayno: number
@Prop judgeConfigObj: DefaultJudgeConfigObj @Prop judgeConfigObj: DefaultJudgeConfigObj
aboutToAppear(): void {
setInterval(async () => {
this.examTime += 1;
}, 1000);
}
build() { build() {
Row() { Row() {
Column() { Column() {

View File

@ -689,7 +689,8 @@ export const GetIsExitManualProject = (index: number, judgeConfigObj: DefaultJud
const projectType = currentProject.type; const projectType = currentProject.type;
//不允许人工触发的项目列表,以","分隔 //不允许人工触发的项目列表,以","分隔
const unExitManualProjects: string[] = Reflect.get(judgeConfigObj, '332').split(',') || []; // TODO 可能会出错
const unExitManualProjects: string[] = (Reflect.get(judgeConfigObj, '332') || '').split(',');
//直线行驶中不进其他考试项目(0-否 1-是) //直线行驶中不进其他考试项目(0-否 1-是)
const param348: string = Reflect.get(judgeConfigObj, '348') || '0', const param348: string = Reflect.get(judgeConfigObj, '348') || '0',
//里程不够允许手工点靠边停车0-否 1-是) //里程不够允许手工点靠边停车0-否 1-是)