fix: 评判版本修改

This commit is contained in:
wangzhongjie 2025-10-30 15:59:57 +08:00
parent 86cf3f58d3
commit a7c85152a4
10 changed files with 76 additions and 61 deletions

View File

@ -53,38 +53,38 @@ export default class EntryAbility extends UIAbility {
async onWindowStageCreate(windowStage: window.WindowStage) {
console.log(EntryTag, "onWindowStageCreate", "窗口创建完成")
await UseAuth(this.context)
const windowClass = await windowStage.getMainWindow();
let rect = windowClass.getWindowProperties().windowRect
let width = rect.width
let height = rect.height
AppStorage.setOrCreate<CarInfoType>('carInfo', {})
AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {})
AppStorage.setOrCreate<string>('lsh', '0000000000000')
AppStorage.setOrCreate<string>('statue', "1") //考试状态
AppStorage.setOrCreate<number>('signNum', 0) //心跳指令编号
AppStorage.setOrCreate<string>('deviceNo', "") //设备号
AppStorage.setOrCreate<BaseInfoType>('baseInfo', {
hasAuth: false,
version: GlobalConfig.version.sz.km2[0] || "",
judgeVersion: GlobalConfig.version.sz.km2[1] || "",
tcpSendNum: 0,
videoVersion: '1.0',
ratio: width / height, //适配比例
pathDir: this.context.filesDir,
context: this.context,
isJudgeInitBool: false,
})
AppStorage.setOrCreate('isJudgeInitBool', false)
try {
await UseAuth(this.context)
const windowClass = await windowStage.getMainWindow();
AppStorage.setOrCreate<CarInfoType>('carInfo', {})
AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {})
AppStorage.setOrCreate<string>('lsh', '0000000000000')
AppStorage.setOrCreate<string>('statue', "1") //考试状态
AppStorage.setOrCreate<number>('signNum', 0) //心跳指令编号
AppStorage.setOrCreate<string>('deviceNo', "") //设备号
AppStorage.setOrCreate<BaseInfoType>('baseInfo', {
hasAuth: false,
// version: GlobalConfig.version.sz.km2[0] || "",
// judgeVersion: GlobalConfig.version.sz.km2[1] || "",
tcpSendNum: 0,
videoVersion: '1.0',
pathDir: this.context.filesDir,
context: this.context,
isJudgeInitBool: false,
})
AppStorage.setOrCreate('isJudgeInitBool', false)
const data = await ReadFileContent(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt')
if (data !== '' && data !== undefined) {
const config: EnvironmentConfigurationType = JSON.parse(data)
await windowClass.setWindowLayoutFullScreen(true)
console.log("是否调试模式", config?.isOpenDebugger)
if (config?.isOpenDebugger === "0") {
await windowClass.setWindowSystemBarEnable([]) //全屏
const data = await ReadFileContent(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt')
if (data !== '' && data !== undefined) {
const config: EnvironmentConfigurationType = JSON.parse(data)
await windowClass.setWindowLayoutFullScreen(true)
console.log("是否调试模式", config?.isOpenDebugger)
if (config?.isOpenDebugger === "0") {
await windowClass.setWindowSystemBarEnable([]) //全屏
}
}
} catch (e) {
console.error("onWindowStageCreate error", e)
}
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {

View File

@ -79,8 +79,9 @@ export interface CommonType {
// 基础信息
export interface BaseInfoType {
hasAuth?: boolean,
version?: string,
judgeVersion?: string,
// version?: string,
// judgeVersion?: string,
tcpSendNum?: number,
videoVersion?: string,
ratio?: number,

View File

@ -3,7 +3,7 @@ import router from '@ohos.router';
import { HomeTag, InitTableTag, JudgeConfig } from '../config';
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { BaseInfoType } from '../model/Common';
import { BaseInfoType, EnvironmentConfigurationType } from '../model/Common';
import {
CarInfoType,
ES_CARINFOType,
@ -37,7 +37,6 @@ struct Index {
@State deviceId: string = '';
@State angle: number = 0
@State dialogRatio: number = 0.8
@State ratio: number = 1700 / 960
@State delLoading: boolean = false
@State initParamFlag: boolean = false
@State fd: number = -1;
@ -47,6 +46,7 @@ struct Index {
@State initWork: boolean = false
@State status: string = "开始"
@State base64Img: string = ""
@State config: EnvironmentConfigurationType = {}
// 请求网络表等待弹窗
customDialogController: CustomDialogController = new CustomDialogController({
builder: CarLoadingComponent(),
@ -59,19 +59,10 @@ struct Index {
private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context)
private timeInfo: TimeSynchronizationRspBody = {}
@Styles
commStyle(){
.width(220 * this.ratio * this.dialogRatio)
.height(69 * this.ratio * this.dialogRatio)
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
}
async aboutToAppear() {
dConsole.log("权限首页 aboutToAppear")
const result = await GetSyncData<ES_CARINFOType>("ES_CARINFO")
dConsole.log(HomeTag, "读取carinfo", result)
this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4
this.angle = 0
AppStorage.set('lsh', '1111111111111')
JudgeEmitterInstance.init()
@ -93,6 +84,7 @@ struct Index {
this.isPlay = true
}
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')!
this.config = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')!
this.initParams()
AppStorage.setOrCreate('singlePlay', false)
@ -147,8 +139,8 @@ struct Index {
const param: InitializeTheCentralTableType = {
carId: this.carInfo?.carId,
examinationRoomId: this.carInfo?.examinationRoomId,
judgeVersion: this.baseInfo?.judgeVersion,
shellVersion: this.baseInfo?.version || "",
judgeVersion: this.config?.judgeVersion,
shellVersion: this.config?.version || "",
paraKdid: this.timeInfo?.paraKdid || this.timeInfo?.kdid,
kdid: this.timeInfo?.kdid || this.timeInfo?.paraKdid,
mode: this.timeInfo?.mode,
@ -255,8 +247,8 @@ struct Index {
})
BottomMessageComponent({
version: this.baseInfo.version,
judgeVersion: this.baseInfo.judgeVersion,
version: this.config.version,
judgeVersion: this.config.judgeVersion,
hasAuth: this.baseInfo.hasAuth,
examCarNumber: this.deviceId,
versionClick: () => {

View File

@ -3,9 +3,9 @@ import { GlobalConfig, HomeTag } from '../../config';
import Prompt from '@system.prompt';
import {
ApiResponseType,
BaseInfoType,
CarConfigurationParamsType,
CarInfoType,
EnvironmentConfigurationType,
ObtainCarExamInfoParams,
ObtainCarExamInfoRspBody,
TimeSynchronizationParams,
@ -73,12 +73,12 @@ export async function GetCarInfo(): Promise<CarInfoType> {
//获取时间同步
export async function SetCurrentTime(): Promise<void> {
let deviceNo: string = AppStorage.get<string>('deviceNo')!;
let baseInfo: BaseInfoType = AppStorage.get<BaseInfoType>('baseInfo')!
let config: EnvironmentConfigurationType = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')!
let params: TimeSynchronizationParams = {
time: dayTs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
deviceNo,
version: baseInfo.version!,
judgeVersion: baseInfo.judgeVersion!
version: config.version!,
judgeVersion: config.judgeVersion!
}
let res: ApiResponseType = await timeSynchronization(params);
if (res.timeSynchronizationRsp?.body) {

View File

@ -692,6 +692,8 @@ export struct JudgePage {
// 操作区域,分数显示区域
OperatingAreaComponent({
kfArr: this.kfArr,
isAllProjectsEnd: this.isAllProjectsEnd,
totalScore: this.totalScore,
kszp: this.kszp,
examSubject: this.examSubject,

View File

@ -1,9 +1,9 @@
import { JudgeConfig, JudgeTag } from '../../config';
import {
BaseInfoType,
CAR_INFO,
CarInfoType,
CDSBInfo,
EnvironmentConfigurationType,
ExaminerInfoType,
ItemInfo,
ItemInfos,
@ -431,7 +431,7 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl {
})
const initInfo: JudgeInitObj = {
sdkver: await examJudgeVersion(),
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "",
appver: AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfigurationType')?.version || "",
kskm: Number(carInfo?.examSubject || "2"),
kchp: carInfo?.plateNo || "",
kchm: Number(carInfo?.carId || ""),

View File

@ -1,9 +1,9 @@
import { JudgeConfig, JudgeTag } from '../../config';
import {
BaseInfoType,
CAR_INFO,
CarInfoType,
CDSBInfo,
EnvironmentConfigurationType,
ExaminerInfoType,
ItemInfo,
ItemInfos,
@ -129,7 +129,7 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl {
const mark: MarkRule[] = Object.values(markRuleListObj)
const initInfo: JudgeInitObj = {
sdkver: await examJudgeVersion(),
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "",
appver: AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfigurationType')?.version || "",
kskm: Number(carInfo?.examSubject || "2"),
kchp: carInfo?.plateNo || "",
kchm: Number(carInfo?.carId || ""),

View File

@ -1,4 +1,4 @@
import { DefaultJudgeConfigObj } from '../../../model/index'
import { DefaultJudgeConfigObj, MarkRule } from '../../../model/index'
import Prompt from '@system.prompt'
@Component
@ -8,6 +8,8 @@ export default struct OperatingAreaComponent {
@Prop examSubject: string
@Prop singlePlay: boolean
@Prop judgeConfigObj: DefaultJudgeConfigObj
@Prop kfArr: MarkRule[]
@Prop isAllProjectsEnd: boolean
// 信号查看
signalViewingClick: () => void = () => {
}
@ -112,6 +114,14 @@ export default struct OperatingAreaComponent {
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => {
//考试未结束且有扣分,不允许退出
if (!this.singlePlay && Reflect.get(this.judgeConfigObj, '344') == "1" && this.kfArr.length > 0 && !this.isAllProjectsEnd) {
Prompt.showToast({
message: '考试未结束且有扣分,不允许手动退出!',
duration: 4000
});
return
}
if (Reflect.get(this.judgeConfigObj, '353') == '0') {
// this.endExamDialogController.open()
this.endTheExamClick()

View File

@ -1,5 +1,5 @@
import router from '@ohos.router'
import { BaseInfoType, CarInfoType } from '../model/Common'
import { BaseInfoType, CarInfoType, EnvironmentConfigurationType } from '../model/Common'
import HeaderComponent from './compontents/Header'
import BottomMessageComponent from './Index/BottomMessage'
@ -10,10 +10,12 @@ struct SettingPage {
@State url: string = ''
@State baseInfo: BaseInfoType = {}
@State carInfo: CarInfoType = {}
@State config: EnvironmentConfigurationType = {}
aboutToAppear() {
this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')!
this.config = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')!
}
build() {
@ -49,8 +51,8 @@ struct SettingPage {
Column() {
BottomMessageComponent({
version: this.baseInfo.version,
judgeVersion: this.baseInfo.judgeVersion,
version: this.config.version,
judgeVersion: this.config.judgeVersion,
hasAuth: this.baseInfo.hasAuth,
examCarNumber: this.carInfo.carNo,
})

View File

@ -13,7 +13,10 @@ import { OverWriteFile, ReadFileContent } from '../utils/Common';
@Entry
@Component
struct TerminalInfoPage {
@State config: EnvironmentConfigurationType = {}
@State config: EnvironmentConfigurationType = {
version: "2024.08.21.01",
judgeVersion: "2024.08.1"
}
@State isProcessing: boolean = false;
@State IpConfigFilePath: string = GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'
private context = getContext(this) as common.UIAbilityContext;
@ -23,9 +26,14 @@ struct TerminalInfoPage {
dConsole.log(TerminalInfoTag, "data", data)
if (data) {
this.config = JSON.parse(data)
if (!this.config.version) {
this.config.version = "2024.08.21.01"
}
if (!this.config.judgeVersion) {
this.config.judgeVersion = "2024.08.1"
}
AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config)
}
}
async aboutToDisappear() {