init: 初始化
This commit is contained in:
		
							parent
							
								
									50cea7e87d
								
							
						
					
					
						commit
						6fc38e66d1
					
				| @ -1,6 +1,19 @@ | |||||||
| { | { | ||||||
|   "app": { |   "app": { | ||||||
|     "signingConfigs": [], |     "signingConfigs": [ | ||||||
|  |       { | ||||||
|  |         "name": "default", | ||||||
|  |         "material": { | ||||||
|  |           "certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer", | ||||||
|  |           "storePassword": "0000001BE66D421B205804C1F052841DA4C90D4B3A39A1553B3CA1CA21F934529A92D16A3A7A35A69A0A3D", | ||||||
|  |           "keyAlias": "debugKey", | ||||||
|  |           "keyPassword": "0000001B97A92453459A43E1B0A987037A6FECEB014956E03BFD674EE2D1602CA14A7774AE46012DA8A29B", | ||||||
|  |           "profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b", | ||||||
|  |           "signAlg": "SHA256withECDSA", | ||||||
|  |           "storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p12" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     ], | ||||||
|     "products": [ |     "products": [ | ||||||
|       { |       { | ||||||
|         "name": "default", |         "name": "default", | ||||||
|  | |||||||
| @ -1,43 +1,97 @@ | |||||||
| import AbilityConstant from '@ohos.app.ability.AbilityConstant'; |  | ||||||
| import hilog from '@ohos.hilog'; |  | ||||||
| import UIAbility from '@ohos.app.ability.UIAbility'; | import UIAbility from '@ohos.app.ability.UIAbility'; | ||||||
| import Want from '@ohos.app.ability.Want'; | import hilog from '@ohos.hilog'; | ||||||
| import window from '@ohos.window'; | import window from '@ohos.window'; | ||||||
|  | import { GlobalConfig } from '../config/global'; | ||||||
|  | import Want from '@ohos.app.ability.Want'; | ||||||
|  | import AbilityConstant from '@ohos.app.ability.AbilityConstant'; | ||||||
|  | import { BaseInfoType, CarInfoType, EnvironmentConfigurationType, ExaminerInfoType } from '../model'; | ||||||
|  | import DB from '../utils/DbSql'; | ||||||
|  | import { DrivingDataStorage } from '../utils/business/DrivingDataStorage'; | ||||||
|  | import { InitTable } from '../utils/table/Operation'; | ||||||
|  | import FileUtils from '../utils/FileUtils'; | ||||||
| 
 | 
 | ||||||
| export default class EntryAbility extends UIAbility { | export default class EntryAbility extends UIAbility { | ||||||
|   onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { |   async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { | ||||||
|  |     try { | ||||||
|  |       console.log("sql first") | ||||||
|  |       await DB.init(this.context) | ||||||
|  |       await InitTable() | ||||||
|  |       console.log("sql first success") | ||||||
|  |       let fileUtil = new FileUtils(this.context) | ||||||
|  |       const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); | ||||||
|  |       if (data !== '' && data !== undefined) { | ||||||
|  |         const result: EnvironmentConfigurationType = JSON.parse(data) | ||||||
|  |         AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", result) | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       console.error('sql first error', e) | ||||||
|  |     } | ||||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   onDestroy(): void { |   onDestroy() { | ||||||
|  |     const arrClose = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00] | ||||||
|  |     // TODO UDP缺失 | ||||||
|  |     // lightUDPClient.sendMsg(new Uint8Array(arrClose).buffer) | ||||||
|  |     DrivingDataStorage.close() | ||||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   onWindowStageCreate(windowStage: window.WindowStage): void { |   async onWindowStageCreate(windowStage: window.WindowStage) { | ||||||
|     // Main window is created, set main page for this ability |     // 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'); | ||||||
| 
 | 
 | ||||||
|     windowStage.loadContent('pages/Index', (err) => { |     AppStorage.setOrCreate<CarInfoType>('carInfo', {}) | ||||||
|  |     AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {}) | ||||||
|  |     AppStorage.setOrCreate<string>('lsh', '0000000000000') | ||||||
|  |     AppStorage.setOrCreate<string>('statue', "1") //考试状态 | ||||||
|  |     AppStorage.setOrCreate<number>('signNum', 0) //心跳指令编号 | ||||||
|  |     AppStorage.setOrCreate<string>('deviceNo', "") //设备号 | ||||||
|  |     AppStorage.setOrCreate<BaseInfoType>('baseInfo', { | ||||||
|  |       hasAuth: false, | ||||||
|  |       version: GlobalConfig.version.jn.km3[0] || "", | ||||||
|  |       judgeVersion: GlobalConfig.version.jn.km3[1] || "", | ||||||
|  |       tcpSendNum: 0, | ||||||
|  |       videoVersion: '1.0', | ||||||
|  |       ratio: 1280 / 960, //适配比例 | ||||||
|  |       pathDir: this.context.filesDir, | ||||||
|  |       context: this.context, | ||||||
|  |       isJudgeInitBool: false, | ||||||
|  |     }) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     const windowClass = await windowStage.getMainWindow(); | ||||||
|  |     AppStorage.setOrCreate('windowClass', windowClass) | ||||||
|  |     // await windowClass.setWindowLayoutFullScreen(true) | ||||||
|  |     await windowClass.setWindowSystemBarEnable([]) //全屏 | ||||||
|  |     // await windowClass.setWindowSystemBarEnable(['navigation']) | ||||||
|  | 
 | ||||||
|  |     windowStage.loadContent('pages/Index', (err, data) => { | ||||||
|       if (err.code) { |       if (err.code) { | ||||||
|         hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); |         hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.'); |       hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); | ||||||
|     }); |     }); | ||||||
|  | 
 | ||||||
|  |     this.creatFiles(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   onWindowStageDestroy(): void { |   onWindowStageDestroy() { | ||||||
|     // Main window is destroyed, release UI related resources |     // Main window is destroyed, release UI related resources | ||||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   onForeground(): void { |   onForeground() { | ||||||
|     // Ability has brought to foreground |     // Ability has brought to foreground | ||||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   onBackground(): void { |   onBackground() { | ||||||
|     // Ability has back to background |     // Ability has back to background | ||||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|  |   creatFiles() { | ||||||
|  |   } | ||||||
| } | } | ||||||
| @ -1,17 +1,531 @@ | |||||||
|  | import common from '@ohos.app.ability.common'; | ||||||
|  | import router from '@ohos.router'; | ||||||
|  | 
 | ||||||
|  | import { JudgeConfig } from './judgeSDK/utils/judgeConfig'; | ||||||
|  | import promptAction from '@ohos.promptAction'; | ||||||
|  | import errorMsgDialog from './compontents/errorMsgDialog'; | ||||||
|  | import imageBtn from './compontents/imageBtn'; | ||||||
|  | import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||||
|  | import { BaseInfoType, centerCallBackMsgType } from '../model/Common'; | ||||||
|  | import { | ||||||
|  |   CarInfoType, | ||||||
|  |   InitializeTheCentralTableType, | ||||||
|  |   MASYSSETTableType, | ||||||
|  |   TimeSynchronizationRspBody | ||||||
|  | } from '../model'; | ||||||
|  | import { GetCarInfo, GetDeviceInfo, SetCurrentTime, SetSerialNumber, UseAuth } from './Index/utils'; | ||||||
|  | import { GetSyncData, InitializeTheCentralTable } from '../utils/table/Operation'; | ||||||
|  | import { BusinessError } from '@ohos.base'; | ||||||
|  | import { delPic } from '../utils/Video'; | ||||||
|  | import { FileHelper } from '../utils/FileHelp'; | ||||||
|  | import { GetCurrentTime } from '../utils/Common'; | ||||||
|  | import { ObtainUdpBusinessInstance } from '../utils/business/ObtainUdpBusiness'; | ||||||
|  | import { CenterUDPClientInstance } from '../utils/business/CenterUdpBusiness'; | ||||||
|  | import { DrivingDataStorage } from '../utils/business/DrivingDataStorage'; | ||||||
|  | import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness'; | ||||||
|  | import { JudgeEmitterInstance } from '../utils/business/UdpEvent'; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| @Entry | @Entry | ||||||
| @Component | @Component | ||||||
| struct Index { | struct Index { | ||||||
|   @State message: string = 'Hello World'; |   @State url: string = '' | ||||||
|  |   @State hasAuth: boolean = false; | ||||||
|  |   @State dialogVisible: boolean = false; | ||||||
|  |   @State singlePlay: boolean = false; | ||||||
|  |   @State baseInfo: BaseInfoType = {}; | ||||||
|  |   @State deviceId: string = ''; | ||||||
|  |   @State angle: number = 0 | ||||||
|  |   @State dialogRatio: number = 0.8 | ||||||
|  |   @State ratio: number = 1700 / 960 | ||||||
|  |   @State delLoading: boolean = false | ||||||
|  |   @State loading: boolean = false | ||||||
|  |   @State initParamFlag: boolean = false | ||||||
|  |   @State fd: number = -1; | ||||||
|  |   @State carInfo: CarInfoType = {}; | ||||||
|  |   @State num: number = 0; | ||||||
|  |   errorDialog: CustomDialogController = new CustomDialogController({ | ||||||
|  |     builder: errorMsgDialog({ | ||||||
|  |       title: AppStorage.get('title'), | ||||||
|  |       type: AppStorage.get('type'), | ||||||
|  |       cancel: () => { | ||||||
|  |       }, | ||||||
|  |       confirm: () => { | ||||||
|  |       } | ||||||
|  |     }), | ||||||
|  |     customStyle: true, | ||||||
|  |     alignment: DialogAlignment.Center, | ||||||
|  |   }, | ||||||
|  |   ) | ||||||
|  |   private fileHelper!: FileHelper | ||||||
|  |   private interval = -1; | ||||||
|  |   private avPlayer!: VoiceAnnounce | ||||||
|  |   private timeInfo!: TimeSynchronizationRspBody | ||||||
|  |   private context = getContext(this) as common.UIAbilityContext; | ||||||
|  | 
 | ||||||
|  |   async aboutToAppear() { | ||||||
|  |     this.avPlayer = new VoiceAnnounce(this.context); | ||||||
|  |     this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4 | ||||||
|  |     this.initParamFlag = false | ||||||
|  |     this.delLoading = false | ||||||
|  |     this.dialogVisible = false | ||||||
|  |     this.angle = 0 | ||||||
|  |     this.loading = false | ||||||
|  |     AppStorage.set('lsh', '1111111111111') | ||||||
|  |     // TODO 未改 | ||||||
|  |     // globalThis.errorDialog = this.errorDialog | ||||||
|  |     // globalThis.udpEvent = new UdpEvent(); | ||||||
|  |     JudgeEmitterInstance.init() | ||||||
|  |     GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => { | ||||||
|  |       res.forEach((element) => { | ||||||
|  |         if (element.v_no === "305") { | ||||||
|  |           delPic(Number(element.v_value), 1, this.context) | ||||||
|  |           delPic(Number(element.v_value), 2, this.context) | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   async onPageShow(): Promise<void> { | ||||||
|  |     this.singlePlay = AppStorage.get<boolean>('singlePlay') || false | ||||||
|  |     this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')! | ||||||
|  | 
 | ||||||
|  |     UseAuth(this.context).then(() => { | ||||||
|  |       this.initParams() | ||||||
|  |     }).catch(() => { | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     if (this.singlePlay == undefined || this.singlePlay == null) { | ||||||
|  |       this.context.resourceManager.getRawFileContent("welcome.wav") | ||||||
|  |         .then(() => { | ||||||
|  |           this.avPlayer.playAudio(['welcome.wav']) | ||||||
|  |         }) | ||||||
|  |         .catch((error: BusinessError) => { | ||||||
|  |           console.log("getRawFileContent promise error is " + error); | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |       this.singlePlay = false | ||||||
|  |       AppStorage.setOrCreate('singlePlay', false) | ||||||
|  |     } | ||||||
|  |     this.num = 0 | ||||||
|  |     AppStorage.setOrCreate('lsh', '1111111111111') | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @Styles | ||||||
|  |   commStyle(){ | ||||||
|  |     .width(220 * this.ratio * this.dialogRatio) | ||||||
|  |     .height(69 * this.ratio * this.dialogRatio) | ||||||
|  |     .backgroundImage($r('app.media.button_nor')) | ||||||
|  |     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|  |     // .margin({ bottom: 12 * this.ratio }) | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   async testXMLToJSONInWorker() { | ||||||
|  |     if (this.loading) { | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     // let mode=globalThis.timeInfo?.mode?globalThis.timeInfo?.mode:1 | ||||||
|  | 
 | ||||||
|  |     // console.log('mode',mode) | ||||||
|  | 
 | ||||||
|  |     const param: InitializeTheCentralTableType = { | ||||||
|  |       carId: this.carInfo?.carId, | ||||||
|  |       examinationRoomId: this.carInfo?.examinationRoomId, | ||||||
|  |       judgeVersion: this.baseInfo?.judgeVersion, | ||||||
|  |       shellVersion: this.baseInfo?.version||"", | ||||||
|  |       paraKdid: this.timeInfo?.paraKdid || this.timeInfo?.kdid, | ||||||
|  |       kdid: this.timeInfo?.kdid || this.timeInfo?.paraKdid, | ||||||
|  |       mode: this.timeInfo?.mode, | ||||||
|  |       context: this.context, | ||||||
|  |       host: AppStorage.get<string>('host'), | ||||||
|  |       centerHost: this.timeInfo?.url, | ||||||
|  |       singlePlay: this.singlePlay | ||||||
|  |     } | ||||||
|  |     this.loading = true | ||||||
|  | 
 | ||||||
|  |     // getSingleCenterTable(param).then((ret) => { | ||||||
|  |     InitializeTheCentralTable(param).then((ret) => { | ||||||
|  |       if (ret) { | ||||||
|  |         GetSyncData<MASYSSETTableType>("MA_SYSSET").then(data => { | ||||||
|  |           data.forEach(sys => { | ||||||
|  |             //判断是否能点开始考试 | ||||||
|  |             if (sys.v_no === '854') { | ||||||
|  |               AppStorage.setOrCreate('param854Str', sys.v_value) | ||||||
|  |             } | ||||||
|  |             if (sys.v_no === '824' && decodeURIComponent(sys.v_value || '') == '0') { | ||||||
|  |               router.pushUrl({ | ||||||
|  |                 url: 'pages/CarCheck', | ||||||
|  |                 params: { | ||||||
|  |                   'fromIndex': true | ||||||
|  |                 } | ||||||
|  |               }, router.RouterMode.Single) | ||||||
|  |             } else { | ||||||
|  |               router.pushUrl({ | ||||||
|  |                 url: 'pages/ExaminerLogin', | ||||||
|  |               }, router.RouterMode.Single) | ||||||
|  |             } | ||||||
|  |           }) | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |       } | ||||||
|  |     }) | ||||||
|  | 
 | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   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() { | ||||||
|  |     this.fileHelper = new FileHelper(this.context); | ||||||
|  |     const time = GetCurrentTime() | ||||||
|  |     const date = time.split(' ')[0] | ||||||
|  |     this.fileHelper.createAlbum('jt') | ||||||
|  |     // this.fileHelper.createAlbum('2025-01-02') | ||||||
|  |     this.fileHelper.createAlbum('pz'); | ||||||
|  |     this.fileHelper.createAlbum(date); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   async initParams() { | ||||||
|  |     //设置plc udp 同步requesthost | ||||||
|  | 
 | ||||||
|  |     ObtainUdpBusinessInstance.init(); | ||||||
|  |     CenterUDPClientInstance.init(); | ||||||
|  |     CenterUDPClientInstance.startHeartBeat() | ||||||
|  |     CenterUDPClientInstance.onMsg((data: centerCallBackMsgType) => { | ||||||
|  |       if (data.id == 32) { | ||||||
|  |         AppStorage.setOrCreate('signNum', data.body[1]) | ||||||
|  |       } | ||||||
|  |     },) | ||||||
|  |     this.loading = false | ||||||
|  |     await GetDeviceInfo(this.context) | ||||||
|  |     await GetCarInfo() | ||||||
|  |     // getTCP() | ||||||
|  |     this.carInfo = AppStorage.get<CarInfoType>('carInfo')! | ||||||
|  |     this.deviceId = this.carInfo.carNo || "" | ||||||
|  |     await SetCurrentTime() | ||||||
|  |     this.timeInfo = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')! | ||||||
|  |     DrivingDataStorage.init(this.context) | ||||||
|  |     DrivingDataStorage.initializeTheDrivingDataFolder() | ||||||
|  |     setTimeout(() => { | ||||||
|  |       this.initParamFlag = true | ||||||
|  |     }, 3000) | ||||||
|  |     JudgeUdpBusinessInstance.init() | ||||||
|  |     // TODO 摄像头遮挡 | ||||||
|  |     // takePhotoFn(this.context) | ||||||
|  |     clearInterval(this.interval) | ||||||
|  |     this.interval = setInterval(() => { | ||||||
|  |       this.num++ | ||||||
|  |       SetSerialNumber() | ||||||
|  |       if (this.num >= 3) { | ||||||
|  |         this.heartMsg() | ||||||
|  |       } | ||||||
|  |     }, 1000) | ||||||
|  |     this.createAlbum() | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   build() { |   build() { | ||||||
|     Row() { |     Column() { | ||||||
|       Column() { |       Column() { | ||||||
|         Text(this.message) |         Row() { | ||||||
|           .fontSize(50) |           Image($r('app.media.logo')).width('30%').height('5.5%').margin({ left: 24 }) | ||||||
|           .fontWeight(FontWeight.Bold) |           Row() { | ||||||
|  |             Image($r('app.media.btn_setting')).width('16.7%').height('12.2%') | ||||||
|  |               .onClick(async () => { | ||||||
|  |                 // this.vocObj.playAudio({ | ||||||
|  |                 //   type: 1, | ||||||
|  |                 //   name: 'button_media.wav' | ||||||
|  |                 // }) | ||||||
|  |                 // deleteAllPicturesFn() | ||||||
|  |                 // 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.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.vocObj.playAudio({ | ||||||
|  |                 //   type: 1, | ||||||
|  |                 //   name: 'button_media.wav' | ||||||
|  |                 // }) | ||||||
|  |                 // ||!this.initParamFlag | ||||||
|  |                 if (this.loading) { | ||||||
|  |                   // this.errorDialog.open() | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 setTimeout(() => { | ||||||
|  |                   this.angle = 360 | ||||||
|  |                 }, 1000) | ||||||
|  |                 this.angle = 0 | ||||||
|  |                 if (!this.timeInfo) { | ||||||
|  |                   AppStorage.setOrCreate('type', 1) | ||||||
|  |                   AppStorage.setOrCreate('title', '时间同步接口连接失败') | ||||||
|  |                   this.errorDialog.open() | ||||||
|  |                   promptAction.showToast({ | ||||||
|  |                     message: `时间同步接口连接失败`, | ||||||
|  |                     duration: 3000 | ||||||
|  |                   }); | ||||||
|  |                   this.loading = false | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 if (!this.carInfo) { | ||||||
|  |                   promptAction.showToast({ | ||||||
|  |                     message: `车辆信息接口获取失败`, | ||||||
|  |                     duration: 3000 | ||||||
|  |                   }); | ||||||
|  |                   AppStorage.setOrCreate('type', 1) | ||||||
|  |                   AppStorage.setOrCreate('title', '车辆信息接口获取失败') | ||||||
|  |                   this.errorDialog.open() | ||||||
|  |                   this.loading = false | ||||||
|  |                   return | ||||||
|  |                 } | ||||||
|  |                 this.testXMLToJSONInWorker() | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               }) | ||||||
|  |           } | ||||||
|  |           if (this.singlePlay) { | ||||||
|  |             imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') }) | ||||||
|  |               .margin({ left: 80 * this.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<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(() => { | ||||||
|  |               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.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(() => { | ||||||
|  |               this.dialogVisible = 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.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) { | ||||||
|  |         Column() { | ||||||
|  |           Image($r('app.media.open_loading')) | ||||||
|  |             .width(200 * this.ratio) | ||||||
|  |             .rotate({ angle: this.angle }) | ||||||
|  |             .height(200 * this.ratio) | ||||||
|  |             .animation({ | ||||||
|  |               duration: 5000, // 动画时长 | ||||||
|  |               curve: Curve.EaseOut, // 动画曲线 | ||||||
|  |               delay: 500, // 动画延迟 | ||||||
|  |               iterations: -1, // 播放次数 | ||||||
|  |               playMode: PlayMode.Normal, // 动画模式 | ||||||
|  |             }) | ||||||
|  |             .margin({ top: 30 * this.ratio }) | ||||||
|  | 
 | ||||||
|  |           Text('正在清理本地数据,请稍候……') | ||||||
|  |             .fontSize(24 * this.ratio) | ||||||
|  |             .margin({ top: 20 * this.ratio }) | ||||||
|  |             .fontWeight(400) | ||||||
|  |         } | ||||||
|  |         .visibility(this.delLoading ? Visibility.Visible : Visibility.Hidden) | ||||||
|  |         .width(660 * this.ratio) | ||||||
|  |         .height(360 * this.ratio) | ||||||
|  |         .position({ x: 150 * this.ratio, y: 98 * this.ratio }) | ||||||
|  |         .backgroundColor('#E6E3DF') | ||||||
|  |         .borderRadius(19 * this.ratio) | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if (this.loading) { | ||||||
|  |         Column() { | ||||||
|  |           Image($r('app.media.open_loading')) | ||||||
|  |             .width(200 * this.ratio) | ||||||
|  |             .rotate({ angle: this.angle }) | ||||||
|  |             .height(200 * this.ratio) | ||||||
|  |             .animation({ | ||||||
|  |               duration: 5000, // 动画时长 | ||||||
|  |               curve: Curve.EaseOut, // 动画曲线 | ||||||
|  |               delay: 500, // 动画延迟 | ||||||
|  |               iterations: -1, // 播放次数 | ||||||
|  |               playMode: PlayMode.Normal, // 动画模式 | ||||||
|  |             }) | ||||||
|  |             .margin({ top: 30 * this.ratio }) | ||||||
|  |           Image($r('app.media.car')) | ||||||
|  |             .width(80 * this.ratio) | ||||||
|  |             .height(80 * this.ratio) | ||||||
|  |             .position({ x: 288 * this.ratio, y: 89 * this.ratio }) | ||||||
|  |           Text('获取考车信息,请稍候……') | ||||||
|  |             .fontSize(24 * this.ratio) | ||||||
|  |             .margin({ top: 20 * this.ratio }) | ||||||
|  |             .fontWeight(400) | ||||||
|  |         } | ||||||
|  |         .visibility(this.loading ? Visibility.Visible : Visibility.Hidden) | ||||||
|  |         .width(660 * this.ratio) | ||||||
|  |         .height(360 * this.ratio) | ||||||
|  |         .position({ x: 150 * this.ratio, y: 98 * this.ratio }) | ||||||
|  |         .backgroundColor('#E6E3DF') | ||||||
|  |         .borderRadius(19 * this.ratio) | ||||||
|       } |       } | ||||||
|       .width('100%') |  | ||||||
|     } |     } | ||||||
|  |     .width('100%') | ||||||
|     .height('100%') |     .height('100%') | ||||||
|  |     .justifyContent(FlexAlign.SpaceBetween) | ||||||
|  |     .backgroundImagePosition({ x: 0, y: 0 }) | ||||||
|  |     .backgroundImage($r('app.media.index_bg')) | ||||||
|  |     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,5 +1,17 @@ | |||||||
| { | { | ||||||
|   "src": [ |   "src": [ | ||||||
|     "pages/Index" |     "pages/CarCheck", | ||||||
|   ] |     "pages/Index", | ||||||
|  |     "pages/ExaminerLogin", | ||||||
|  |     "pages/UserInfo", | ||||||
|  |     "pages/Register", | ||||||
|  |     "pages/Settings", | ||||||
|  |     "pages/TerminalInfos", | ||||||
|  |     "pages/VideoConfig", | ||||||
|  |     "pages/SignDisplay", | ||||||
|  |     "pages/Roads", | ||||||
|  |     "pages/Judge" | ||||||
|  |   ], | ||||||
|  |   "window": { | ||||||
|  |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -5,9 +5,17 @@ | |||||||
|   "lockfileVersion": 3, |   "lockfileVersion": 3, | ||||||
|   "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/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3", | ||||||
|     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" |     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" | ||||||
|   }, |   }, | ||||||
|   "packages": { |   "packages": { | ||||||
|  |     "@ohos/crypto-js@2.0.3": { | ||||||
|  |       "name": "@ohos/crypto-js", | ||||||
|  |       "version": "2.0.3", | ||||||
|  |       "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==", | ||||||
|  |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", | ||||||
|  |       "registryType": "ohpm" | ||||||
|  |     }, | ||||||
|     "@ohos/hypium@1.0.19": { |     "@ohos/hypium@1.0.19": { | ||||||
|       "name": "@ohos/hypium", |       "name": "@ohos/hypium", | ||||||
|       "version": "1.0.19", |       "version": "1.0.19", | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ | |||||||
|   "modelVersion": "5.0.0", |   "modelVersion": "5.0.0", | ||||||
|   "description": "Please describe the basic information.", |   "description": "Please describe the basic information.", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|  |     "@ohos/crypto-js": "2.0.3" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@ohos/hypium": "1.0.19" |     "@ohos/hypium": "1.0.19" | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user