逻辑优化
This commit is contained in:
		
							parent
							
								
									e35bf0f309
								
							
						
					
					
						commit
						b446c9442a
					
				
										
											Binary file not shown.
										
									
								
							| @ -24,7 +24,7 @@ import { examJudgeVersion } from './judgeSDK/api'; | |||||||
| @Component | @Component | ||||||
| struct Index { | struct Index { | ||||||
|   @State carNum: string = '' |   @State carNum: string = '' | ||||||
|   @State version: string = '2025.05.13.01' |   @State version: string = judgeConfig.version | ||||||
|   @State judgeVersion: string = '' |   @State judgeVersion: string = '' | ||||||
|   @State url: string = '' |   @State url: string = '' | ||||||
|   @State hasAuth: boolean = false; |   @State hasAuth: boolean = false; | ||||||
| @ -63,282 +63,6 @@ struct Index { | |||||||
|     .height(69 * this.ratio * this.dialogRatio) |     .height(69 * this.ratio * this.dialogRatio) | ||||||
|     .backgroundImage($r('app.media.button_nor')) |     .backgroundImage($r('app.media.button_nor')) | ||||||
|     .backgroundImageSize({ width: '100%', height: '100%' }) |     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|     // .margin({ bottom: 12 * this.ratio }) |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   build() { |  | ||||||
|     Column() { |  | ||||||
|       Column() { |  | ||||||
|         Row() { |  | ||||||
|           Image($r('app.media.logo')).width('30%').height('5.5%').margin({ left: 24 }) |  | ||||||
|           Row() { |  | ||||||
|             Image($r('app.media.btn_setting')).width('16.7%').height('12.2%') |  | ||||||
|               .onClick(async () => { |  | ||||||
|                 if (this.loading) { |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 router.pushUrl({ |  | ||||||
|                   url: 'pages/Settings', |  | ||||||
|                 }, router.RouterMode.Single); |  | ||||||
|               }) |  | ||||||
|             Image($r('app.media.btn_back')).width('14.4%').height('12.2%') |  | ||||||
|               .onClick(() => { |  | ||||||
|                 this.dialogVisiable = true |  | ||||||
|               }) |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         .width('100%') |  | ||||||
|         .justifyContent(FlexAlign.SpaceBetween) |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       Column() { |  | ||||||
|         Row() { |  | ||||||
|           if (!this.isSingle) { |  | ||||||
|             imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') }) |  | ||||||
|               .margin({ left: 80 * globalThis.ratio }) |  | ||||||
|               .onClick(async () => { |  | ||||||
|                 // this.vocObj.playAudio({ |  | ||||||
|                 //   type: 1, |  | ||||||
|                 //   name: 'button_media.wav' |  | ||||||
|                 // }) |  | ||||||
|                 // ||!this.initParamFlag |  | ||||||
|                 if (this.loading) { |  | ||||||
|                   // globalThis.title = '正在初始化,请等待5s后重试' |  | ||||||
|                   // this.errorDialog.open() |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 setTimeout(() => { |  | ||||||
|                   this.angle = 360 |  | ||||||
|                 }, 1000) |  | ||||||
|                 this.angle = 0 |  | ||||||
|                 if (!globalThis.timeInfo) { |  | ||||||
|                   globalThis.type = '1' |  | ||||||
|                   globalThis.title = '时间同步接口连接失败' |  | ||||||
|                   this.errorDialog.open() |  | ||||||
|                   promptAction.showToast({ |  | ||||||
|                     message: `时间同步接口连接失败`, |  | ||||||
|                     duration: 3000 |  | ||||||
|                   }); |  | ||||||
|                   this.loading = false |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 if (!globalThis.carInfo) { |  | ||||||
|                   promptAction.showToast({ |  | ||||||
|                     message: `车辆信息接口获取失败`, |  | ||||||
|                     duration: 3000 |  | ||||||
|                   }); |  | ||||||
|                   globalThis.type = '1' |  | ||||||
|                   globalThis.title = '车辆信息接口获取失败' |  | ||||||
|                   this.errorDialog.open() |  | ||||||
|                   this.loading = false |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 this.testXMLToJSONInWorker() |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|               }) |  | ||||||
|           } |  | ||||||
|           if (this.isSingle) { |  | ||||||
|             imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') }) |  | ||||||
|               .margin({ left: 80 * globalThis.ratio }) |  | ||||||
|               .onClick(() => { |  | ||||||
|                 if (this.loading) { |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 // this.vocObj.playAudio({ |  | ||||||
|                 //   type: 1, |  | ||||||
|                 //   name: 'button_media.wav' |  | ||||||
|                 // }) |  | ||||||
|                 if (judgeConfig.isTrajectoryOpen) { |  | ||||||
|                   router.pushUrl({ |  | ||||||
|                     url: 'pages/UserInfo', |  | ||||||
|                   }, router.RouterMode.Single) |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 //判断数据库是否有表数据,有则直接跳转,没有则读取本地数据 |  | ||||||
|                 getSyncData('MA_SYSSET').then(data => { |  | ||||||
|                   console.log('datadata', JSON.stringify(data)) |  | ||||||
|                   if (data?.[0]) { |  | ||||||
|                     router.pushUrl({ |  | ||||||
|                       url: 'pages/UserInfo', |  | ||||||
|                     }, router.RouterMode.Single) |  | ||||||
|                   } else { |  | ||||||
|                     this.testXMLToJSONInWorker() |  | ||||||
|                   } |  | ||||||
|                 }); |  | ||||||
|               }) |  | ||||||
|           } |  | ||||||
|           imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_zj') }) |  | ||||||
|             .margin({ right: 80 * globalThis.ratio }) |  | ||||||
|             .onClick(() => { |  | ||||||
|               if (this.loading) { |  | ||||||
|                 return |  | ||||||
|               } |  | ||||||
|               // this.vocObj.playAudio({ |  | ||||||
|               //   type: 1, |  | ||||||
|               //   name: 'button_media.wav' |  | ||||||
|               // }) |  | ||||||
|               router.pushUrl({ |  | ||||||
|                 url: 'pages/CarCheck' |  | ||||||
|               }, router.RouterMode.Single); |  | ||||||
|             }) |  | ||||||
|         } |  | ||||||
|         .width('100%') |  | ||||||
|         .justifyContent(FlexAlign.SpaceAround) |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       Column() { |  | ||||||
|         Row() { |  | ||||||
|           Column() { |  | ||||||
|             Text('V外壳:' + this.version) |  | ||||||
|               .fontColor('#CCAE7A') |  | ||||||
|               .fontSize(18 * globalThis.ratio) |  | ||||||
|               .width('30%') |  | ||||||
|               .margin({ bottom: 10 }) |  | ||||||
|             Text('V评判:' + this.judgeVersion) |  | ||||||
|               .fontColor('#CCAE7A') |  | ||||||
|               .fontSize(18 * globalThis.ratio) |  | ||||||
|               .width('30%') |  | ||||||
|               .margin({ bottom: 10 }) |  | ||||||
|             // Text('V 1.0') |  | ||||||
|             //   .fontColor('#CCAE7A') |  | ||||||
|             //   .fontSize(22 * globalThis.ratio) |  | ||||||
|             //   .width('30%') |  | ||||||
|             //   .margin({ bottom: 10 }) |  | ||||||
|             Text('授权信息:' + (this.hasAuth ? '已授权' : '未授权')) |  | ||||||
|               .fontColor('#CCAE7A') |  | ||||||
|               .fontSize(18 * globalThis.ratio) |  | ||||||
|               .width('30%') |  | ||||||
|           } |  | ||||||
|           .margin({ left: 24 }) |  | ||||||
|           .gesture( |  | ||||||
|             GestureGroup(GestureMode.Exclusive, |  | ||||||
|               TapGesture({ count: 2 }) |  | ||||||
|                 .onAction(() => { |  | ||||||
|                   // takePhotoFn(this.context) |  | ||||||
| 
 |  | ||||||
|                   globalThis.singlePlay = !globalThis.singlePlay |  | ||||||
|                   this.isSingle = globalThis.singlePlay |  | ||||||
|                 }) |  | ||||||
|             ) |  | ||||||
|           ) |  | ||||||
| 
 |  | ||||||
|           Text('考车号:' + this.deviceId) |  | ||||||
|             .fontColor('#CCAE7A') |  | ||||||
|             .fontSize(22 * globalThis.ratio) |  | ||||||
|             .margin({ right: 24 }) |  | ||||||
|         } |  | ||||||
|         .width('100%') |  | ||||||
|         .justifyContent(FlexAlign.SpaceBetween) |  | ||||||
|         .margin({ bottom: 10 }) |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       // |  | ||||||
|       if (this.dialogVisiable) { |  | ||||||
|         Flex({ justifyContent: FlexAlign.Center }) { |  | ||||||
|           Text('确认是否退出应用') |  | ||||||
|             .fontSize(28 * this.ratio * this.dialogRatio) |  | ||||||
|             .margin({ top: 100 * this.ratio * this.dialogRatio }) |  | ||||||
|           Row() { |  | ||||||
|             Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { |  | ||||||
|               Text('  取   消  ') |  | ||||||
|                 .fontSize(24 * this.ratio * this.dialogRatio) |  | ||||||
|                 .fontColor('#fff') |  | ||||||
|                 .width(100 * this.ratio * this.dialogRatio) |  | ||||||
|             } |  | ||||||
|             .commStyle() |  | ||||||
|             .onClick(() => { |  | ||||||
|               this.dialogVisiable = false |  | ||||||
|               // this.vocObj.playAudio({ |  | ||||||
|               //   type: 1, |  | ||||||
|               //   name: 'button_media.wav' |  | ||||||
|               // }) |  | ||||||
|             }).margin({ right: 10 * this.ratio }) |  | ||||||
| 
 |  | ||||||
|             Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { |  | ||||||
|               Text('  确   定  ') |  | ||||||
|                 .fontSize(24 * this.ratio * this.dialogRatio) |  | ||||||
|                 .fontColor('#fff') |  | ||||||
|                 .width(100 * this.ratio * this.dialogRatio) |  | ||||||
|             } |  | ||||||
|             .commStyle() |  | ||||||
|             .onClick(() => { |  | ||||||
|               this.context.terminateSelf() |  | ||||||
|             }) |  | ||||||
|           }.position({ y: 265 * this.ratio * this.dialogRatio, x: 115 * this.ratio * this.dialogRatio }) |  | ||||||
| 
 |  | ||||||
|         } |  | ||||||
|         .width(660 * this.ratio * this.dialogRatio) |  | ||||||
|         .height(360 * this.ratio * this.dialogRatio) |  | ||||||
|         .position({ x: 220 * this.ratio, y: 98 * this.ratio - 265 / 2 * (1 - this.ratio * this.dialogRatio) }) |  | ||||||
|         .backgroundColor('#E6E3DF') |  | ||||||
|         .borderRadius(19 * this.ratio * this.dialogRatio) |  | ||||||
|       } |  | ||||||
|       if (this.delLoading) { |  | ||||||
|         Column() { |  | ||||||
|           Image($r('app.media.open_loading')) |  | ||||||
|             .width(200 * globalThis.ratio) |  | ||||||
|             .rotate({ angle: this.angle }) |  | ||||||
|             .height(200 * globalThis.ratio) |  | ||||||
|             .animation({ |  | ||||||
|               duration: 5000, // 动画时长 |  | ||||||
|               curve: Curve.EaseOut, // 动画曲线 |  | ||||||
|               delay: 500, // 动画延迟 |  | ||||||
|               iterations: -1, // 播放次数 |  | ||||||
|               playMode: PlayMode.Normal, // 动画模式 |  | ||||||
|             }) |  | ||||||
|             .margin({ top: 30 * globalThis.ratio }) |  | ||||||
| 
 |  | ||||||
|           Text('正在清理本地数据,请稍候……') |  | ||||||
|             .fontSize(24 * globalThis.ratio) |  | ||||||
|             .margin({ top: 20 * globalThis.ratio }) |  | ||||||
|             .fontWeight(400) |  | ||||||
|         } |  | ||||||
|         .visibility(this.delLoading ? Visibility.Visible : Visibility.Hidden) |  | ||||||
|         .width(660 * globalThis.ratio) |  | ||||||
|         .height(360 * globalThis.ratio) |  | ||||||
|         .position({ x: 150 * globalThis.ratio, y: 98 * globalThis.ratio }) |  | ||||||
|         .backgroundColor('#E6E3DF') |  | ||||||
|         .borderRadius(19 * globalThis.ratio) |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       if (this.loading) { |  | ||||||
|         Column() { |  | ||||||
|           Image($r('app.media.open_loading')) |  | ||||||
|             .width(200 * globalThis.ratio) |  | ||||||
|             .rotate({ angle: this.angle }) |  | ||||||
|             .height(200 * globalThis.ratio) |  | ||||||
|             .animation({ |  | ||||||
|               duration: 5000, // 动画时长 |  | ||||||
|               curve: Curve.EaseOut, // 动画曲线 |  | ||||||
|               delay: 500, // 动画延迟 |  | ||||||
|               iterations: -1, // 播放次数 |  | ||||||
|               playMode: PlayMode.Normal, // 动画模式 |  | ||||||
|             }) |  | ||||||
|             .margin({ top: 30 * globalThis.ratio }) |  | ||||||
|           Image($r('app.media.car')) |  | ||||||
|             .width(80 * globalThis.ratio) |  | ||||||
|             .height(80 * globalThis.ratio) |  | ||||||
|             .position({ x: 288 * globalThis.ratio, y: 89 * globalThis.ratio }) |  | ||||||
|           Text('获取考车信息,请稍候……') |  | ||||||
|             .fontSize(24 * globalThis.ratio) |  | ||||||
|             .margin({ top: 20 * globalThis.ratio }) |  | ||||||
|             .fontWeight(400) |  | ||||||
|         } |  | ||||||
|         .visibility(this.loading ? Visibility.Visible : Visibility.Hidden) |  | ||||||
|         .width(660 * globalThis.ratio) |  | ||||||
|         .height(360 * globalThis.ratio) |  | ||||||
|         .position({ x: 150 * globalThis.ratio, y: 98 * globalThis.ratio }) |  | ||||||
|         .backgroundColor('#E6E3DF') |  | ||||||
|         .borderRadius(19 * globalThis.ratio) |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     .width('100%') |  | ||||||
|     .height('100%') |  | ||||||
|     .justifyContent(FlexAlign.SpaceBetween) |  | ||||||
|     .backgroundImagePosition({ x: 0, y: 0 }) |  | ||||||
|     .backgroundImage($r('app.media.index_bg')) |  | ||||||
|     .backgroundImageSize({ width: '100%', height: '100%' }) |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
| @ -352,36 +76,23 @@ struct Index { | |||||||
|     globalThis.lsh = '1111111111111' |     globalThis.lsh = '1111111111111' | ||||||
|     globalThis.errorDialog = this.errorDialog |     globalThis.errorDialog = this.errorDialog | ||||||
|     globalThis.udpEvent = new UdpEvent(); |     globalThis.udpEvent = new UdpEvent(); | ||||||
|     getSyncData('MA_SYSSET').then(async data => { |     getSyncData('MA_SYSSET').then(async (data: any[]) => { | ||||||
| 
 |  | ||||||
|       console.log('datadata', JSON.stringify(data)) |  | ||||||
|       // @ts-ignore |  | ||||||
| 
 |  | ||||||
|       // @ts-ignore |  | ||||||
|       data.forEach(async sys => { |       data.forEach(async sys => { | ||||||
|         //判断是否能点开始考试 |         //判断是否能点开始考试 | ||||||
|         if (sys.v_no === '305') { |         if (sys.v_no === '305') { | ||||||
|           console.log('syssyssyssys') |           console.log('syssyssyssys') | ||||||
|           // this.delLoading=true |  | ||||||
|           // globalThis.param854Str=sys.v_value |  | ||||||
|           delPic(Number(sys.v_value), 1) |           delPic(Number(sys.v_value), 1) | ||||||
|           delPic(Number(sys.v_value), 2) |           delPic(Number(sys.v_value), 2) | ||||||
|           // this.delLoading=false |  | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   aboutToDisappear() { |   async networkExam(isSingle: boolean = false) { | ||||||
|     // this.vocObj && this.vocObj.releasePlayer() |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   async testXMLToJSONInWorker() { |  | ||||||
|     if (this.loading) { |     if (this.loading) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     const param = { |     const param = { | ||||||
|       carId: globalThis.carInfo?.carId, |       carId: globalThis.carInfo?.carId, | ||||||
|       examinationRoomId: globalThis.carInfo?.examinationRoomId, |       examinationRoomId: globalThis.carInfo?.examinationRoomId, | ||||||
| @ -396,26 +107,21 @@ struct Index { | |||||||
|       singlePlay: globalThis.singlePlay |       singlePlay: globalThis.singlePlay | ||||||
|     } |     } | ||||||
|     this.loading = true |     this.loading = true | ||||||
|     console.log("sql 1111") |  | ||||||
| 
 |  | ||||||
|     getSingleCenterTable(param).then(async (ret) => { |     getSingleCenterTable(param).then(async (ret) => { | ||||||
|       if (ret) { |       if (ret) { | ||||||
|         const result = await getSyncData('ES_CARINFO') |         const result = await getSyncData('ES_CARINFO') | ||||||
|         const carInfo = result[0] || {}; |         const carInfo = result[0] || {}; | ||||||
|  |         // A2牵引车2号导航仪 | ||||||
|         if (carInfo.kscx == 'A2' && !globalThis.udpClientGps2) { |         if (carInfo.kscx == 'A2' && !globalThis.udpClientGps2) { | ||||||
|           // A2牵引车2号导航仪 |  | ||||||
|           await getUDPGps2(this.context, false) |           await getUDPGps2(this.context, false) | ||||||
|         } |         } | ||||||
|         getSyncData('MA_SYSSET').then(data => { |         getSyncData('MA_SYSSET').then((data: any[]) => { | ||||||
|           console.log('datadata', JSON.stringify(data)) |  | ||||||
|           // @ts-ignore |  | ||||||
|           data.forEach(sys => { |           data.forEach(sys => { | ||||||
|             //判断是否能点开始考试 |             //判断是否能点开始考试 | ||||||
|             if (sys.v_no === '854') { |             if (sys.v_no === '854') { | ||||||
|               globalThis.param854Str = sys.v_value |               globalThis.param854Str = sys.v_value | ||||||
|             } |             } | ||||||
|             if (sys.v_no === '824' && decodeURIComponent(sys.v_value) == '0') { |             if (sys.v_no === '824' && decodeURIComponent(sys.v_value) == '0') { | ||||||
|               // this.Param612Str= decodeURIComponent(sys.v_value) |  | ||||||
|               router.pushUrl({ |               router.pushUrl({ | ||||||
|                 url: 'pages/CarCheck', |                 url: 'pages/CarCheck', | ||||||
|                 params: { |                 params: { | ||||||
| @ -424,7 +130,7 @@ struct Index { | |||||||
|               }, router.RouterMode.Single) |               }, router.RouterMode.Single) | ||||||
|             } else { |             } else { | ||||||
|               router.pushUrl({ |               router.pushUrl({ | ||||||
|                 url: 'pages/ExaminerLogin', |                 url: isSingle ? 'pages/UserInfo' : 'pages/ExaminerLogin', | ||||||
|               }, router.RouterMode.Single) |               }, router.RouterMode.Single) | ||||||
|             } |             } | ||||||
|           }) |           }) | ||||||
| @ -573,4 +279,256 @@ struct Index { | |||||||
|     //下载模型 |     //下载模型 | ||||||
|     await getEsCarModel(context) |     await getEsCarModel(context) | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|  |   build() { | ||||||
|  |     Column() { | ||||||
|  |       Column() { | ||||||
|  |         Row() { | ||||||
|  |           Image($r('app.media.logo')).width('30%').height('5.5%').margin({ left: 24 }) | ||||||
|  |           Row() { | ||||||
|  |             Image($r('app.media.btn_setting')).width('16.7%').height('12.2%') | ||||||
|  |               .onClick(async () => { | ||||||
|  |                 if (this.loading) { | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 router.pushUrl({ | ||||||
|  |                   url: 'pages/Settings', | ||||||
|  |                 }, router.RouterMode.Single); | ||||||
|  |               }) | ||||||
|  |             Image($r('app.media.btn_back')).width('14.4%').height('12.2%') | ||||||
|  |               .onClick(() => { | ||||||
|  |                 this.dialogVisiable = true | ||||||
|  |               }) | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |         .width('100%') | ||||||
|  |         .justifyContent(FlexAlign.SpaceBetween) | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       Column() { | ||||||
|  |         Row() { | ||||||
|  |           if (!this.isSingle) { | ||||||
|  |             imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') }) | ||||||
|  |               .margin({ left: 80 * globalThis.ratio }) | ||||||
|  |               .onClick(async () => { | ||||||
|  |                 if (this.loading) { | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 setTimeout(() => { | ||||||
|  |                   this.angle = 360 | ||||||
|  |                 }, 1000) | ||||||
|  |                 this.angle = 0 | ||||||
|  |                 if (!globalThis.timeInfo) { | ||||||
|  |                   globalThis.type = '1' | ||||||
|  |                   globalThis.title = '时间同步接口连接失败' | ||||||
|  |                   this.errorDialog.open() | ||||||
|  |                   promptAction.showToast({ | ||||||
|  |                     message: `时间同步接口连接失败`, | ||||||
|  |                     duration: 3000 | ||||||
|  |                   }); | ||||||
|  |                   this.loading = false | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 if (!globalThis.carInfo) { | ||||||
|  |                   promptAction.showToast({ | ||||||
|  |                     message: `车辆信息接口获取失败`, | ||||||
|  |                     duration: 3000 | ||||||
|  |                   }); | ||||||
|  |                   globalThis.type = '1' | ||||||
|  |                   globalThis.title = '车辆信息接口获取失败' | ||||||
|  |                   this.errorDialog.open() | ||||||
|  |                   this.loading = false | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 this.networkExam() | ||||||
|  |               }) | ||||||
|  |           } | ||||||
|  |           if (this.isSingle) { | ||||||
|  |             imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') }) | ||||||
|  |               .margin({ left: 80 * globalThis.ratio }) | ||||||
|  |               .onClick(() => { | ||||||
|  |                 if (this.loading) { | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 if (judgeConfig.isTrajectoryOpen) { | ||||||
|  |                   router.pushUrl({ | ||||||
|  |                     url: 'pages/UserInfo', | ||||||
|  |                   }, router.RouterMode.Single) | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 //判断数据库是否有表数据,有则直接跳转,没有则读取本地数据 | ||||||
|  |                 getSyncData('MA_SYSSET').then(async (data) => { | ||||||
|  |                   if (data?.[0]) { | ||||||
|  |                     const result = await getSyncData('ES_CARINFO') | ||||||
|  |                     const carInfo = result[0] || {}; | ||||||
|  |                     if ((globalThis.isA1 && carInfo.kscx != "A1") || (globalThis.isA3 && carInfo.kscx != "A3")) { | ||||||
|  |                       this.networkExam(true) | ||||||
|  |                       return | ||||||
|  |                     } | ||||||
|  |                     router.pushUrl({ | ||||||
|  |                       url: 'pages/UserInfo', | ||||||
|  |                     }, router.RouterMode.Single) | ||||||
|  |                   } else { | ||||||
|  |                     this.networkExam(true) | ||||||
|  |                   } | ||||||
|  |                 }); | ||||||
|  |               }) | ||||||
|  |           } | ||||||
|  |           imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_zj') }) | ||||||
|  |             .margin({ right: 80 * globalThis.ratio }) | ||||||
|  |             .onClick(() => { | ||||||
|  |               if (this.loading) { | ||||||
|  |                 return | ||||||
|  |               } | ||||||
|  |               router.pushUrl({ | ||||||
|  |                 url: 'pages/CarCheck' | ||||||
|  |               }, router.RouterMode.Single); | ||||||
|  |             }) | ||||||
|  |         } | ||||||
|  |         .width('100%') | ||||||
|  |         .justifyContent(FlexAlign.SpaceAround) | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       Column() { | ||||||
|  |         Row() { | ||||||
|  |           Column() { | ||||||
|  |             Text('V外壳:' + this.version) | ||||||
|  |               .fontColor('#CCAE7A') | ||||||
|  |               .fontSize(18 * globalThis.ratio) | ||||||
|  |               .width('30%') | ||||||
|  |               .margin({ bottom: 10 }) | ||||||
|  |             Text('V评判:' + this.judgeVersion) | ||||||
|  |               .fontColor('#CCAE7A') | ||||||
|  |               .fontSize(18 * globalThis.ratio) | ||||||
|  |               .width('30%') | ||||||
|  |               .margin({ bottom: 10 }) | ||||||
|  |             Text('授权信息:' + (this.hasAuth ? '已授权' : '未授权')) | ||||||
|  |               .fontColor('#CCAE7A') | ||||||
|  |               .fontSize(18 * globalThis.ratio) | ||||||
|  |               .width('30%') | ||||||
|  |           } | ||||||
|  |           .margin({ left: 24 }) | ||||||
|  |           .gesture( | ||||||
|  |             GestureGroup(GestureMode.Exclusive, | ||||||
|  |               TapGesture({ count: 2 }) | ||||||
|  |                 .onAction(() => { | ||||||
|  |                   globalThis.singlePlay = !globalThis.singlePlay | ||||||
|  |                   this.isSingle = globalThis.singlePlay | ||||||
|  |                 }) | ||||||
|  |             ) | ||||||
|  |           ) | ||||||
|  | 
 | ||||||
|  |           Text('考车号:' + this.deviceId) | ||||||
|  |             .fontColor('#CCAE7A') | ||||||
|  |             .fontSize(22 * globalThis.ratio) | ||||||
|  |             .margin({ right: 24 }) | ||||||
|  |         } | ||||||
|  |         .width('100%') | ||||||
|  |         .justifyContent(FlexAlign.SpaceBetween) | ||||||
|  |         .margin({ bottom: 10 }) | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       // | ||||||
|  |       if (this.dialogVisiable) { | ||||||
|  |         Flex({ justifyContent: FlexAlign.Center }) { | ||||||
|  |           Text('确认是否退出应用') | ||||||
|  |             .fontSize(28 * this.ratio * this.dialogRatio) | ||||||
|  |             .margin({ top: 100 * this.ratio * this.dialogRatio }) | ||||||
|  |           Row() { | ||||||
|  |             Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { | ||||||
|  |               Text('  取   消  ') | ||||||
|  |                 .fontSize(24 * this.ratio * this.dialogRatio) | ||||||
|  |                 .fontColor('#fff') | ||||||
|  |                 .width(100 * this.ratio * this.dialogRatio) | ||||||
|  |             } | ||||||
|  |             .commStyle() | ||||||
|  |             .onClick(() => { | ||||||
|  |               this.dialogVisiable = false | ||||||
|  |             }).margin({ right: 10 * this.ratio }) | ||||||
|  | 
 | ||||||
|  |             Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { | ||||||
|  |               Text('  确   定  ') | ||||||
|  |                 .fontSize(24 * this.ratio * this.dialogRatio) | ||||||
|  |                 .fontColor('#fff') | ||||||
|  |                 .width(100 * this.ratio * this.dialogRatio) | ||||||
|  |             } | ||||||
|  |             .commStyle() | ||||||
|  |             .onClick(() => { | ||||||
|  |               this.context.terminateSelf() | ||||||
|  |             }) | ||||||
|  |           }.position({ y: 265 * this.ratio * this.dialogRatio, x: 115 * this.ratio * this.dialogRatio }) | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  |         .width(660 * this.ratio * this.dialogRatio) | ||||||
|  |         .height(360 * this.ratio * this.dialogRatio) | ||||||
|  |         .position({ x: 220 * this.ratio, y: 98 * this.ratio - 265 / 2 * (1 - this.ratio * this.dialogRatio) }) | ||||||
|  |         .backgroundColor('#E6E3DF') | ||||||
|  |         .borderRadius(19 * this.ratio * this.dialogRatio) | ||||||
|  |       } | ||||||
|  |       if (this.delLoading) { | ||||||
|  |         Column() { | ||||||
|  |           Image($r('app.media.open_loading')) | ||||||
|  |             .width(200 * globalThis.ratio) | ||||||
|  |             .rotate({ angle: this.angle }) | ||||||
|  |             .height(200 * globalThis.ratio) | ||||||
|  |             .animation({ | ||||||
|  |               duration: 5000, // 动画时长 | ||||||
|  |               curve: Curve.EaseOut, // 动画曲线 | ||||||
|  |               delay: 500, // 动画延迟 | ||||||
|  |               iterations: -1, // 播放次数 | ||||||
|  |               playMode: PlayMode.Normal, // 动画模式 | ||||||
|  |             }) | ||||||
|  |             .margin({ top: 30 * globalThis.ratio }) | ||||||
|  | 
 | ||||||
|  |           Text('正在清理本地数据,请稍候……') | ||||||
|  |             .fontSize(24 * globalThis.ratio) | ||||||
|  |             .margin({ top: 20 * globalThis.ratio }) | ||||||
|  |             .fontWeight(400) | ||||||
|  |         } | ||||||
|  |         .visibility(this.delLoading ? Visibility.Visible : Visibility.Hidden) | ||||||
|  |         .width(660 * globalThis.ratio) | ||||||
|  |         .height(360 * globalThis.ratio) | ||||||
|  |         .position({ x: 150 * globalThis.ratio, y: 98 * globalThis.ratio }) | ||||||
|  |         .backgroundColor('#E6E3DF') | ||||||
|  |         .borderRadius(19 * globalThis.ratio) | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if (this.loading) { | ||||||
|  |         Column() { | ||||||
|  |           Image($r('app.media.open_loading')) | ||||||
|  |             .width(200 * globalThis.ratio) | ||||||
|  |             .rotate({ angle: this.angle }) | ||||||
|  |             .height(200 * globalThis.ratio) | ||||||
|  |             .animation({ | ||||||
|  |               duration: 5000, // 动画时长 | ||||||
|  |               curve: Curve.EaseOut, // 动画曲线 | ||||||
|  |               delay: 500, // 动画延迟 | ||||||
|  |               iterations: -1, // 播放次数 | ||||||
|  |               playMode: PlayMode.Normal, // 动画模式 | ||||||
|  |             }) | ||||||
|  |             .margin({ top: 30 * globalThis.ratio }) | ||||||
|  |           Image($r('app.media.car')) | ||||||
|  |             .width(80 * globalThis.ratio) | ||||||
|  |             .height(80 * globalThis.ratio) | ||||||
|  |             .position({ x: 288 * globalThis.ratio, y: 89 * globalThis.ratio }) | ||||||
|  |           Text('获取考车信息,请稍候……') | ||||||
|  |             .fontSize(24 * globalThis.ratio) | ||||||
|  |             .margin({ top: 20 * globalThis.ratio }) | ||||||
|  |             .fontWeight(400) | ||||||
|  |         } | ||||||
|  |         .visibility(this.loading ? Visibility.Visible : Visibility.Hidden) | ||||||
|  |         .width(660 * globalThis.ratio) | ||||||
|  |         .height(360 * globalThis.ratio) | ||||||
|  |         .position({ x: 150 * globalThis.ratio, y: 98 * globalThis.ratio }) | ||||||
|  |         .backgroundColor('#E6E3DF') | ||||||
|  |         .borderRadius(19 * globalThis.ratio) | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     .width('100%') | ||||||
|  |     .height('100%') | ||||||
|  |     .justifyContent(FlexAlign.SpaceBetween) | ||||||
|  |     .backgroundImagePosition({ x: 0, y: 0 }) | ||||||
|  |     .backgroundImage($r('app.media.index_bg')) | ||||||
|  |     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|  |   } | ||||||
| } | } | ||||||
| @ -35,6 +35,114 @@ import promptAction from '@ohos.promptAction'; | |||||||
| @Entry | @Entry | ||||||
| @Component | @Component | ||||||
| struct Index { | struct Index { | ||||||
|  |   scroller: Scroller = new Scroller() | ||||||
|  |   //页面通用字体大小 | ||||||
|  |   @State wayno: number = 0 | ||||||
|  |   @State FONTSIZE: number = 30 | ||||||
|  |   @State BIGFONTSIZE: number = 32 | ||||||
|  |   //结束考试弹窗 | ||||||
|  |   @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 startExamTime: 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 | ||||||
|  |     markcatalog: string | ||||||
|  |   }[] = [] | ||||||
|  |   @State name: string = '' | ||||||
|  |   @State idCard: string = '' | ||||||
|  |   @State singlePlay: boolean = false; | ||||||
|  |   @State totalScore: number = 100 | ||||||
|  |   //模拟考试项目 | ||||||
|  |   @State projects: Project[] = [] | ||||||
|  |   @State projectsObj: ProjectObj = {} | ||||||
|  |   @State projectsCenterObj: ProjectObj = {} | ||||||
|  |   @State markRuleListObj: MarkRule = {} | ||||||
|  |   @State cdsbInfoObj: CDSBInfo = {} | ||||||
|  |   @State itemInfoObj: 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 ksxl: string = '' | ||||||
|  |   @State kslx: string = '' | ||||||
|  |   //监管线路代码 | ||||||
|  |   @State xldm: string = '' | ||||||
|  |   //监管接口序列号 | ||||||
|  |   @State serialNumber: number = 0 | ||||||
|  |   @State syssetParam623: boolean = false; | ||||||
|  |   @State syssetParam211: string = ''; | ||||||
|  |   @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 carinfoArr: CARINFO[] = [] | ||||||
|  |   @State mapPointArr: MAPPOINT[] = [] | ||||||
|  |   //手动项目是否在进行中 | ||||||
|  |   @State isManualProjectIn: boolean = false; | ||||||
|  |   //项目是否进行中 | ||||||
|  |   @State isProjectIn: boolean = false; | ||||||
|  |   //正在进行的项目代码 | ||||||
|  |   @State currentXmdm: string = '' | ||||||
|  |   // 必考项目除靠边停车是否全部完成 | ||||||
|  |   @State isRequiredProjectsEnd: boolean = false; | ||||||
|  |   // 考试项目是否全部完成 | ||||||
|  |   // @State isAllProjectsEnd: boolean = false; | ||||||
|  |   @State lane: LANE = { road: '', num: 0, count: 0 } | ||||||
|  |   @State roadData: Object = {}; | ||||||
|  |   //定位差分状态时候正常 | ||||||
|  |   @State isDwztRight: boolean = true; | ||||||
|  |   @State defaultTabIndex: number = 0; | ||||||
|  |   private context = getContext(this) as common.UIAbilityContext; | ||||||
|  |   public kfArrScroller: Scroller = new Scroller() | ||||||
|  |   private vocObj = null; | ||||||
|  |   //档位 | ||||||
|  |   @State dw: string = '' | ||||||
|  |   //速度 | ||||||
|  |   @State sd: string = '' | ||||||
|  |   @State mileageTimer: number = 0; | ||||||
|  |   @State passingScore: number = 80 | ||||||
|  |   @State dwztErrorVisible: boolean = false; | ||||||
|  |   @State popTimer: number = 0; | ||||||
|  |   @State carlist: string = '' | ||||||
|  |   @State errorMsg: string = '' | ||||||
|  |   @State isErrorMsgEnd: boolean = false | ||||||
|  |   @State disConnectErrorOpen: boolean = false | ||||||
|   // 考试模式 1:白考,2:夜考,3:增驾(模拟灯光未考),4:增驾(模拟灯光已考),5:满分学习 |   // 考试模式 1:白考,2:夜考,3:增驾(模拟灯光未考),4:增驾(模拟灯光已考),5:满分学习 | ||||||
|   private mode: number = 1 |   private mode: number = 1 | ||||||
|   private isYkkf: boolean = false |   private isYkkf: boolean = false | ||||||
| @ -259,7 +367,8 @@ struct Index { | |||||||
|     } |     } | ||||||
|     //真实监管下发的项目 |     //真实监管下发的项目 | ||||||
|     let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item); |     let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item); | ||||||
|     this.mockLight = kStringArr.includes("41700") |     // 单机模式下增驾进模拟灯光 | ||||||
|  |     this.mockLight = kStringArr.includes("41700") || (globalThis.singlePlay && this.mode === 3) | ||||||
|     console.log("lixiao mockLight", this.mockLight) |     console.log("lixiao mockLight", this.mockLight) | ||||||
|     console.info('lixiao kStringArr', JSON.stringify(kStringArr)) |     console.info('lixiao kStringArr', JSON.stringify(kStringArr)) | ||||||
| 
 | 
 | ||||||
| @ -991,7 +1100,6 @@ struct Index { | |||||||
|               this.judge.closeAllFiles() |               this.judge.closeAllFiles() | ||||||
|               router.back() |               router.back() | ||||||
|             } |             } | ||||||
| 
 |  | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|       } |       } | ||||||
| @ -1276,112 +1384,5 @@ struct Index { | |||||||
|       return false |       return false | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   scroller: Scroller = new Scroller() | 
 | ||||||
|   //页面通用字体大小 |  | ||||||
|   @State wayno: number = 0 |  | ||||||
|   @State FONTSIZE: number = 30 |  | ||||||
|   @State BIGFONTSIZE: number = 32 |  | ||||||
|   //结束考试弹窗 |  | ||||||
|   @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 startExamTime: 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 |  | ||||||
|     markcatalog: string |  | ||||||
|   }[] = [] |  | ||||||
|   @State name: string = '' |  | ||||||
|   @State idCard: string = '' |  | ||||||
|   @State singlePlay: boolean = false; |  | ||||||
|   @State totalScore: number = 100 |  | ||||||
|   //模拟考试项目 |  | ||||||
|   @State projects: Project[] = [] |  | ||||||
|   @State projectsObj: ProjectObj = {} |  | ||||||
|   @State projectsCenterObj: ProjectObj = {} |  | ||||||
|   @State markRuleListObj: MarkRule = {} |  | ||||||
|   @State cdsbInfoObj: CDSBInfo = {} |  | ||||||
|   @State itemInfoObj: 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 ksxl: string = '' |  | ||||||
|   @State kslx: string = '' |  | ||||||
|   //监管线路代码 |  | ||||||
|   @State xldm: string = '' |  | ||||||
|   //监管接口序列号 |  | ||||||
|   @State serialNumber: number = 0 |  | ||||||
|   @State syssetParam623: boolean = false; |  | ||||||
|   @State syssetParam211: string = ''; |  | ||||||
|   @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 carinfoArr: CARINFO[] = [] |  | ||||||
|   @State mapPointArr: MAPPOINT[] = [] |  | ||||||
|   //手动项目是否在进行中 |  | ||||||
|   @State isManualProjectIn: boolean = false; |  | ||||||
|   //项目是否进行中 |  | ||||||
|   @State isProjectIn: boolean = false; |  | ||||||
|   //正在进行的项目代码 |  | ||||||
|   @State currentXmdm: string = '' |  | ||||||
|   // 必考项目除靠边停车是否全部完成 |  | ||||||
|   @State isRequiredProjectsEnd: boolean = false; |  | ||||||
|   // 考试项目是否全部完成 |  | ||||||
|   // @State isAllProjectsEnd: boolean = false; |  | ||||||
|   @State lane: LANE = { road: '', num: 0, count: 0 } |  | ||||||
|   @State roadData: Object = {}; |  | ||||||
|   //定位差分状态时候正常 |  | ||||||
|   @State isDwztRight: boolean = true; |  | ||||||
|   @State defaultTabIndex: number = 0; |  | ||||||
|   private context = getContext(this) as common.UIAbilityContext; |  | ||||||
|   public kfArrScroller: Scroller = new Scroller() |  | ||||||
|   private vocObj = null; |  | ||||||
|   //档位 |  | ||||||
|   @State dw: string = '' |  | ||||||
|   //速度 |  | ||||||
|   @State sd: string = '' |  | ||||||
|   @State mileageTimer: number = 0; |  | ||||||
|   @State passingScore: number = 80 |  | ||||||
|   @State dwztErrorVisible: boolean = false; |  | ||||||
|   @State popTimer: number = 0; |  | ||||||
|   @State carlist: string = '' |  | ||||||
|   @State errorMsg: string = '' |  | ||||||
|   @State isErrorMsgEnd: boolean = false |  | ||||||
|   @State disConnectErrorOpen: boolean = false |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -224,7 +224,6 @@ struct UserInfo { | |||||||
|             this.currentUser = (this.list.length ? this.list[0] : EmptyCandidateObject) |             this.currentUser = (this.list.length ? this.list[0] : EmptyCandidateObject) | ||||||
|           } |           } | ||||||
|         } else if (user && (user.kssycs == '0' || user.kssycs == '')) { |         } else if (user && (user.kssycs == '0' || user.kssycs == '')) { | ||||||
|           console.log('datadatadatadata') |  | ||||||
|           this.list = this.list.filter(res => { |           this.list = this.list.filter(res => { | ||||||
|             return res.sfzmhm != user.sfzmhm |             return res.sfzmhm != user.sfzmhm | ||||||
|           }) |           }) | ||||||
|  | |||||||
| @ -2,9 +2,8 @@ import apiJudgeSdk from 'libJudgeSdk.so'; | |||||||
| import Judge from '../../judgeSDK/utils/judgeReal'; | import Judge from '../../judgeSDK/utils/judgeReal'; | ||||||
| import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d'; | import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d'; | ||||||
| import common from '@ohos.app.ability.common'; | import common from '@ohos.app.ability.common'; | ||||||
| import { | import { examJudgeMapSetScaling, examJudgeVersion } from '../../judgeSDK/api' | ||||||
|   examJudgeMapSetScaling | import { judgeConfig } from '../../judgeSDK/utils/judgeConfig'; | ||||||
| } from '../../judgeSDK/api' |  | ||||||
| 
 | 
 | ||||||
| interface RoadDataType { | interface RoadDataType { | ||||||
|   name: string, |   name: string, | ||||||
| @ -24,19 +23,18 @@ export default struct RealTime { | |||||||
|   @State markRuleListObj: MarkRule = {} |   @State markRuleListObj: MarkRule = {} | ||||||
|   @State scaleNum: number = 100 |   @State scaleNum: number = 100 | ||||||
|   @State gpsActive: number = 1 |   @State gpsActive: number = 1 | ||||||
|  |   @State ratio: number = 1 | ||||||
|  |   @State lane: Object = {} | ||||||
|  |   @State timer: number = 0 | ||||||
|  |   @State version: string = "" | ||||||
|   private widthNumber: string | number | Resource = 0 |   private widthNumber: string | number | Resource = 0 | ||||||
|   private heightNumber: string | number | Resource = 0 |   private heightNumber: string | number | Resource = 0 | ||||||
|   private context = getContext(this) as common.UIAbilityContext; |   private context = getContext(this) as common.UIAbilityContext; | ||||||
|   @State ratio: number = 1 |  | ||||||
|   @State lane: Object = {} |  | ||||||
|   @State timer:number = 0 |  | ||||||
| 
 | 
 | ||||||
|   constructor() { |   constructor() { | ||||||
|     super() |     super() | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // xcomponentController: XComponentController = new XComponentController() |  | ||||||
| 
 |  | ||||||
|   build() { |   build() { | ||||||
|     Row() { |     Row() { | ||||||
|       Column() { |       Column() { | ||||||
| @ -58,7 +56,7 @@ export default struct RealTime { | |||||||
|                 .fontColor('#fff') |                 .fontColor('#fff') | ||||||
|             }.height(30).justifyContent(FlexAlign.Start).width('100%') |             }.height(30).justifyContent(FlexAlign.Start).width('100%') | ||||||
|           }) |           }) | ||||||
|         }.margin({top:5}) |         }.margin({ top: 5 }) | ||||||
| 
 | 
 | ||||||
|       }.width(168 * 1.5) |       }.width(168 * 1.5) | ||||||
|       .height(this.heightNumber) |       .height(this.heightNumber) | ||||||
| @ -67,22 +65,29 @@ export default struct RealTime { | |||||||
| 
 | 
 | ||||||
|       Column() { |       Column() { | ||||||
|         if (this.draw) { |         if (this.draw) { | ||||||
|           XComponent({ |           Stack({ alignContent: Alignment.TopEnd }) { | ||||||
|             id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变 |             Row() { | ||||||
|             type: 'surface', |               Text(this.version).margin({ right: 10 }).fontSize(14).fontColor(0x333333) | ||||||
|             libraryname: 'JudgeSdk' |             } | ||||||
|             // libraryname: 'judgesdk' | 
 | ||||||
|           }) |             XComponent({ | ||||||
|             .width(this.widthNumber) |               id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变 | ||||||
|             .height(this.heightNumber) |               type: 'surface', | ||||||
|             .onLoad(() => { |               libraryname: 'JudgeSdk' | ||||||
|               apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹,false:表示结束绘制 |  | ||||||
|             }) |  | ||||||
|             .onDestroy(() => { |  | ||||||
|               apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹,false:表示结束绘制 |  | ||||||
|               this.draw = false; |  | ||||||
|               clearInterval(globalThis.realTimer) |  | ||||||
|             }) |             }) | ||||||
|  |               .width(this.widthNumber) | ||||||
|  |               .height(this.heightNumber) | ||||||
|  |               .onLoad(() => { | ||||||
|  |                 apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹,false:表示结束绘制 | ||||||
|  |               }) | ||||||
|  |               .onDestroy(() => { | ||||||
|  |                 apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹,false:表示结束绘制 | ||||||
|  |                 this.draw = false; | ||||||
|  |                 clearInterval(globalThis.realTimer) | ||||||
|  |               }) | ||||||
|  |           }.width(this.widthNumber) | ||||||
|  |           .height(this.heightNumber) | ||||||
|  | 
 | ||||||
|         } else { |         } else { | ||||||
|           Column() { |           Column() { | ||||||
|           } |           } | ||||||
| @ -93,14 +98,14 @@ export default struct RealTime { | |||||||
|       .width('100%') |       .width('100%') | ||||||
|       .backgroundColor('#fff') |       .backgroundColor('#fff') | ||||||
| 
 | 
 | ||||||
|       Row(){ |       Row() { | ||||||
|         Image($rawfile('judge/big.png')).width(60).onClick(()=>{ |         Image($rawfile('judge/big.png')).width(60).onClick(() => { | ||||||
|           this.scaleFn( -this.getScaleNum() ) |           this.scaleFn(-this.getScaleNum()) | ||||||
|         }) |         }) | ||||||
|         Image($rawfile('judge/small.png')).width(60).onClick(()=>{ |         Image($rawfile('judge/small.png')).width(60).onClick(() => { | ||||||
|           this.scaleFn( this.getScaleNum() ) |           this.scaleFn(this.getScaleNum()) | ||||||
|         }).margin({left:20}) |         }).margin({ left: 20 }) | ||||||
|       }.position({x:'32%',y:60}) |       }.position({ x: '32%', y: 60 }) | ||||||
|     } |     } | ||||||
|     .height('100%') |     .height('100%') | ||||||
|   } |   } | ||||||
| @ -108,39 +113,41 @@ export default struct RealTime { | |||||||
|   async aboutToDisappear() { |   async aboutToDisappear() { | ||||||
|     clearInterval(this.timer) |     clearInterval(this.timer) | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
|     const judge = new Judge(this) |     this.version = (await examJudgeVersion()) + "/" + judgeConfig.version | ||||||
|     let timer = setInterval(()=>{ |     new Judge(this) | ||||||
|  |     let timer = setInterval(() => { | ||||||
|       this.lane = globalThis.laneData; |       this.lane = globalThis.laneData; | ||||||
|     },1000) |     }, 1000) | ||||||
|     this.timer = timer |     this.timer = timer | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getScaleNum = ()=>{ |   getScaleNum = () => { | ||||||
|     const scaleNum = this.scaleNum; |     const scaleNum = this.scaleNum; | ||||||
|     if(scaleNum < 200){ |     if (scaleNum < 200) { | ||||||
|       return 10 |       return 10 | ||||||
|     } |     } | ||||||
|     if(scaleNum >= 200 && scaleNum < 400){ |     if (scaleNum >= 200 && scaleNum < 400) { | ||||||
|       return 30 |       return 30 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if(scaleNum >= 400 && scaleNum < 600){ |     if (scaleNum >= 400 && scaleNum < 600) { | ||||||
|       return 50 |       return 50 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if(scaleNum >= 600 && scaleNum < 800){ |     if (scaleNum >= 600 && scaleNum < 800) { | ||||||
|       return 70 |       return 70 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if(scaleNum >= 800 && scaleNum < 1000){ |     if (scaleNum >= 800 && scaleNum < 1000) { | ||||||
|       return 100 |       return 100 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if(scaleNum >= 1000 && scaleNum < 2000){ |     if (scaleNum >= 1000 && scaleNum < 2000) { | ||||||
|       return 500 |       return 500 | ||||||
|     } |     } | ||||||
|     if(scaleNum >= 2000 && scaleNum <= 5000){ |     if (scaleNum >= 2000 && scaleNum <= 5000) { | ||||||
|       return 1000 |       return 1000 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -168,32 +175,30 @@ export default struct RealTime { | |||||||
|     { name: '车身碰线', key: ['TouchLineTypeCS', 'TouchLineDirCS'] }, |     { name: '车身碰线', key: ['TouchLineTypeCS', 'TouchLineDirCS'] }, | ||||||
|     { name: '基准车道', key: ['BasePointInLaneNo', 'BaseLaneCount'] }, |     { name: '基准车道', key: ['BasePointInLaneNo', 'BaseLaneCount'] }, | ||||||
|     { name: '前点车道', key: ['FrontPointLaneNo', 'FrontPointLaneCount'] }, |     { name: '前点车道', key: ['FrontPointLaneNo', 'FrontPointLaneCount'] }, | ||||||
|     { name: '后车点道', key: ['BackPointLaneNo','BackPointLaneCount'] }, |     { name: '后车点道', key: ['BackPointLaneNo', 'BackPointLaneCount'] }, | ||||||
|     { name: '左前/后车身距离', key: ['Body_LF_ToLeftEdge', 'Body_LB_ToLeftEdge'] }, |     { name: '左前/后车身距离', key: ['Body_LF_ToLeftEdge', 'Body_LB_ToLeftEdge'] }, | ||||||
|     { name: '右前/后车身距离', key: ['Body_RF_ToRightEdge', 'Body_RB_ToRightEdge'] }, |     { name: '右前/后车身距离', key: ['Body_RF_ToRightEdge', 'Body_RB_ToRightEdge'] }, | ||||||
|     { name: '右前/后车身边线', key: ['Body_RF_ToBaseLine','Body_RB_ToBaseLine'] }, |     { name: '右前/后车身边线', key: ['Body_RF_ToBaseLine', 'Body_RB_ToBaseLine'] }, | ||||||
|     { name: '右前/后轮距离', key: ['Wheel_RF_ToRightEdge', 'Wheel_RB_ToRightEdge'] }, |     { name: '右前/后轮距离', key: ['Wheel_RF_ToRightEdge', 'Wheel_RB_ToRightEdge'] }, | ||||||
|     { name: '右前/后轮边线', key: ['Wheel_RF_ToBaseLine', 'Wheel_RB_ToBaseLine'] }, |     { name: '右前/后轮边线', key: ['Wheel_RF_ToBaseLine', 'Wheel_RB_ToBaseLine'] }, | ||||||
|     { name: '左前/后轮距离', key: ['Wheel_LF_ToRightEdge', 'Wheel_LB_ToRightEdge'] }, |     { name: '左前/后轮距离', key: ['Wheel_LF_ToRightEdge', 'Wheel_LB_ToRightEdge'] }, | ||||||
|     { name: '左前/后轮边线', key: ['Wheel_LF_ToBaseLine', 'Wheel_LB_ToBaseLine'] }, |     { name: '左前/后轮边线', key: ['Wheel_LF_ToBaseLine', 'Wheel_LB_ToBaseLine'] }, | ||||||
|     { name: '车道属性', key: ['BasePointInLaneDir', 'CrossLineAttr','DirInverse'] }, |     { name: '车道属性', key: ['BasePointInLaneDir', 'CrossLineAttr', 'DirInverse'] }, | ||||||
|     { name: '形状', key: ['InShapeAttr', 'ShapeNo','ShapeNoWheel'] }, |     { name: '形状', key: ['InShapeAttr', 'ShapeNo', 'ShapeNoWheel'] }, | ||||||
|     { name: '路段点', key: ['CrossPointNo'] }, |     { name: '路段点', key: ['CrossPointNo'] }, | ||||||
|   ] |   ] | ||||||
| 
 |   scaleFn = async (num) => { | ||||||
|   scaleFn = async (num)=>{ |  | ||||||
|     const scaleNum = this.scaleNum |     const scaleNum = this.scaleNum | ||||||
|     if(scaleNum >0 && scaleNum < 5000){ |     if (scaleNum > 0 && scaleNum < 5000) { | ||||||
|       this.scaleNum += num; |       this.scaleNum += num; | ||||||
|     } |     } | ||||||
|     if(scaleNum === 0 && num > 0){ |     if (scaleNum === 0 && num > 0) { | ||||||
|       this.scaleNum += num; |       this.scaleNum += num; | ||||||
|     } |     } | ||||||
|     if(scaleNum > 5000 && num < 0){ |     if (scaleNum > 5000 && num < 0) { | ||||||
|       this.scaleNum += num; |       this.scaleNum += num; | ||||||
|     } |     } | ||||||
|     await examJudgeMapSetScaling(this.scaleNum); |     await examJudgeMapSetScaling(this.scaleNum); | ||||||
|   } |   } | ||||||
| 
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -54,6 +54,7 @@ import { | |||||||
|   examJudgeVersion |   examJudgeVersion | ||||||
| } from './api/index'; | } from './api/index'; | ||||||
| import { getSyncData, upDateTableByArray } from '../../common/service/initable'; | import { getSyncData, upDateTableByArray } from '../../common/service/initable'; | ||||||
|  | import promptAction from '@ohos.promptAction'; | ||||||
| 
 | 
 | ||||||
| const judgeTag = 'SURENJUN_JUDGE' | const judgeTag = 'SURENJUN_JUDGE' | ||||||
| 
 | 
 | ||||||
| @ -339,7 +340,7 @@ export default class Judge { | |||||||
|       //及格分
 |       //及格分
 | ||||||
|       let passingGrade = passingScore |       let passingGrade = passingScore | ||||||
|       if (isManual) { |       if (isManual) { | ||||||
|         // 考试不合格
 |         // 手动结束
 | ||||||
|         await examJudgeEndExam() |         await examJudgeEndExam() | ||||||
|         this.isExamEnd = true |         this.isExamEnd = true | ||||||
|         this.isManual = true |         this.isManual = true | ||||||
| @ -717,7 +718,9 @@ export default class Judge { | |||||||
|     const sdkver = await examJudgeVersion(); |     const sdkver = await examJudgeVersion(); | ||||||
|     const initInfo = { |     const initInfo = { | ||||||
|       sdkver, |       sdkver, | ||||||
|       appver: globalThis.version, |       // appver: globalThis.version,
 | ||||||
|  |       // 外壳迭代版本号
 | ||||||
|  |       appver: judgeConfig.version, | ||||||
|       kskm: 3, |       kskm: 3, | ||||||
|       kchp: plateNo, |       kchp: plateNo, | ||||||
|       kchm: carId * 1, |       kchm: carId * 1, | ||||||
| @ -1797,7 +1800,15 @@ export default class Judge { | |||||||
|     await fileLog.setExamJudgeData(initInfo) |     await fileLog.setExamJudgeData(initInfo) | ||||||
|     //相关评判初始化只做一次
 |     //相关评判初始化只做一次
 | ||||||
|     if (!isJudgeInitBool) { |     if (!isJudgeInitBool) { | ||||||
|       const tempJudge = await examJudgeInit(initInfo); |       try { | ||||||
|  |         await examJudgeInit(initInfo); | ||||||
|  |       } catch (err) { | ||||||
|  |         promptAction.showToast({ | ||||||
|  |           message: "考试初始化失败,请重试或联系管理员" | ||||||
|  |         }) | ||||||
|  |         router.back() | ||||||
|  |         return | ||||||
|  |       } | ||||||
|       globalThis.isJudgeInitBool = true |       globalThis.isJudgeInitBool = true | ||||||
|       console.info(judgeTag, '4.评判初始化完成') |       console.info(judgeTag, '4.评判初始化完成') | ||||||
|     } |     } | ||||||
| @ -1838,18 +1849,6 @@ export default class Judge { | |||||||
|       this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`) |       this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const {examSubject,projectsObj} = this.judgeUI |  | ||||||
|     // if(examSubject == 3){
 |  | ||||||
|     //   //不做模拟灯光,需要做上车准备 =>(请上车准备)
 |  | ||||||
|     //   if(projectsObj[41]?.type == 3 && projectsObj[1]?.type != 3){
 |  | ||||||
|     //     avPlayer.playAudio(['voice/上车准备.mp3'])
 |  | ||||||
|     //   }
 |  | ||||||
|     //   //不做模拟灯光,不做上车准备 =>(请起步,完成考试)
 |  | ||||||
|     //   if(projectsObj[41]?.type == 3 && projectsObj[1]?.type == 3){
 |  | ||||||
|     //     avPlayer.playAudio(['voice/402001.mp3'])
 |  | ||||||
|     //   }
 |  | ||||||
|     // }
 |  | ||||||
| 
 |  | ||||||
|     this.judgeUI.draw = true |     this.judgeUI.draw = true | ||||||
|     // 处理轨迹plc信息
 |     // 处理轨迹plc信息
 | ||||||
|     if (isTrajectoryOpen) { |     if (isTrajectoryOpen) { | ||||||
|  | |||||||
| @ -1,7 +1,9 @@ | |||||||
| //考试回放开关
 | //考试回放开关
 | ||||||
| export const judgeConfig = { | export const judgeConfig = { | ||||||
|  |   // 外壳版本号
 | ||||||
|  |   version: "2025.05.13.01", | ||||||
|   // 是否A1A3共用一车
 |   // 是否A1A3共用一车
 | ||||||
|   isUseSameCar: false, |   isUseSameCar: true, | ||||||
|   //本地目录开关
 |   //本地目录开关
 | ||||||
|   isTrajectoryOpen: false, |   isTrajectoryOpen: false, | ||||||
|   //是否开启拍照
 |   //是否开启拍照
 | ||||||
|  | |||||||
| @ -1,48 +1,28 @@ | |||||||
| import { | import { examJudgeMapSetParam, examJudgeMapSetScaling } from '../api/index' | ||||||
|   examJudgeMapSetParam, |  | ||||||
|   examJudgeMapSetScaling |  | ||||||
| } from '../api/index' |  | ||||||
| import systemTime from '@ohos.systemDateTime'; | import systemTime from '@ohos.systemDateTime'; | ||||||
| 
 | 
 | ||||||
| import FileUtil from '../../../common/utils/File' | import FileUtil from '../../../common/utils/File' | ||||||
| import FileModel from './fileModel' | import FileModel from './fileModel' | ||||||
| import {testRealExam} from '../dataTest/index' | import { testRealExam } from '../dataTest/index' | ||||||
| 
 | 
 | ||||||
| const judgeTag = 'SURENJUN_JUDGE' | const judgeTag = 'SURENJUN_JUDGE' | ||||||
| 
 | 
 | ||||||
| export default class JudgeImg { | export default class JudgeImg { | ||||||
| 
 |  | ||||||
|   private judgeUI |   private judgeUI | ||||||
|   private modelPath:string |  | ||||||
|   private fileModel:FileModel |  | ||||||
|   private fileUtil:FileUtil |  | ||||||
|   private plcData:any |  | ||||||
| 
 | 
 | ||||||
|   constructor(judgeUI) { |   constructor(judgeUI) { | ||||||
|     this.modelPath = 'models/model_enc' |  | ||||||
|     this.judgeUI = judgeUI |     this.judgeUI = judgeUI | ||||||
|     this.fileUtil = new FileUtil(judgeUI.context) |  | ||||||
|     this.fileModel = new FileModel(judgeUI.context) |  | ||||||
|     this.init() |     this.init() | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async init(){ |   async init() { | ||||||
|     const isJudgeInitBool = globalThis.isJudgeInitBool; |  | ||||||
|     const {judgeUI} = this; |     const {judgeUI} = this; | ||||||
| 
 |  | ||||||
|     //TODO 临时处理
 |     //TODO 临时处理
 | ||||||
|     setTimeout(async ()=>{ |     setTimeout(async () => { | ||||||
|       console.info(judgeTag,'1.进入评判入口') |       console.info(judgeTag, '1.进入评判入口') | ||||||
|       await examJudgeMapSetParam(640, 480); //设置参数宽、高
 |       await examJudgeMapSetParam(640, 480); //设置参数宽、高
 | ||||||
|       await examJudgeMapSetScaling(100); //设置缩放比例,一般默认填100(就是100%的意思) ,数字越大视野越大,数字越小视野越小,不能为0
 |       await examJudgeMapSetScaling(100); //设置缩放比例,一般默认填100(就是100%的意思) ,数字越大视野越大,数字越小视野越小,不能为0
 | ||||||
|     }) |     }) | ||||||
| 
 |  | ||||||
|     judgeUI.draw = true |     judgeUI.draw = true | ||||||
| 
 |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   //获取评判初始化数据
 |  | ||||||
|   getInitInfo = () =>{ |  | ||||||
| 
 |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user