首页
This commit is contained in:
		
							parent
							
								
									2c2b7085de
								
							
						
					
					
						commit
						fd997829d1
					
				| @ -2,7 +2,7 @@ | |||||||
|   "string": [ |   "string": [ | ||||||
|     { |     { | ||||||
|       "name": "app_name", |       "name": "app_name", | ||||||
|       "value": "car_next" |       "value": "鸿蒙车载" | ||||||
|     } |     } | ||||||
|   ] |   ] | ||||||
| } | } | ||||||
|  | |||||||
| @ -4,13 +4,13 @@ | |||||||
|       { |       { | ||||||
|         "name": "default", |         "name": "default", | ||||||
|         "material": { |         "material": { | ||||||
|           "certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer", |           "certpath": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.cer", | ||||||
|           "storePassword": "0000001B00F51DADDF4103D94A7D4FD6C4F54D73E1DE0B0AB4E51D9F7B3B63CAD636CB8B7AFECA0C817A28", |           "storePassword": "0000001B8DAD42641E5F7218D3617E25253F6E8B9D3E209D83F6E7D7A50EEA33CC9F3672C35C8893FE7C05", | ||||||
|           "keyAlias": "debugKey", |           "keyAlias": "debugKey", | ||||||
|           "keyPassword": "0000001BDCCBD8F284944B997A693592E7D77D62AEB605DD45A1935057816E45287006BA7BADF2C90CD9E7", |           "keyPassword": "0000001B8689E02F5E83BE0C395F8A4DC367C1B2C222600352DC5D93C9B8251DAA9B059371E119BEA7DFB1", | ||||||
|           "profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b", |           "profile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p7b", | ||||||
|           "signAlg": "SHA256withECDSA", |           "signAlg": "SHA256withECDSA", | ||||||
|           "storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p12" |           "storeFile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p12" | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     ], |     ], | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 1, | ||||||
|   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||||
|   "specifiers": {}, |   "specifiers": {}, | ||||||
|   "packages": {} |   "packages": {} | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ import { GlobalConfigType } from '../model'; | |||||||
|  * @Email: shutdown0630@163.com |  * @Email: shutdown0630@163.com | ||||||
|  */ |  */ | ||||||
| export const GlobalConfig: GlobalConfigType = { | export const GlobalConfig: GlobalConfigType = { | ||||||
|   comoonfileWriteAddress: '/mnt/hmdfs/100/account/device_view/local/files/duolun', |   commonFileWriteAddress: '/mnt/hmdfs/100/account/device_view/local/files/duolun', | ||||||
|   picSavePath: '/storage/cloud/100/files/Photo/', |   picSavePath: '/storage/cloud/100/files/Photo/', | ||||||
|   videoSavePath: '/storage/cloud/100/files/Videos/', |   videoSavePath: '/storage/cloud/100/files/Videos/', | ||||||
|   host: 'http://172.37.55.192:8082', |   host: 'http://172.37.55.192:8082', | ||||||
|  | |||||||
| @ -13,12 +13,10 @@ import FileUtils from '../utils/FileUtils'; | |||||||
| export default class EntryAbility extends UIAbility { | export default class EntryAbility extends UIAbility { | ||||||
|   async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { |   async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { | ||||||
|     try { |     try { | ||||||
|       console.log("sql first") |  | ||||||
|       await DB.init(this.context) |       await DB.init(this.context) | ||||||
|       await InitTable() |       await InitTable() | ||||||
|       console.log("sql first success") |  | ||||||
|       let fileUtil = new FileUtils(this.context) |       let fileUtil = new FileUtils(this.context) | ||||||
|       const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); |       const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'); | ||||||
|       if (data !== '' && data !== undefined) { |       if (data !== '' && data !== undefined) { | ||||||
|         const result: EnvironmentConfigurationType = JSON.parse(data) |         const result: EnvironmentConfigurationType = JSON.parse(data) | ||||||
|         AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", result) |         AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", result) | ||||||
| @ -38,7 +36,6 @@ export default class EntryAbility extends UIAbility { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async onWindowStageCreate(windowStage: window.WindowStage) { |   async onWindowStageCreate(windowStage: window.WindowStage) { | ||||||
|     // Main window is created, set main page for this ability |  | ||||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); | ||||||
|     const windowClass = await windowStage.getMainWindow(); |     const windowClass = await windowStage.getMainWindow(); | ||||||
|     let rect = windowClass.getWindowProperties().windowRect |     let rect = windowClass.getWindowProperties().windowRect | ||||||
| @ -63,8 +60,8 @@ export default class EntryAbility extends UIAbility { | |||||||
|       isJudgeInitBool: false, |       isJudgeInitBool: false, | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     AppStorage.setOrCreate('windowClass', windowClass) |     AppStorage.setOrCreate('windowClass', windowClass) | ||||||
|  |     await windowClass.setWindowLayoutFullScreen(true) | ||||||
|     await windowClass.setWindowSystemBarEnable([]) //全屏 |     await windowClass.setWindowSystemBarEnable([]) //全屏 | ||||||
|     windowStage.loadContent('pages/Index', (err, data) => { |     windowStage.loadContent('pages/Index', (err, data) => { | ||||||
|       if (err.code) { |       if (err.code) { | ||||||
| @ -74,7 +71,7 @@ export default class EntryAbility extends UIAbility { | |||||||
|       hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); |       hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     this.creatFiles(); |     this.createFiles(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   onWindowStageDestroy() { |   onWindowStageDestroy() { | ||||||
| @ -92,6 +89,6 @@ export default class EntryAbility extends UIAbility { | |||||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   creatFiles() { |   createFiles() { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -147,7 +147,7 @@ export interface EnvironmentConfigurationType { | |||||||
| 
 | 
 | ||||||
| //全局配置 | //全局配置 | ||||||
| export interface GlobalConfigType { | export interface GlobalConfigType { | ||||||
|   comoonfileWriteAddress?: string |   commonFileWriteAddress?: string | ||||||
|   picSavePath?: string |   picSavePath?: string | ||||||
|   videoSavePath?: string |   videoSavePath?: string | ||||||
|   host?: string |   host?: string | ||||||
|  | |||||||
| @ -82,7 +82,7 @@ struct Index { | |||||||
|           }) { |           }) { | ||||||
|             ForEach(this.imgArr1, (item: Resource, index: number) => { |             ForEach(this.imgArr1, (item: Resource, index: number) => { | ||||||
|               if (index === this.imgArr1.length - 1) { |               if (index === this.imgArr1.length - 1) { | ||||||
|                 imageBtn({ btnWidth: '38%', btnHeight: '24%', imgSrc: item }) |                 imageBtn({ btnWidth: '38%', imgSrc: item }) | ||||||
|                   .onClick(() => { |                   .onClick(() => { | ||||||
|                     if (this.inputTextArr[0].trim() == '' || this.inputTextArr[1].trim() == '') { |                     if (this.inputTextArr[0].trim() == '' || this.inputTextArr[1].trim() == '') { | ||||||
|                       promptAction.showToast({ |                       promptAction.showToast({ | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ import { | |||||||
|   MASYSSETTableType, |   MASYSSETTableType, | ||||||
|   TimeSynchronizationRspBody |   TimeSynchronizationRspBody | ||||||
| } from '../model'; | } from '../model'; | ||||||
| import { GetCarInfo, GetDeviceInfo, SetCurrentTime, SetSerialNumber, UseAuth } from './Index/utils'; | import { GetCarInfo, GetDeviceInfo, SetCurrentTime, UseAuth } from './Index/utils'; | ||||||
| import { GetSyncData, InitializeTheCentralTable } from '../utils/table/Operation'; | import { GetSyncData, InitializeTheCentralTable } from '../utils/table/Operation'; | ||||||
| import { BusinessError } from '@ohos.base'; | import { BusinessError } from '@ohos.base'; | ||||||
| import { delPic } from '../utils/Video'; | import { delPic } from '../utils/Video'; | ||||||
| @ -25,6 +25,7 @@ import { DrivingDataStorage } from '../utils/business/DrivingDataStorage'; | |||||||
| import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness'; | import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness'; | ||||||
| import { JudgeEmitterInstance } from '../utils/business/UdpEvent'; | import { JudgeEmitterInstance } from '../utils/business/UdpEvent'; | ||||||
| import { LoadingDialog } from './Index/Loading'; | import { LoadingDialog } from './Index/Loading'; | ||||||
|  | import { ExitDialog } from './Index/ExitDialog' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @Entry | @Entry | ||||||
| @ -46,7 +47,6 @@ struct Index { | |||||||
|   @State num: number = 0; |   @State num: number = 0; | ||||||
|   private context = getContext(this) as common.UIAbilityContext; |   private context = getContext(this) as common.UIAbilityContext; | ||||||
|   private fileHelper: FileHelper = new FileHelper(this.context) |   private fileHelper: FileHelper = new FileHelper(this.context) | ||||||
|   private interval = -1; |  | ||||||
|   private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context) |   private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context) | ||||||
|   private timeInfo: TimeSynchronizationRspBody = {} |   private timeInfo: TimeSynchronizationRspBody = {} | ||||||
|   private loadingDialog: CustomDialogController = new CustomDialogController({ |   private loadingDialog: CustomDialogController = new CustomDialogController({ | ||||||
| @ -55,6 +55,20 @@ struct Index { | |||||||
|     alignment: DialogAlignment.Center, |     alignment: DialogAlignment.Center, | ||||||
|     autoCancel: false |     autoCancel: false | ||||||
|   }) |   }) | ||||||
|  |   private delDialog: CustomDialogController = new CustomDialogController({ | ||||||
|  |     builder: LoadingDialog({ | ||||||
|  |       text: "正在清理本地数据,请稍候……" | ||||||
|  |     }), | ||||||
|  |     customStyle: true, | ||||||
|  |     alignment: DialogAlignment.Center, | ||||||
|  |     autoCancel: false | ||||||
|  |   }) | ||||||
|  |   private exitDialog: CustomDialogController = new CustomDialogController({ | ||||||
|  |     builder: ExitDialog(), | ||||||
|  |     customStyle: true, | ||||||
|  |     alignment: DialogAlignment.Center, | ||||||
|  |     autoCancel: false | ||||||
|  |   }) | ||||||
|   private errorDialog: CustomDialogController = new CustomDialogController({ |   private errorDialog: CustomDialogController = new CustomDialogController({ | ||||||
|     builder: errorMsgDialog({ |     builder: errorMsgDialog({ | ||||||
|       title: AppStorage.get('title'), |       title: AppStorage.get('title'), | ||||||
| @ -74,15 +88,13 @@ 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 }) |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
|  |     await UseAuth(this.context) | ||||||
|     this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4 |     this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4 | ||||||
|     this.angle = 0 |     this.angle = 0 | ||||||
|     AppStorage.set('lsh', '1111111111111') |     AppStorage.set('lsh', '1111111111111') | ||||||
|     // TODO 未改 |  | ||||||
|     // globalThis.errorDialog = this.errorDialog |  | ||||||
|     JudgeEmitterInstance.init() |     JudgeEmitterInstance.init() | ||||||
|     GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => { |     GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => { | ||||||
|       res.forEach((element) => { |       res.forEach((element) => { | ||||||
| @ -110,6 +122,52 @@ struct Index { | |||||||
|     AppStorage.setOrCreate('lsh', '1111111111111') |     AppStorage.setOrCreate('lsh', '1111111111111') | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   exam() { | ||||||
|  |     this.loadingDialog.open() | ||||||
|  |     if (!this.timeInfo) { | ||||||
|  |       AppStorage.setOrCreate('type', 1) | ||||||
|  |       AppStorage.setOrCreate('title', '时间同步接口连接失败') | ||||||
|  |       this.errorDialog.open() | ||||||
|  |       promptAction.showToast({ | ||||||
|  |         message: `时间同步接口连接失败`, | ||||||
|  |         duration: 3000 | ||||||
|  |       }); | ||||||
|  |       this.loadingDialog.close() | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     if (!this.carInfo) { | ||||||
|  |       promptAction.showToast({ | ||||||
|  |         message: `车辆信息接口获取失败`, | ||||||
|  |         duration: 3000 | ||||||
|  |       }); | ||||||
|  |       AppStorage.setOrCreate('type', 1) | ||||||
|  |       AppStorage.setOrCreate('title', '车辆信息接口获取失败') | ||||||
|  |       this.errorDialog.open() | ||||||
|  |       this.loadingDialog.close() | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     this.testXMLToJSONInWorker() | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   practice() { | ||||||
|  |     if (JudgeConfig.isTrajectoryOpen) { | ||||||
|  |       router.pushUrl({ | ||||||
|  |         url: 'pages/UserInfo', | ||||||
|  |       }, router.RouterMode.Single) | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     //判断数据库是否有表数据,有则直接跳转,没有则读取本地数据 | ||||||
|  |     GetSyncData<MASYSSETTableType>('MA_SYSSET').then((data: Array<MASYSSETTableType>) => { | ||||||
|  |       if (data?.[0]) { | ||||||
|  |         router.pushUrl({ | ||||||
|  |           url: 'pages/UserInfo', | ||||||
|  |         }, router.RouterMode.Single) | ||||||
|  |       } else { | ||||||
|  |         this.testXMLToJSONInWorker() | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   async testXMLToJSONInWorker() { |   async testXMLToJSONInWorker() { | ||||||
|     const param: InitializeTheCentralTableType = { |     const param: InitializeTheCentralTableType = { | ||||||
|       carId: this.carInfo?.carId, |       carId: this.carInfo?.carId, | ||||||
| @ -151,31 +209,6 @@ struct Index { | |||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async heartMsg() { |  | ||||||
|     // const signNum = AppStorage.get<number>('signNum') |  | ||||||
|     // const statue = AppStorage.get<string>('statue') |  | ||||||
|     // const lsh = AppStorage.get<string>('lsh') |  | ||||||
|     // const arr = [signNum || 0, statue || 1] |  | ||||||
|     // let tmpList: number[] = []; |  | ||||||
|     // tmpList.push(NumberToByteArray(Number(arr[0]), 1 * 8)[0]) |  | ||||||
|     // tmpList.push(NumberToByteArray(Number(arr[1]), 1 * 8)[0]) |  | ||||||
|     // const str = lsh || '0000000000000' |  | ||||||
|     // for (let i = 0; i < str.length; i++) { |  | ||||||
|     //   tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0]) |  | ||||||
|     // } |  | ||||||
|     // TODO 未改 |  | ||||||
|     // const param = { |  | ||||||
|     //   id: 31, |  | ||||||
|     //   list: tmpList, |  | ||||||
|     //   carNo: this.carInfo.carNo, |  | ||||||
|     //   placeId: this.carInfo.examinationRoomId |  | ||||||
|     // } |  | ||||||
|     // globalThis.udpClient2.initHeartSendMsg(param,this.context) |  | ||||||
|     // if (globalThis.udpClient2.getStatus()) { |  | ||||||
|     //   globalThis.udpClient2.sendMsgExt(param, this.context) |  | ||||||
|     // } |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   async createAlbum() { |   async createAlbum() { | ||||||
|     const time = GetCurrentTime() |     const time = GetCurrentTime() | ||||||
|     const date = time.split(' ')[0] |     const date = time.split(' ')[0] | ||||||
| @ -188,7 +221,6 @@ struct Index { | |||||||
|     console.log("test1111") |     console.log("test1111") | ||||||
|     ObtainUdpBusinessInstance.init(); |     ObtainUdpBusinessInstance.init(); | ||||||
|     CenterUDPBusinessInstance.init(); |     CenterUDPBusinessInstance.init(); | ||||||
|     CenterUDPBusinessInstance.startHeartBeat() |  | ||||||
|     CenterUDPBusinessInstance.onMsg((data: centerCallBackMsgType) => { |     CenterUDPBusinessInstance.onMsg((data: centerCallBackMsgType) => { | ||||||
|       if (data.id == 32) { |       if (data.id == 32) { | ||||||
|         AppStorage.setOrCreate('signNum', data.body[1]) |         AppStorage.setOrCreate('signNum', data.body[1]) | ||||||
| @ -206,247 +238,95 @@ struct Index { | |||||||
|     JudgeUdpBusinessInstance.init() |     JudgeUdpBusinessInstance.init() | ||||||
|     // TODO 摄像头遮挡 |     // TODO 摄像头遮挡 | ||||||
|     // takePhotoFn(this.context) |     // takePhotoFn(this.context) | ||||||
|     clearInterval(this.interval) |     // TODO | ||||||
|     this.interval = setInterval(() => { |     // CenterUDPBusinessInstance.startHeartBeat() | ||||||
|       this.num++ |  | ||||||
|       SetSerialNumber() |  | ||||||
|       if (this.num >= 3) { |  | ||||||
|         this.heartMsg() |  | ||||||
|       } |  | ||||||
|     }, 1000) |  | ||||||
|     this.createAlbum() |     this.createAlbum() | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   build() { |   build() { | ||||||
|     Column() { |     Column() { | ||||||
|       Column() { |       Row() { | ||||||
|  |         Image($r('app.media.logo')).width('30%').margin({ left: 24 }) | ||||||
|         Row() { |         Row() { | ||||||
|           Image($r('app.media.logo')).width('30%').height('5.5%').margin({ left: 24 }) |           Image($r('app.media.btn_setting')).width('16.7%') | ||||||
|           Row() { |             .onClick(async () => { | ||||||
|             Image($r('app.media.btn_setting')).width('16.7%').height('12.2%') |  | ||||||
|               .onClick(async () => { |  | ||||||
|                 // this.vocObj.playAudio({ |  | ||||||
|                 //   type: 1, |  | ||||||
|                 //   name: 'button_media.wav' |  | ||||||
|                 // }) |  | ||||||
|                 // deleteAllPicturesFn() |  | ||||||
|                 router.pushUrl({ |  | ||||||
|                   url: 'pages/Settings', |  | ||||||
|                 }, router.RouterMode.Single); |  | ||||||
|               }) |  | ||||||
|             Image($r('app.media.btn_back')).width('14.4%').height('12.2%') |  | ||||||
|               .onClick(() => { |  | ||||||
|                 // this.vocObj.playAudio({ |  | ||||||
|                 //   type: 1, |  | ||||||
|                 //   name: 'button_media.wav' |  | ||||||
|                 // }) |  | ||||||
|                 this.dialogVisible = true |  | ||||||
|               }) |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         .width('100%') |  | ||||||
|         .justifyContent(FlexAlign.SpaceBetween) |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       Column() { |  | ||||||
|         Row() { |  | ||||||
|           if (!this.singlePlay) { |  | ||||||
|             imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') }) |  | ||||||
|               .margin({ left: 80 * this.ratio }) |  | ||||||
|               .onClick(async () => { |  | ||||||
|                 this.loadingDialog.open() |  | ||||||
|                 // this.vocObj.playAudio({ |  | ||||||
|                 //   type: 1, |  | ||||||
|                 //   name: 'button_media.wav' |  | ||||||
|                 // }) |  | ||||||
|                 // ||!this.initParamFlag |  | ||||||
|                 if (!this.timeInfo) { |  | ||||||
|                   AppStorage.setOrCreate('type', 1) |  | ||||||
|                   AppStorage.setOrCreate('title', '时间同步接口连接失败') |  | ||||||
|                   this.errorDialog.open() |  | ||||||
|                   promptAction.showToast({ |  | ||||||
|                     message: `时间同步接口连接失败`, |  | ||||||
|                     duration: 3000 |  | ||||||
|                   }); |  | ||||||
|                   this.loadingDialog.close() |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 if (!this.carInfo) { |  | ||||||
|                   promptAction.showToast({ |  | ||||||
|                     message: `车辆信息接口获取失败`, |  | ||||||
|                     duration: 3000 |  | ||||||
|                   }); |  | ||||||
|                   AppStorage.setOrCreate('type', 1) |  | ||||||
|                   AppStorage.setOrCreate('title', '车辆信息接口获取失败') |  | ||||||
|                   this.errorDialog.open() |  | ||||||
|                   this.loadingDialog.close() |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 this.testXMLToJSONInWorker() |  | ||||||
|               }) |  | ||||||
|           } |  | ||||||
|           if (this.singlePlay) { |  | ||||||
|             imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') }) |  | ||||||
|               .margin({ left: 80 * this.ratio }) |  | ||||||
|               .onClick(() => { |  | ||||||
|                 // this.vocObj.playAudio({ |  | ||||||
|                 //   type: 1, |  | ||||||
|                 //   name: 'button_media.wav' |  | ||||||
|                 // }) |  | ||||||
|                 if (JudgeConfig.isTrajectoryOpen) { |  | ||||||
|                   router.pushUrl({ |  | ||||||
|                     url: 'pages/UserInfo', |  | ||||||
|                   }, router.RouterMode.Single) |  | ||||||
|                   return |  | ||||||
|                 } |  | ||||||
|                 //判断数据库是否有表数据,有则直接跳转,没有则读取本地数据 |  | ||||||
|                 GetSyncData<MASYSSETTableType>('MA_SYSSET').then((data: Array<MASYSSETTableType>) => { |  | ||||||
|                   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 * this.ratio }) |  | ||||||
|             .onClick(() => { |  | ||||||
|               // this.vocObj.playAudio({ |  | ||||||
|               //   type: 1, |  | ||||||
|               //   name: 'button_media.wav' |  | ||||||
|               // }) |  | ||||||
|               router.pushUrl({ |               router.pushUrl({ | ||||||
|                 url: 'pages/CarCheck' |                 url: 'pages/Settings', | ||||||
|               }, router.RouterMode.Single); |               }, router.RouterMode.Single); | ||||||
|             }) |             }) | ||||||
|         } |           Image($r('app.media.btn_back')).width('14.4%') | ||||||
|         .width('100%') |  | ||||||
|         .justifyContent(FlexAlign.SpaceAround) |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       Column() { |  | ||||||
|         Row() { |  | ||||||
|           Column() { |  | ||||||
|             Text('V外壳:' + this.baseInfo?.version) |  | ||||||
|               .fontColor('#CCAE7A') |  | ||||||
|               .fontSize(18 * this.ratio) |  | ||||||
|               .width('30%') |  | ||||||
|               .margin({ bottom: 10 }) |  | ||||||
|             Text('V评判:' + this.baseInfo.judgeVersion) |  | ||||||
|               .fontColor('#CCAE7A') |  | ||||||
|               .fontSize(18 * this.ratio) |  | ||||||
|               .width('30%') |  | ||||||
|               .margin({ bottom: 10 }) |  | ||||||
| 
 |  | ||||||
|             Text('授权信息:' + (this.baseInfo.hasAuth ? '已授权' : '未授权')) |  | ||||||
|               .fontColor('#CCAE7A') |  | ||||||
|               .fontSize(18 * this.ratio) |  | ||||||
|               .width('30%') |  | ||||||
|           } |  | ||||||
|           .margin({ left: 24 }) |  | ||||||
|           .gesture( |  | ||||||
|             GestureGroup(GestureMode.Exclusive, |  | ||||||
|               TapGesture({ count: 2 }) |  | ||||||
|                 .onAction(() => { |  | ||||||
|                   // takePhotoFn(this.context) |  | ||||||
|                   this.singlePlay = !this.singlePlay |  | ||||||
|                   AppStorage.setOrCreate('singlePlay', this.singlePlay) |  | ||||||
| 
 |  | ||||||
|                 }) |  | ||||||
|             ) |  | ||||||
|           ) |  | ||||||
| 
 |  | ||||||
|           Text('考车号:' + this.deviceId) |  | ||||||
|             .fontColor('#CCAE7A') |  | ||||||
|             .fontSize(22 * this.ratio) |  | ||||||
|             .margin({ right: 24 }) |  | ||||||
|         } |  | ||||||
|         .width('100%') |  | ||||||
|         .justifyContent(FlexAlign.SpaceBetween) |  | ||||||
|         .margin({ bottom: 10 }) |  | ||||||
|       }.height(100) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|       if (this.dialogVisible) { |  | ||||||
|         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(() => { |             .onClick(() => { | ||||||
|               this.dialogVisible = false |               this.exitDialog.open() | ||||||
|               // 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.vocObj.playAudio({ |  | ||||||
|               //   type: 1, |  | ||||||
|               //   name: 'button_media.wav' |  | ||||||
|               // }) |  | ||||||
|               router.back() |  | ||||||
|             }) |             }) | ||||||
|           }.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) { |       .width('100%') | ||||||
|  |       .justifyContent(FlexAlign.SpaceBetween) | ||||||
|  | 
 | ||||||
|  |       Row() { | ||||||
|  |         imageBtn({ btnWidth: '28%', imgSrc: this.singlePlay ? $r('app.media.index_dj') : $r('app.media.index_lw') }) | ||||||
|  |           .margin({ left: 80 * this.ratio }) | ||||||
|  |           .onClick(() => { | ||||||
|  |             if (this.singlePlay) { | ||||||
|  |               this.practice() | ||||||
|  |             } else { | ||||||
|  |               this.exam() | ||||||
|  |             } | ||||||
|  |           }) | ||||||
|  |         imageBtn({ btnWidth: '28%', imgSrc: $r('app.media.index_zj') }) | ||||||
|  |           .margin({ right: 80 * this.ratio }) | ||||||
|  |           .onClick(() => { | ||||||
|  |             router.pushUrl({ | ||||||
|  |               url: 'pages/CarCheck' | ||||||
|  |             }, router.RouterMode.Single); | ||||||
|  |           }) | ||||||
|  |       } | ||||||
|  |       .padding({ top: 30, bottom: 30 }) | ||||||
|  |       .layoutWeight(1) | ||||||
|  |       .width('100%') | ||||||
|  |       .justifyContent(FlexAlign.SpaceAround) | ||||||
|  | 
 | ||||||
|  |       Row() { | ||||||
|         Column() { |         Column() { | ||||||
|           Image($r('app.media.open_loading')) |           Text('V外壳:' + this.baseInfo?.version) | ||||||
|             .width(200 * this.ratio) |             .fontColor('#CCAE7A') | ||||||
|             .rotate({ angle: this.angle }) |             .fontSize(28) | ||||||
|             .height(200 * this.ratio) |             .width('30%') | ||||||
|             .animation({ |             .margin({ bottom: 10 }) | ||||||
|               duration: 5000, // 动画时长 |           Text('V评判:' + this.baseInfo.judgeVersion) | ||||||
|               curve: Curve.EaseOut, // 动画曲线 |             .fontColor('#CCAE7A') | ||||||
|               delay: 500, // 动画延迟 |             .fontSize(28) | ||||||
|               iterations: -1, // 播放次数 |             .width('30%') | ||||||
|               playMode: PlayMode.Normal, // 动画模式 |             .margin({ bottom: 10 }) | ||||||
|             }) |  | ||||||
|             .margin({ top: 30 * this.ratio }) |  | ||||||
| 
 | 
 | ||||||
|           Text('正在清理本地数据,请稍候……') |           Text('授权信息:' + (this.baseInfo.hasAuth ? '已授权' : '未授权')) | ||||||
|             .fontSize(24 * this.ratio) |             .fontColor('#CCAE7A') | ||||||
|             .margin({ top: 20 * this.ratio }) |             .fontSize(28) | ||||||
|             .fontWeight(400) |             .width('30%') | ||||||
|         } |         } | ||||||
|         .visibility(this.delLoading ? Visibility.Visible : Visibility.Hidden) |         .margin({ left: 24 }) | ||||||
|         .width(660 * this.ratio) |         .gesture( | ||||||
|         .height(360 * this.ratio) |           GestureGroup(GestureMode.Exclusive, | ||||||
|         .position({ x: 150 * this.ratio, y: 98 * this.ratio }) |             TapGesture({ count: 2 }) | ||||||
|         .backgroundColor('#E6E3DF') |               .onAction(() => { | ||||||
|         .borderRadius(19 * this.ratio) |                 this.singlePlay = !this.singlePlay | ||||||
|  |                 AppStorage.setOrCreate('singlePlay', this.singlePlay) | ||||||
|  |               }) | ||||||
|  |           ) | ||||||
|  |         ) | ||||||
|  | 
 | ||||||
|  |         Text('考车号:' + this.deviceId) | ||||||
|  |           .fontColor('#CCAE7A') | ||||||
|  |           .fontSize(36) | ||||||
|  |           .margin({ right: 24 }) | ||||||
|       } |       } | ||||||
|  |       .padding({ top: 10, bottom: 10 }) | ||||||
|  |       .width('100%') | ||||||
|  |       .justifyContent(FlexAlign.SpaceBetween) | ||||||
|     } |     } | ||||||
|     .width('100%') |     .width('100%') | ||||||
|     .height('100%') |     .height('100%') | ||||||
|     .justifyContent(FlexAlign.SpaceBetween) |     .justifyContent(FlexAlign.SpaceBetween) | ||||||
|     .backgroundImage($r('app.media.index_bg')) |     .backgroundImage($r('app.media.index_bg')) | ||||||
|     .backgroundImageSize({ width: '100%', height: '100%' }) |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
							
								
								
									
										52
									
								
								entry/src/main/ets/pages/Index/ExitDialog.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								entry/src/main/ets/pages/Index/ExitDialog.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | |||||||
|  | import common from '@ohos.app.ability.common' | ||||||
|  | 
 | ||||||
|  | @CustomDialog | ||||||
|  | export struct ExitDialog { | ||||||
|  |   private controller: CustomDialogController | ||||||
|  | 
 | ||||||
|  |   @Styles | ||||||
|  |   commStyle(){ | ||||||
|  |     .width(220) | ||||||
|  |     .height(69) | ||||||
|  |     .backgroundImage($r('app.media.button_nor')) | ||||||
|  |     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   build() { | ||||||
|  |     Column() { | ||||||
|  |       Row() { | ||||||
|  |         Text('确认是否退出应用') | ||||||
|  |           .fontSize(36) | ||||||
|  |       }.margin({ bottom: 80 }) | ||||||
|  | 
 | ||||||
|  |       Flex({ justifyContent: FlexAlign.Center }) { | ||||||
|  |         Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { | ||||||
|  |           Text('  取   消  ') | ||||||
|  |             .fontSize(24) | ||||||
|  |             .fontColor('#fff') | ||||||
|  |             .width(100) | ||||||
|  |         } | ||||||
|  |         .commStyle() | ||||||
|  |         .onClick(() => { | ||||||
|  |           this.controller.close() | ||||||
|  |         }).margin({ right: 10 }) | ||||||
|  | 
 | ||||||
|  |         Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { | ||||||
|  |           Text('  确   定  ') | ||||||
|  |             .fontSize(24) | ||||||
|  |             .fontColor('#fff') | ||||||
|  |             .width(100) | ||||||
|  |         } | ||||||
|  |         .commStyle() | ||||||
|  |         .margin({ left: 10 }) | ||||||
|  |         .onClick(() => { | ||||||
|  |           (getContext(this) as common.UIAbilityContext).terminateSelf() | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     .width("45%") | ||||||
|  |     .padding({ left: 80, top: 60, right: 80, bottom: 60 }) | ||||||
|  |     .backgroundColor('#E6E3DF') | ||||||
|  |     .borderRadius(20) | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -1,15 +1,15 @@ | |||||||
| @CustomDialog | @CustomDialog | ||||||
| export struct LoadingDialog { | export struct LoadingDialog { | ||||||
|   @State |   @Prop private text: string = "获取考车信息,请稍候……" | ||||||
|   private angle: number = 0 |   @State private angle: number = 0 | ||||||
|   private controller: CustomDialogController |   private controller: CustomDialogController | ||||||
| 
 | 
 | ||||||
|   aboutToAppear(): void { |   aboutToAppear(): void { | ||||||
|     animateTo({ |     animateTo({ | ||||||
|       duration: 5000, // 动画时长 |       duration: 5000, | ||||||
|       curve: Curve.EaseOut, // 动画曲线 |       curve: Curve.EaseOut, | ||||||
|       iterations: -1, // 播放次数 |       iterations: -1, | ||||||
|       playMode: PlayMode.Normal, // 动画模式 |       playMode: PlayMode.Normal, | ||||||
|     }, () => { |     }, () => { | ||||||
|       this.angle += 360 |       this.angle += 360 | ||||||
|     }) |     }) | ||||||
| @ -26,7 +26,7 @@ export struct LoadingDialog { | |||||||
|         .width(80) |         .width(80) | ||||||
|         .height(80) |         .height(80) | ||||||
|         .position({ x: 288, y: 89 }) |         .position({ x: 288, y: 89 }) | ||||||
|       Text('获取考车信息,请稍候……') |       Text(this.text) | ||||||
|         .fontSize(24) |         .fontSize(24) | ||||||
|         .margin({ top: 20 }) |         .margin({ top: 20 }) | ||||||
|         .fontWeight(400) |         .fontWeight(400) | ||||||
|  | |||||||
| @ -23,7 +23,7 @@ import FileUtils from '../../utils/FileUtils'; | |||||||
| export async function GetDeviceInfo(context: common.UIAbilityContext): Promise<string> { | export async function GetDeviceInfo(context: common.UIAbilityContext): Promise<string> { | ||||||
|   return new Promise(async (resolve, reject) => { |   return new Promise(async (resolve, reject) => { | ||||||
|     const fileUtil = new FileUtils(context) |     const fileUtil = new FileUtils(context) | ||||||
|     const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); |     const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/deviceNo.txt'); | ||||||
|     if (data === '' || data === undefined) { |     if (data === '' || data === undefined) { | ||||||
|       Prompt.showToast({ |       Prompt.showToast({ | ||||||
|         message: "请先进行设备注册!", |         message: "请先进行设备注册!", | ||||||
| @ -63,16 +63,13 @@ export async function UseAuth(context: common.UIAbilityContext): Promise<boolean | |||||||
|     abilityAccessCtrl.createAtManager().requestPermissionsFromUser(context, permissions).then(res => { |     abilityAccessCtrl.createAtManager().requestPermissionsFromUser(context, permissions).then(res => { | ||||||
|       let grantStatus: Array<number> = res.authResults; |       let grantStatus: Array<number> = res.authResults; | ||||||
|       let length: number = grantStatus.length; |       let length: number = grantStatus.length; | ||||||
|       resolve(true) |  | ||||||
|       for (let i = 0; i < length; i++) { |       for (let i = 0; i < length; i++) { | ||||||
|         if (grantStatus[i] === 0) { |         if (grantStatus[i] !== 0) { | ||||||
|           // 用户授权,可以继续访问目标操作 |  | ||||||
|         } else { |  | ||||||
|           reject(false) |           reject(false) | ||||||
|           // 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限 |  | ||||||
|           return; |           return; | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |       resolve(true) | ||||||
|     }).catch((err: BusinessError) => { |     }).catch((err: BusinessError) => { | ||||||
|       console.log("获取权限失败", JSON.stringify(err)) |       console.log("获取权限失败", JSON.stringify(err)) | ||||||
|       reject(false) |       reject(false) | ||||||
| @ -119,7 +116,7 @@ export async function TakePhoto(context: common.UIAbilityContext) { | |||||||
|     spzd4: false, |     spzd4: false, | ||||||
|   } |   } | ||||||
|   const fileUtil = new FileUtils(context) |   const fileUtil = new FileUtils(context) | ||||||
|   const fileData = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt'); |   const fileData = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt'); | ||||||
|   param = JSON.parse(fileData) |   param = JSON.parse(fileData) | ||||||
|   clearInterval(interval) |   clearInterval(interval) | ||||||
|   interval = setTimeout(async () => { |   interval = setTimeout(async () => { | ||||||
|  | |||||||
| @ -141,7 +141,7 @@ struct Index { | |||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
|     this.fileUtil = new FileUtils(this.context) |     this.fileUtil = new FileUtils(this.context) | ||||||
|     const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); |     const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'); | ||||||
|     if (data === '' || data === undefined) { |     if (data === '' || data === undefined) { | ||||||
|     } else { |     } else { | ||||||
|       const result: EnvironmentConfigurationType = JSON.parse(data) |       const result: EnvironmentConfigurationType = JSON.parse(data) | ||||||
|  | |||||||
| @ -616,7 +616,7 @@ struct Index { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getVideoConfig() { |   async getVideoConfig() { | ||||||
|     const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt'); |     const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt'); | ||||||
|     this.oldParam = JSON.parse(data) |     this.oldParam = JSON.parse(data) | ||||||
|     this.param = JSON.parse(data) |     this.param = JSON.parse(data) | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -317,7 +317,7 @@ export default struct FaceCompare { | |||||||
|       } |       } | ||||||
|     }, this.context); |     }, this.context); | ||||||
| 
 | 
 | ||||||
|     const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt'); |     const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt'); | ||||||
|     console.log('faceEnterIn,data', data) |     console.log('faceEnterIn,data', data) | ||||||
| 
 | 
 | ||||||
|     setTimeout(() => { |     setTimeout(() => { | ||||||
|  | |||||||
| @ -19,26 +19,22 @@ export default struct TopLogo { | |||||||
|       } |       } | ||||||
|       .backgroundColor('#333230') |       .backgroundColor('#333230') | ||||||
|       .width('100%') |       .width('100%') | ||||||
|       .height('10%') |       .height('100%') | ||||||
| 
 | 
 | ||||||
|       Row() { |       Row() { | ||||||
|         Row() { |         Row() { | ||||||
|           Image($r('app.media.shortLogo')) |           Image($r('app.media.shortLogo')) | ||||||
|             .width('10.2%') |             .width('10.2%') | ||||||
|             .height('5.7%') |             .height('75%') | ||||||
|             .margin({ left: 30 * this.ratio, top: -15 * this.ratio }) |             .margin({ left: 30 * this.ratio, top: -15 * this.ratio }) | ||||||
|           Text(this.timeText) |           Text(this.timeText) | ||||||
|             .fontSize(30 * this.ratio) |             .fontSize(30 * this.ratio) | ||||||
|             .fontColor('#CCB48F') |             .fontColor('#CCB48F') | ||||||
|             .margin({ top: -15 * this.ratio, left: 14 * this.ratio }) //fontsize40 |             .margin({ top: -15 * this.ratio, left: 14 * this.ratio }) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         imageBtn({ btnWidth: '16.7%', btnHeight: '12.2%', imgSrc: $r('app.media.topB_back') }) |         imageBtn({ btnWidth: '13.5%', imgSrc: $r('app.media.topB_back') }) | ||||||
|           .onClick(() => { |           .onClick(() => { | ||||||
|             // this.vocObj.playAudio({ |  | ||||||
|             //   type: 1, |  | ||||||
|             //   name: 'button_media.wav' |  | ||||||
|             // }) |  | ||||||
|             this.outFlag = true |             this.outFlag = true | ||||||
|             router.back() |             router.back() | ||||||
|           }) |           }) | ||||||
| @ -48,6 +44,7 @@ export default struct TopLogo { | |||||||
|       .justifyContent(FlexAlign.SpaceBetween) |       .justifyContent(FlexAlign.SpaceBetween) | ||||||
|     } |     } | ||||||
|     .width('100%') |     .width('100%') | ||||||
|  |     .height('8%') | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
| @ -55,11 +52,6 @@ export default struct TopLogo { | |||||||
|     this.timer = setInterval(async () => { |     this.timer = setInterval(async () => { | ||||||
|       this.timeText = GetCurrentTime(); |       this.timeText = GetCurrentTime(); | ||||||
|     }, 1000) |     }, 1000) | ||||||
|     // this.vocObj = new voiceService(async (status,val) => { |  | ||||||
|     //   if (status == 'idle') { |  | ||||||
|     //     router.back() |  | ||||||
|     //   } |  | ||||||
|     // }); |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   aboutToDisappear() { |   aboutToDisappear() { | ||||||
|  | |||||||
| @ -1,10 +1,9 @@ | |||||||
| @Component | @Component | ||||||
| export default struct imageBtn { | export default struct imageBtn { | ||||||
|   //状态变量unPressed,用于控制按钮的状态 |  | ||||||
|   @State unPressed: boolean = true |   @State unPressed: boolean = true | ||||||
|  |   @Prop imgSrc: Resource | ||||||
|   btnWidth?: string | number |   btnWidth?: string | number | ||||||
|   btnHeight?: string | number |   btnHeight?: string | number | ||||||
|   imgSrc?: Resource |  | ||||||
|   opacityNum: number = 1 |   opacityNum: number = 1 | ||||||
| 
 | 
 | ||||||
|   @Styles |   @Styles | ||||||
| @ -17,27 +16,19 @@ export default struct imageBtn { | |||||||
|     Column() { |     Column() { | ||||||
|       Column() { |       Column() { | ||||||
|         Stack() { |         Stack() { | ||||||
|           // Image($r('app.media.topB_back')) |  | ||||||
|           Row() { |           Row() { | ||||||
|             // 判断当前组件为放开状态 |  | ||||||
|             if (this.unPressed) { |             if (this.unPressed) { | ||||||
|               // 插入Row组件,配置过渡效果 |  | ||||||
|               Image(this.imgSrc)// 水波纹扩散动画:Row组件backgroundColor属性变更(#fff -> #ccc),系统插入动画过渡效果,从组建的中心点开始放大,scale{0,0}变更scale{1,1} |               Image(this.imgSrc)// 水波纹扩散动画:Row组件backgroundColor属性变更(#fff -> #ccc),系统插入动画过渡效果,从组建的中心点开始放大,scale{0,0}变更scale{1,1} | ||||||
|                 .transition({ |                 .transition({ | ||||||
|                   type: TransitionType.Insert, |                   type: TransitionType.Insert, | ||||||
|                   opacity: 0, |                   opacity: 0, | ||||||
|                 }) |                 }) | ||||||
|             } |             } else { | ||||||
|             // 判断当前组件为按下状态 |  | ||||||
|             else if (!this.unPressed) { |  | ||||||
|               // 插入Row组件,配置过渡效果 |  | ||||||
|               Image(this.imgSrc) |               Image(this.imgSrc) | ||||||
|                 .opacity(this.opacityNum) |                 .opacity(this.opacityNum) | ||||||
|                 .onAppear(() => { |                 .onAppear(() => { | ||||||
|                   // 水波纹聚拢动画:Row组件backgroundColor属性变更(#ccc -> #fff),插入动画过渡效果,scale{1,1}变化为scale{0,0} |  | ||||||
|                   animateTo({ |                   animateTo({ | ||||||
|                     duration: 500, |                     duration: 500, | ||||||
|                     // 聚拢动画播放完成后,需要衔接扩散动画,此时Row组件backgroundColor属性变更(#fff -> #ccc),插入动画过渡效果,scale{0,0}变化为scale{1,1} |  | ||||||
|                     onFinish: () => { |                     onFinish: () => { | ||||||
|                       this.opacityNum = 1 |                       this.opacityNum = 1 | ||||||
|                     } |                     } | ||||||
| @ -56,17 +47,14 @@ export default struct imageBtn { | |||||||
|         .customStyle() |         .customStyle() | ||||||
|       } |       } | ||||||
|       .width(this.btnWidth) |       .width(this.btnWidth) | ||||||
|       .height(this.btnHeight) |       .height(this.btnHeight || "100%") | ||||||
|     } |     } | ||||||
|     // onTouch事件,监听状态 |  | ||||||
|     .onTouch((event: TouchEvent) => { |     .onTouch((event: TouchEvent) => { | ||||||
|       // 当按钮按下时,更新按钮的状态(unPressed:true -> false) |  | ||||||
|       if (event.type == TouchType.Down) { |       if (event.type == TouchType.Down) { | ||||||
|         animateTo({ duration: 400 }, () => { |         animateTo({ duration: 400 }, () => { | ||||||
|           this.unPressed = !this.unPressed |           this.unPressed = !this.unPressed | ||||||
|         }) |         }) | ||||||
|       } |       } | ||||||
|       // 当按钮放开时,更新按钮的状态(unPressed:false -> true) |  | ||||||
|       if (event.type == TouchType.Up) { |       if (event.type == TouchType.Up) { | ||||||
|         animateTo({ duration: 400 }, () => { |         animateTo({ duration: 400 }, () => { | ||||||
|           this.unPressed = !this.unPressed |           this.unPressed = !this.unPressed | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ interface RequestOption { | |||||||
|   timeout?: number |   timeout?: number | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const base: string = "" | const base: string = AppStorage.get("host") || "http://127.0.0.1" | ||||||
| 
 | 
 | ||||||
| function xmlToJSON(target: string): object { | function xmlToJSON(target: string): object { | ||||||
|   let conv = new convertxml.ConvertXML() |   let conv = new convertxml.ConvertXML() | ||||||
|  | |||||||
| @ -86,7 +86,7 @@ export async function saveStartRecordVideo(path: string, context: common.UIAbili | |||||||
|     const date = dayTs().format('YYYY-MM-DD HH:mm:ss').split(' ')[0] |     const date = dayTs().format('YYYY-MM-DD HH:mm:ss').split(' ')[0] | ||||||
|     fileHelper.createAlbum(date); |     fileHelper.createAlbum(date); | ||||||
|     // const folderPath = await fileUtil.initFolder(`/${path}/${date}`); |     // const folderPath = await fileUtil.initFolder(`/${path}/${date}`); | ||||||
|     const data: string = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt'); |     const data: string = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt'); | ||||||
|     const param: VideoConfig = JSON.parse(data) |     const param: VideoConfig = JSON.parse(data) | ||||||
|     const record_handle: RecordHandleType = { |     const record_handle: RecordHandleType = { | ||||||
|       rocord_handle1: 0, |       rocord_handle1: 0, | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ import { fillZero, string2Bytes } from '../../pages/judgeSDK/utils/Common'; | |||||||
| import { NumberToByteArray } from '../Common'; | import { NumberToByteArray } from '../Common'; | ||||||
| import UdpClient from '../UdpUtils'; | import UdpClient from '../UdpUtils'; | ||||||
| import { UDPTag } from '../../config'; | import { UDPTag } from '../../config'; | ||||||
|  | import { SetSerialNumber } from '../../pages/Index/utils'; | ||||||
| 
 | 
 | ||||||
| // 中心UDP业务逻辑 | // 中心UDP业务逻辑 | ||||||
| class CenterUDPBusiness { | class CenterUDPBusiness { | ||||||
| @ -91,6 +92,7 @@ class CenterUDPBusiness { | |||||||
|   startHeartBeat() { |   startHeartBeat() { | ||||||
|     // 组装消息,一秒发送一次 |     // 组装消息,一秒发送一次 | ||||||
|     this.timer = setInterval(() => { |     this.timer = setInterval(() => { | ||||||
|  |       SetSerialNumber() | ||||||
|       const signNum = AppStorage.get<number>('signNum') |       const signNum = AppStorage.get<number>('signNum') | ||||||
|       const statue = AppStorage.get<string>('statue') |       const statue = AppStorage.get<string>('statue') | ||||||
|       const lsh = AppStorage.get<string>('lsh') |       const lsh = AppStorage.get<string>('lsh') | ||||||
| @ -128,6 +130,7 @@ class CenterUDPBusiness { | |||||||
|         let result: EnvironmentConfigurationType = |         let result: EnvironmentConfigurationType = | ||||||
|           AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")! |           AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")! | ||||||
|         const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')! |         const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')! | ||||||
|  |         AppStorage.setOrCreate("host", `http://${result.centerIp}:${result.centerPort}`) | ||||||
|         this.udp.create(result.udplocalIp!, '8800', carInfo.udpAddress!, carInfo.messagePort!) |         this.udp.create(result.udplocalIp!, '8800', carInfo.udpAddress!, carInfo.messagePort!) | ||||||
|           .then(resolve) |           .then(resolve) | ||||||
|           .catch(reject) |           .catch(reject) | ||||||
|  | |||||||
| @ -103,7 +103,7 @@ export async function InitializeTheCentralTable(params: InitializeTheCentralTabl | |||||||
|           'MAP_SUBITEM', 'MA_T_CARPARMSET', 'MA_MAP_ITEMCLASS', 'MA_MAP_POINT', 'MA_MAP_POINT_ITEM']; |           'MAP_SUBITEM', 'MA_T_CARPARMSET', 'MA_MAP_ITEMCLASS', 'MA_MAP_POINT', 'MA_MAP_POINT_ITEM']; | ||||||
|       for (let i = 0; i <= tableList.length - 1; i++) { |       for (let i = 0; i <= tableList.length - 1; i++) { | ||||||
|         const data = |         const data = | ||||||
|           await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + `/config/tableList/${tableList[i]}.txt`); |           await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + `/config/tableList/${tableList[i]}.txt`); | ||||||
|         flag = await SqlInsertTable(tableList[i], JSON.parse(data) || []) |         flag = await SqlInsertTable(tableList[i], JSON.parse(data) || []) | ||||||
|       } |       } | ||||||
|       if (!flag) { |       if (!flag) { | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ | |||||||
|         "name": "EntryAbility", |         "name": "EntryAbility", | ||||||
|         "srcEntry": "./ets/entryability/EntryAbility.ets", |         "srcEntry": "./ets/entryability/EntryAbility.ets", | ||||||
|         "description": "$string:EntryAbility_desc", |         "description": "$string:EntryAbility_desc", | ||||||
|         "icon": "$media:layered_image", |         "icon": "$media:logo_app", | ||||||
|         "label": "$string:EntryAbility_label", |         "label": "$string:EntryAbility_label", | ||||||
|         "startWindowIcon": "$media:startIcon", |         "startWindowIcon": "$media:startIcon", | ||||||
|         "startWindowBackground": "$color:start_window_background", |         "startWindowBackground": "$color:start_window_background", | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ | |||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       "name": "EntryAbility_label", |       "name": "EntryAbility_label", | ||||||
|       "value": "label" |       "value": "多伦科技驾驶人考试系统" | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       "name": "Permission_application", |       "name": "Permission_application", | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ | |||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       "name": "EntryAbility_label", |       "name": "EntryAbility_label", | ||||||
|       "value": "label" |       "value": "鸿蒙车载" | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       "name": "Permission_application", |       "name": "Permission_application", | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 1, | ||||||
|   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||||
|   "specifiers": { |   "specifiers": { | ||||||
|     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19", |     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19", | ||||||
| @ -8,13 +8,11 @@ | |||||||
|   "packages": { |   "packages": { | ||||||
|     "@ohos/hypium@1.0.19": { |     "@ohos/hypium@1.0.19": { | ||||||
|       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", | ||||||
|       "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==", |       "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==" | ||||||
|       "registryType": "ohpm" |  | ||||||
|     }, |     }, | ||||||
|     "@ohos/crypto-js@2.0.3": { |     "@ohos/crypto-js@2.0.3": { | ||||||
|       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", | ||||||
|       "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==", |       "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==" | ||||||
|       "registryType": "ohpm" |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user