大车逻辑优化

This commit is contained in:
lixiao 2025-03-26 16:55:19 +08:00
parent 4fe0bc1361
commit e41ba0b0d0
5 changed files with 67 additions and 148 deletions

View File

@ -5,9 +5,9 @@
"name": "default",
"material": {
"certpath": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.cer",
"storePassword": "0000001BE413F804F795E0CC5A4A0B989C4E25CFDE3A490ECD2436EB6420FE3E32A7E2A618CDD7EFE107B4",
"storePassword": "0000001B43E7BAC298C9D809E58E3491F350FD3506C77562C891A237D54C5C4733DEC67E0EBD3F450975F0",
"keyAlias": "debugKey",
"keyPassword": "0000001B851FA9FF8A74DB639E4377C4BE9AA21ACFA27C4A2A39651CFFA5B4EF1A536194D666331204C740",
"keyPassword": "0000001B7F27FB3700AADDCB9A67C34A1F5CF3FF6D22B975EA6A9E0C532157D96C76F0B0378218C57462FC",
"profile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p12"

View File

@ -62,7 +62,7 @@ struct Index {
//初始化数据库表
await this.initDb()
//断点续考
if(this.mode == 2) {
if (this.mode == 2) {
await this.goDdxkItems()
}
//初始化评判
@ -94,11 +94,6 @@ struct Index {
if (examSubject == 3) {
await this.initMapPoint()
await this.initMapPointItem()
//定时上传考试里程
// let mileageTimer = setInterval(()=>{
// this.uploadMileage()
// },5000)
// this.mileageTimer = mileageTimer
}
}
@ -250,11 +245,10 @@ struct Index {
//初始化systemParam表
async initSystemParam(sysParam?: SYSTEMPARMARR[]) {
const systemParms: SYSTEMPARMARR[] = sysParam || (await getSyncData('MA_SYSTEMPARM')) as SYSTEMPARMARR[]
console.info('surenjun => systemParms', JSON.stringify(systemParms));
let currentParams: any = router.getParams();
const {carName,carType,examSubject} = this;
if(this.mode === 2) {
if (this.mode === 2) {
this.totalScore = Number(currentParams.score) || this.totalScore
}
//小车车型列表
@ -292,7 +286,6 @@ struct Index {
//根据车型获取应行驶里程数
if (no1 == 3 && no3 == 15 && Number(carNo) == no2) {
let mileage = (decodeURI(systemParm.txt1) || '').split('^')
console.log("lixiao",decodeURI(systemParm.txt1))
if (this.mode === 1) {
this.examMileage = mileage[1]
} else if (this.mode === 2) {
@ -306,17 +299,14 @@ struct Index {
this.examMileage = data[0] || this.examMileage
this.mfxxn = data[1] !== "1"
}
let ykItems = []
//获取当前考车的考试项目
if (this.mode === 2) {
if (carNo !== '' && no1 == 3 && no2 == Number(carNo) && no3 == 46) {
allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '')
}
} else {
if (carNo !== '' && no1 == 3 && no2 == Number(carNo) && no3 == 10) {
allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '')
}
if (this.mode === 2 && no1 == 3 && no2 == Number(carNo) && no3 == 46) {
// 夜考必考项目读取
allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '')
} else if (this.mode !== 2 && no1 == 3 && no2 == Number(carNo) && no3 == 10) {
allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '')
}
if (no1 == 6) {
const name = decodeURI(systemParm.txt1)
if (this.mode !== 2 && name === '夜间行驶') {
@ -326,6 +316,7 @@ struct Index {
return
}
let isRequired = allItems.includes(no2 + '')
console.log("lixiao allItems", no2, JSON.stringify(allItems))
if (no2 == 14) {
isRequired = false
}
@ -337,7 +328,6 @@ struct Index {
abbreviation: decodeURI(systemParm.txt3),
projectCode: no2 + '',
projectCodeCenter: txt2,
// 是否是必考 加减档设置成非必考
// 白考夜间行驶非必考
isRequired,
//是否考过了
@ -345,25 +335,27 @@ struct Index {
//项目开始数据是否上传过
isUpload: !(this.mode === 2 && no2 == 13 && this.kssycs != '1'),
}
this.projectsObj[no2*1] = currentProject
if (this.mode === 2) {
let type: '2' | '3' = (no2 == 13 && this.kssycs != '1') ? '2' : '3'
this.projectsObj[no2*1].type = type
let type: '1' | '2' | '3'
if (no2 == 13) {
type = '2'
} else {
type = isRequired ? '1' : '3'
}
currentProject.ykType = type
}
this.projectsObj[no2*1] = currentProject
this.projectsCenterObj[txt2] = currentProject
this.projects.push(currentProject);
//真实监管下发考试项目
if (isInExam && !(kStringArr.includes(txt2) || kStringArr.includes(no2 + ''))) {
console.info('surenjun =>', txt2)
console.info('surenjun => no2', no2)
this.projectsObj[no2*1].type = '3'
this.projectsObj[no2*1].isUpload = true
this.projectsObj[no2*1].isEnd = true
this.projectsCenterObj[txt2].type = '3'
this.projectsCenterObj[txt2].isUpload = true
this.projectsCenterObj[txt2].isEnd = true
// this.isDdxk = true
this.ddxkKsxmArr.push(txt2)
}
}
@ -378,8 +370,6 @@ struct Index {
})
})
const projects = this.projects;
console.info('surenjun', JSON.stringify(this.ddxkKsxmArr))
if (!projects.length) {
Prompt.showToast({
message: '读取数据库信息失败,请重新联网更新!',
@ -451,17 +441,11 @@ struct Index {
// 夜考扣分
async goDdxkItems() {
let currentParams: any = router.getParams();
if(!currentParams?.examItems) {
if (!currentParams?.examItems) {
return
}
const examItems: string = currentParams?.examItems + "";
console.log("lixiao ddxkKfArr", JSON.stringify(examItems))
const ddxkKfArr = examItems?.split(",").filter(item => item)
console.log("lixiao ddxkKfArr", JSON.stringify(ddxkKfArr))
console.log("lixiao ddxkKfArr", JSON.stringify(this.manualMarkRules))
console.log("lixiao ddxkKfArr", JSON.stringify(this.markRuleListObj))
ddxkKfArr.forEach((kf) => {
let xmdm = '';
let kfdm = ''
@ -700,118 +684,64 @@ struct Index {
.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 }) {
Column() {
Flex({
wrap: FlexWrap.Wrap,
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween
}) {
List({}) {
ForEach(chunkArr(this.projects, 2), (item) => {
ForEach(this.projects, (project) => {
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() {
//#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(project.name) {
}
}
});
}
.fontColor(this.getProjectColor(this.projectsObj[project.projectCode]))
.margin({ bottom: 2 })
.fontSize(24)
}.margin({ bottom: 2 })
})
}.lanes(2).margin({ left: 25 })
}
.backgroundImage($rawfile('judge/project_bg.png'), ImageRepeat.NoRepeat)
.width('100%')
.height('57%')
.backgroundImage($rawfile('judge/project_km3_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width('57%')
.height('100%')
.padding(30)
.margin({ right: 10 })
}
//科目三
if (this.examSubject == 3) {
Column() {
.margin({ right: 5 })
if (this.projects.length) {
Flex({
wrap: FlexWrap.Wrap,
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween
justifyContent: FlexAlign.SpaceAround
}) {
List({}) {
ForEach(this.projects, (project) => {
List() {
ForEach(this.artSubject3Projects, (item, index) => {
ListItem() {
Text(project.name) {
}
.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type))
.margin({ bottom: 2 })
.fontSize(24)
}.margin({ bottom: 2 })
})
}.lanes(2).margin({ left: 25 })
}
.width('100%')
.height('57%')
.backgroundImage($rawfile('judge/project_km3_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.padding(30)
.margin({ right: 5 })
if (this.projects.length) {
Flex({
wrap: FlexWrap.Wrap,
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceAround
}) {
List() {
ForEach(this.artSubject3Projects, (item, index) => {
ListItem() {
}
.backgroundImage(
$rawfile(
`judge/km3/${this.getIsExitManualProject(index) ? (this.getIsEndManualProject(index)) : (item + '_gray')}.png`
), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(174)
.height(118 * 0.95)
.margin({ bottom: 8 })
.onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
this.setManualProjectFn(index)
})
}
.backgroundImage(
$rawfile(
`judge/km3/${this.getIsExitManualProject(index) ? (this.getIsEndManualProject(index)) : (item + '_gray')}.png`
), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(174)
.height(118 * 0.95)
.margin({ bottom: 8 })
.onClick(() => {
this.setManualProjectFn(index)
})
}.lanes(3).margin({ left: 5, top: 12 })
}
})
}.lanes(3).margin({ left: 5, top: 12 })
}
}
.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 })
}.height('100%').alignItems(HorizontalAlign.Start)
@ -829,10 +759,6 @@ struct Index {
.alignItems(VerticalAlign.Center)
.border({ width: 5, color: '#4D4136', radius: 30 })
.onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
this.signDisplayComVisible = true
})
@ -868,10 +794,6 @@ struct Index {
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 10 })
.onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
this.isDeductedPopShow = true
})
}
@ -1076,7 +998,8 @@ struct Index {
.height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start)
}
getProjectColor(type: string) {
getProjectColor(project: Project) {
let type = (this.mode === 2 ? project.ykType : project.type)
switch (type) {
case '1':
return '#E6DECF';

View File

@ -455,19 +455,14 @@ struct UserInfo {
carNo = item.no2 + ''
}
if (item.no1 == 3 && item.no3 == 20 && carNo == item.no2) {
console.log("lixiao", JSON.stringify(item), carNo, nightTime)
nightTime = decodeURIComponent(item.txt1) || nightTime
}
// if (carNo) {
// console.log("lixiao", JSON.stringify(item), carNo, nightTime)
// }
})
let now = new Date(await systemDateTime.getCurrentTime())
let hour = now.getHours()
let minute = now.getMinutes()
let t_hour = Number(nightTime.split(":")[0])
let t_minute = Number(nightTime.split(":")[1])
console.log("lixiao nightTime", hour, minute, t_hour, t_minute)
if (kStringArr.length === 0) {
if (hour > t_hour || (hour === t_hour && minute >= t_minute)) {
this.mode = 2

View File

@ -9,6 +9,7 @@ export interface Project {
abbreviation?: string
//项目状态:未做 正在做 及格 不及格 有扣分
type?: '1' | '2' | '3' | '4' | '5'
ykType?: '1' | '2' | '3' | '4' | '5'
//
isEnd: boolean,
isUpload: boolean

View File

@ -772,7 +772,7 @@ export default class Judge {
ksyy: '',
kscx: carType,
kkcs: Number(kssycs) || 2,
sfyk,
sfyk: 1,
ykkkcs: 1,
wayno: judgeUI.wayno * 1,
czlx: 0,