| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  | // @ts-nocheck | 
					
						
							|  |  |  | import { VideoConfig } from './interfaces' | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  | import common from '@ohos.app.ability.common'; | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  | import router from '@ohos.router' | 
					
						
							|  |  |  | import {  getDeviceInfo ,getCarInfo} from '../common/service/terminalService' | 
					
						
							|  |  |  | import { setCurrentTime } from '../common/service/timeService' | 
					
						
							|  |  |  | import {string2Bytes} from '../common/utils/tools' | 
					
						
							| 
									
										
										
										
											2024-05-09 13:42:56 +08:00
										 |  |  | import { FileHelper } from '../common/service/FileHelper'; | 
					
						
							| 
									
										
										
										
											2024-06-04 14:18:44 +08:00
										 |  |  | import { | 
					
						
							|  |  |  |   getEsCarModel, | 
					
						
							|  |  |  | } from '../common/service/initable' | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  | import FileUtil from '../common/utils/File' | 
					
						
							|  |  |  | import { getUDP, getUDP2 } from '../common/utils/GlobleUdp' | 
					
						
							|  |  |  | import {initJudgeUdp} from '../common/utils/UdpJudge' | 
					
						
							|  |  |  | import { getTCP } from '../common/utils/GlobleTcp' | 
					
						
							|  |  |  | import TcpClient from '../common/utils/TcpClient'; | 
					
						
							|  |  |  | import testNapi from '@ohos.hiserialsdk' | 
					
						
							|  |  |  | import {setliushuiNum,getliushuiNum,getSingleCenterTable,getDoubleCeneterTable,takePhotoFn} from '../common/service/indexService' | 
					
						
							| 
									
										
										
										
											2024-03-12 15:32:48 +08:00
										 |  |  | import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  | import worker, { MessageEvents } from '@ohos.worker'; | 
					
						
							| 
									
										
										
										
											2024-06-04 11:19:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  | @Entry | 
					
						
							|  |  |  | @Component | 
					
						
							|  |  |  | struct Index { | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |   private fileUtil: FileUtil | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |   @State carNum: string = '' | 
					
						
							|  |  |  |   @State version: string = '' | 
					
						
							|  |  |  |   @State url: string = '' | 
					
						
							|  |  |  |   @State hasAuth: boolean = false; | 
					
						
							|  |  |  |   @State isSingle: boolean = false; | 
					
						
							|  |  |  |   @State deviceId: string = ''; | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |   private interval = null; | 
					
						
							|  |  |  |   private workerInstance = null; | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |   @State angle: number = 0 | 
					
						
							| 
									
										
										
										
											2024-05-16 09:53:10 +08:00
										 |  |  |   @State ratio: number = 1700 / 960 | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |   @State loading: boolean = true | 
					
						
							|  |  |  |   @State fd: number = -1; | 
					
						
							|  |  |  |   private context = getContext(this) as common.UIAbilityContext; | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |   @State param: VideoConfig = { | 
					
						
							|  |  |  |     videoNum:'1', | 
					
						
							|  |  |  |     spls: '1', | 
					
						
							|  |  |  |     wz: '0,0', | 
					
						
							|  |  |  |     faceFlag: false, | 
					
						
							|  |  |  |     shuiying: true, | 
					
						
							|  |  |  |     pztd: '2', | 
					
						
							|  |  |  |     ljlx: '', | 
					
						
							|  |  |  |     ip: '192.168.36.94', | 
					
						
							|  |  |  |     port: '554', | 
					
						
							|  |  |  |     userName: 'admin', | 
					
						
							|  |  |  |     pwd: '12345qwe', | 
					
						
							|  |  |  |     td1: '1', | 
					
						
							|  |  |  |     td2: '2', | 
					
						
							|  |  |  |     td3: '3', | 
					
						
							|  |  |  |     td4: '4', | 
					
						
							|  |  |  |     videoRecord1: false, | 
					
						
							|  |  |  |     videoRecord2: true, | 
					
						
							|  |  |  |     videoRecord3: false, | 
					
						
							|  |  |  |     videoRecord4: false, | 
					
						
							|  |  |  |     text1: '', | 
					
						
							|  |  |  |     text2: '', | 
					
						
							|  |  |  |     text3: '', | 
					
						
							|  |  |  |     dolt: '', | 
					
						
							|  |  |  |     fontSize: '', | 
					
						
							|  |  |  |     rlls: '1', | 
					
						
							|  |  |  |     spzd4:false, | 
					
						
							|  |  |  |     spzd3:false, | 
					
						
							|  |  |  |     spzd2:false, | 
					
						
							|  |  |  |     spzd1:false, | 
					
						
							|  |  |  |     zdyz:'5', | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-05-09 13:42:56 +08:00
										 |  |  |   fileHelper =null; | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |   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(() => { | 
					
						
							|  |  |  |                 if (this.loading) { | 
					
						
							|  |  |  |                   return | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 router.back() | 
					
						
							|  |  |  |               }) | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         .width('100%') | 
					
						
							|  |  |  |         .justifyContent(FlexAlign.SpaceBetween) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       Column() { | 
					
						
							|  |  |  |         Row() { | 
					
						
							|  |  |  |           if (!this.isSingle) { | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |             Image($r('app.media.index_lw')).width('30.5%').height('74%').onClick(async() => { | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |               if (this.loading) { | 
					
						
							|  |  |  |                 return | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |               this.loading = true | 
					
						
							|  |  |  |               setTimeout(() => { | 
					
						
							| 
									
										
										
										
											2024-02-22 10:40:35 +08:00
										 |  |  |                 this.angle = 360 | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |               }, 1000) | 
					
						
							| 
									
										
										
										
											2024-02-22 10:40:35 +08:00
										 |  |  |               this.angle = 0 | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |               if(!globalThis.timeInfo){ | 
					
						
							| 
									
										
										
										
											2024-05-16 09:53:10 +08:00
										 |  |  |                 promptAction.showToast({ | 
					
						
							|  |  |  |                   message: `网络连接失败`, | 
					
						
							|  |  |  |                   duration: 3000 | 
					
						
							|  |  |  |                 }); | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |                 this.loading=false | 
					
						
							| 
									
										
										
										
											2024-01-31 14:35:16 +08:00
										 |  |  |               } | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |               this.testXMLToJSONInWorker() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-22 10:40:35 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |             }) | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           if (this.isSingle) { | 
					
						
							|  |  |  |             Image($r('app.media.index_dj')).width('30.5%').height('74%').onClick(() => { | 
					
						
							|  |  |  |               if (this.loading) { | 
					
						
							|  |  |  |                 return | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |               router.pushUrl({ | 
					
						
							| 
									
										
										
										
											2024-02-22 17:33:10 +08:00
										 |  |  |                 url: 'pages/UserInfo', | 
					
						
							| 
									
										
										
										
											2024-05-16 09:53:10 +08:00
										 |  |  |                 params: { judge: true } | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |               }, router.RouterMode.Single); | 
					
						
							| 
									
										
										
										
											2024-05-16 09:53:10 +08:00
										 |  |  |               // router.pushUrl({ | 
					
						
							|  |  |  |               //   url: 'pages/UserInfo', | 
					
						
							|  |  |  |               // }, router.RouterMode.Single); | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |             }) | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           Image($r('app.media.index_zj')).width('30.5%').height('74%').onClick(() => { | 
					
						
							|  |  |  |             if (this.loading) { | 
					
						
							|  |  |  |               return | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             router.pushUrl({ | 
					
						
							| 
									
										
										
										
											2024-02-22 17:33:10 +08:00
										 |  |  |               url: 'pages/CarCheck' | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |             }, router.RouterMode.Single); | 
					
						
							|  |  |  |           }) | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         .width('100%') | 
					
						
							|  |  |  |         .justifyContent(FlexAlign.SpaceAround) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       Column() { | 
					
						
							|  |  |  |         Row() { | 
					
						
							|  |  |  |           Column() { | 
					
						
							|  |  |  |             Text('V ' + globalThis.version) | 
					
						
							|  |  |  |               .fontColor('#CCAE7A') | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |               .fontSize(22 * globalThis.ratio) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |               .width('30%') | 
					
						
							|  |  |  |               .margin({ bottom: 10 }) | 
					
						
							|  |  |  |             Text('授权信息:' + (this.hasAuth ? '已授权' : '未授权')) | 
					
						
							|  |  |  |               .fontColor('#CCAE7A') | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |               .fontSize(22 * globalThis.ratio) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |               .width('30%') | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           .margin({ left: 24 }) | 
					
						
							|  |  |  |           .gesture( | 
					
						
							|  |  |  |             GestureGroup(GestureMode.Exclusive, | 
					
						
							| 
									
										
										
										
											2024-01-31 14:35:16 +08:00
										 |  |  |               TapGesture({ count: 2 }) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |                 .onAction(() => { | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |                   // takePhotoFn(this.context) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |                   globalThis.singlePlay = !globalThis.singlePlay | 
					
						
							|  |  |  |                   this.isSingle = globalThis.singlePlay | 
					
						
							|  |  |  |                 }) | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |           ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |           Text('考车号:' + globalThis.deviceNo).fontColor('#CCAE7A').fontSize(22 * globalThis.ratio).margin({ right: 24 }) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |         .width('100%') | 
					
						
							|  |  |  |         .justifyContent(FlexAlign.SpaceBetween) | 
					
						
							|  |  |  |         .margin({ bottom: 10 }) | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-05-09 13:42:56 +08:00
										 |  |  |       // | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |       if (this.loading) { | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |       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) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     .width('100%') | 
					
						
							|  |  |  |     .height('100%') | 
					
						
							|  |  |  |     .justifyContent(FlexAlign.SpaceBetween) | 
					
						
							|  |  |  |     .backgroundImagePosition({ x: 0, y: 0 }) | 
					
						
							|  |  |  |     .backgroundImage($r('app.media.index_bg')) | 
					
						
							|  |  |  |     .backgroundImageSize({ width: '100%', height: '100%' }) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   aboutToAppear() { | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     globalThis.ratio= 1700 / 960 | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |     this.angle = 0 | 
					
						
							|  |  |  |     this.loading = false | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     // let workerInstance = new worker.ThreadWorker('entry/ets/pages/worker.ts', { | 
					
						
							|  |  |  |     //   name: 'FriendsMoments Worker' | 
					
						
							|  |  |  |     // }); | 
					
						
							|  |  |  |     // this.workerInstance.onmessage = function(e) { | 
					
						
							|  |  |  |     //   console.log("onerror") | 
					
						
							|  |  |  |     //   router.pushUrl({ | 
					
						
							|  |  |  |     //     url: 'pages/ExaminerLogin', | 
					
						
							|  |  |  |     //   }, router.RouterMode.Single) | 
					
						
							|  |  |  |     //   this.loading=false | 
					
						
							|  |  |  |     // } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   async testXMLToJSONInWorker(){ | 
					
						
							|  |  |  |     let workerInstance = new worker.ThreadWorker('entry/ets/workers/worker.ts', { | 
					
						
							|  |  |  |       name: 'FriendsMoments Worker' | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     var xmlStr='123' | 
					
						
							|  |  |  |     console.log("baoyihu before postMessage :"); | 
					
						
							|  |  |  |     const param={ | 
					
						
							|  |  |  |       carId:globalThis.carInfo?.carId, | 
					
						
							|  |  |  |       examinationRoomId:globalThis.carInfo?.examinationRoomId, | 
					
						
							|  |  |  |       judgeVersion:globalThis.judgeVersion, | 
					
						
							|  |  |  |       shellVersion:globalThis.version, | 
					
						
							|  |  |  |       paraKdid:globalThis.timeInfo?.paraKdid, | 
					
						
							|  |  |  |       mode: globalThis.timeInfo?.mode, | 
					
						
							|  |  |  |       context:this.context | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     workerInstance.postMessage(param); | 
					
						
							|  |  |  |     workerInstance.onmessage = (e: MessageEvents): void => { | 
					
						
							|  |  |  |       console.log("baoyihu after postMessage :",e.data); | 
					
						
							|  |  |  |       console.log("onerror") | 
					
						
							|  |  |  |       router.pushUrl({ | 
					
						
							|  |  |  |         url: 'pages/ExaminerLogin', | 
					
						
							|  |  |  |       }, router.RouterMode.Single) | 
					
						
							|  |  |  |       this.loading=false | 
					
						
							|  |  |  |       // let workData: WorkData = e.data; | 
					
						
							|  |  |  |       // if (workData) { | 
					
						
							|  |  |  |       //   this.isComplete = workData.isComplete; | 
					
						
							|  |  |  |       //   this.json_Str = workData.jsonStr; | 
					
						
							|  |  |  |       //   console.log("baoyihu after postMessage  json_Str:"+this.json_Str); | 
					
						
							|  |  |  |       //   workerInstance.terminate(); | 
					
						
							|  |  |  |       // } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-02-26 15:01:27 +08:00
										 |  |  |   async heartMsg() { | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     const arr = [globalThis.signNum||0, globalThis.statue||1] | 
					
						
							| 
									
										
										
										
											2024-06-04 11:19:22 +08:00
										 |  |  |     let tmpList = []; | 
					
						
							| 
									
										
										
										
											2024-02-22 10:40:35 +08:00
										 |  |  |     tmpList.push(string2Bytes(arr[0], 1 * 8)[0]) | 
					
						
							|  |  |  |     tmpList.push(string2Bytes(arr[1], 1 * 8)[0]) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |     const str =globalThis.lsh|| '0000000000000' | 
					
						
							|  |  |  |     for (let i = 0;i < str.length; i++) { | 
					
						
							| 
									
										
										
										
											2024-02-22 10:40:35 +08:00
										 |  |  |       tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0]) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     console.log('globalThis.carInfo',JSON.stringify(globalThis.carInfo)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const param= {id: 31,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId} | 
					
						
							|  |  |  |     // globalThis.udpClient2.initHeartSendMsg(param,this.context) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |     globalThis.udpClient2.sendMsg(param, this.context) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   onPageShow() { | 
					
						
							|  |  |  |     this.loading = false | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     this.createAlbum() | 
					
						
							| 
									
										
										
										
											2024-03-12 15:32:48 +08:00
										 |  |  |     this.userAuth(); | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |     getUDP() | 
					
						
							|  |  |  |     getUDP2() | 
					
						
							| 
									
										
										
										
											2024-05-09 13:42:56 +08:00
										 |  |  |     clearInterval(this.interval) | 
					
						
							|  |  |  |     this.interval=setInterval(() => { | 
					
						
							| 
									
										
										
										
											2024-06-04 14:18:44 +08:00
										 |  |  |       setliushuiNum(this.context) | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |       getliushuiNum(this.context) | 
					
						
							| 
									
										
										
										
											2024-03-05 15:44:53 +08:00
										 |  |  |       this.heartMsg() | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |     }, 1000) | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     // takePhotoFn(this.context) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // | 
					
						
							| 
									
										
										
										
											2024-05-16 09:53:10 +08:00
										 |  |  |     getTCP() | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     // const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { | 
					
						
							|  |  |  |       globalThis.singlePlay = false | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     this.isSingle = globalThis.singlePlay | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     console.info('Index onPageShow'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-09 13:42:56 +08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-09 13:42:56 +08:00
										 |  |  |   async createAlbum() { | 
					
						
							|  |  |  |     this.fileHelper = new FileHelper(); | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     this.fileHelper.createAlbum('jt') | 
					
						
							| 
									
										
										
										
											2024-05-09 13:42:56 +08:00
										 |  |  |     this.fileHelper.createAlbum('pz'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-03-12 15:32:48 +08:00
										 |  |  |   userAuth() { | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     const permissions: Array<Permissions> = ["ohos.permission.SET_TIME","ohos.permission.READ_IMAGEVIDEO", "ohos.permission.DISTRIBUTED_DATASYNC" ,'ohos.permission.CONNECTIVITY_INTERNAL','ohos.permission.CAMERA','ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA','ohos.permission.FILE_ACCESS_MANAGER']; | 
					
						
							| 
									
										
										
										
											2024-03-12 15:32:48 +08:00
										 |  |  |     let context = this.context; | 
					
						
							|  |  |  |     let atManager = abilityAccessCtrl.createAtManager(); | 
					
						
							|  |  |  |     // requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-12 15:32:48 +08:00
										 |  |  |     atManager.requestPermissionsFromUser(context, permissions).then((data) => { | 
					
						
							|  |  |  |       this.initParams() | 
					
						
							|  |  |  |       let grantStatus: Array<number> = data.authResults; | 
					
						
							|  |  |  |       let length: number = grantStatus.length; | 
					
						
							|  |  |  |       for (let i = 0; i < length; i++) { | 
					
						
							|  |  |  |         if (grantStatus[i] === 0) { | 
					
						
							|  |  |  |           // 用户授权,可以继续访问目标操作 | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |           // 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限 | 
					
						
							|  |  |  |           return; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       // 授权成功 | 
					
						
							|  |  |  |     }).catch((err) => { | 
					
						
							|  |  |  |       console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`); | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |   async initParams() { | 
					
						
							|  |  |  |     this.loading=false | 
					
						
							|  |  |  |     await getDeviceInfo() | 
					
						
							| 
									
										
										
										
											2024-05-09 13:42:56 +08:00
										 |  |  |     getCarInfo() | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |     await setCurrentTime(); | 
					
						
							|  |  |  |     this.carNum = globalThis.carInfo.plateNo; | 
					
						
							|  |  |  |     this.version = globalThis.version; | 
					
						
							|  |  |  |     this.hasAuth = globalThis.hasAuth; | 
					
						
							| 
									
										
										
										
											2024-01-31 14:35:16 +08:00
										 |  |  |     initJudgeUdp() | 
					
						
							| 
									
										
										
										
											2024-01-31 14:42:14 +08:00
										 |  |  |     //下载模型 | 
					
						
							|  |  |  |     // await this.getModel() | 
					
						
							|  |  |  |     // const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00] | 
					
						
							| 
									
										
										
										
											2024-02-22 10:40:35 +08:00
										 |  |  |     // globalThis.udpClientByTopLine.sendMsg(Array2Byte(arr).buffer) | 
					
						
							| 
									
										
										
										
											2024-06-27 20:53:36 +08:00
										 |  |  |     console.info(testNapi) | 
					
						
							| 
									
										
										
										
											2024-01-05 11:11:15 +08:00
										 |  |  |   } | 
					
						
							|  |  |  |   async getModel() { | 
					
						
							|  |  |  |     const context = this.context; | 
					
						
							|  |  |  |     //下载模型 | 
					
						
							|  |  |  |     await getEsCarModel(context) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |