大车逻辑优化

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", "name": "default",
"material": { "material": {
"certpath": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.cer", "certpath": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.cer",
"storePassword": "0000001BE413F804F795E0CC5A4A0B989C4E25CFDE3A490ECD2436EB6420FE3E32A7E2A618CDD7EFE107B4", "storePassword": "0000001B43E7BAC298C9D809E58E3491F350FD3506C77562C891A237D54C5C4733DEC67E0EBD3F450975F0",
"keyAlias": "debugKey", "keyAlias": "debugKey",
"keyPassword": "0000001B851FA9FF8A74DB639E4377C4BE9AA21ACFA27C4A2A39651CFFA5B4EF1A536194D666331204C740", "keyPassword": "0000001B7F27FB3700AADDCB9A67C34A1F5CF3FF6D22B975EA6A9E0C532157D96C76F0B0378218C57462FC",
"profile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p7b", "profile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p7b",
"signAlg": "SHA256withECDSA", "signAlg": "SHA256withECDSA",
"storeFile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p12" "storeFile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p12"

View File

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

View File

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

View File

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

View File

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