From 2efd38f73aef53655e472306dd4e84568ff454ca Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Wed, 21 Aug 2024 18:05:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E6=AE=BC=E5=95=8F=E9=A1=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/common/service/indexService.ts | 2 +- entry/src/main/ets/common/service/initable.ts | 8 +-- .../src/main/ets/entryability/EntryAbility.ts | 4 +- entry/src/main/ets/pages/Index.ets | 49 ++++++++++++++++--- 4 files changed, 50 insertions(+), 13 deletions(-) diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index 0cf75139..810cf0d4 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -159,7 +159,7 @@ export async function getSingleCenterTable(param) { return new Promise((reslove, reject) => { try{ upDataZhongxinginitialization(param).then((result) => { - console.log('teststetfinsh01',result) + console.log('kkkkkkkkkkk',result) if (result) { reslove(true) diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index 83742517..35796ca9 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -29,6 +29,7 @@ import util from '@ohos.util'; import FileModel from '../../pages/judgeSDK/utils/fileModel'; import FileUtil from '../../common/utils/File'; import { GlobalConfig } from '../../config/index'; +import prompt from '@ohos.promptAction' // @ts-nocheck //读表 @@ -343,20 +344,21 @@ export async function upDataZhongxinginitialization(param) { } let flag=true if (param.singlePlay) { - console.log('teststet0') + console.log('teststet0',JSON.stringify(param)) const fileUtil = new FileUtil(param.context) const tableList = ['MA_SYSSET', 'MA_SYSTEMPARM', 'MA_MARKRULE', 'MA_MARKRULESET','ES_CARINFO','MA_MAP_ROAD','MA_MAP_ROAD_LANE','MAP_SUBITEM','MA_T_CARPARMSET','MA_MAP_ITEMCLASS','MA_MAP_POINT','MA_MAP_POINT_ITEM']; for(let i=0;i<=tableList.length-1;i++){ const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + `/config/tableList/${tableList[i]}.txt`); const result=await sqlInsertCommonFn(tableList[i], JSON.parse(data) || [], param.context) - flag=flag?result:false + result?(flag=true):(flag=false) } - if(flag){ + if(!flag){ prompt.showToast({ message: '本地文件初始化数据库失败', duration: 3000 }); } + resolve(flag) return } diff --git a/entry/src/main/ets/entryability/EntryAbility.ts b/entry/src/main/ets/entryability/EntryAbility.ts index 8e01ac4a..b9130cba 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ts +++ b/entry/src/main/ets/entryability/EntryAbility.ts @@ -30,7 +30,9 @@ export default class EntryAbility extends UIAbility { globalThis.hasAuth = false // globalThis.version = '2022.08.13.01' // globalThis.judgeVersion = '2022.12.05.1' - globalThis.version = '2024.11.22.14' + // globalThis.version = '2022.12.05.1' + // globalThis.judgeVersion = '2022.08.13.01' + globalThis.version = '2024.11.22.14'//济南 globalThis.judgeVersion = '2024.11.22.14' globalThis.videoVersion= '1.0' // globalThis.version = '2023.12.13.01' diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index a7832f3b..9d19b5e5 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -103,9 +103,7 @@ struct Index { if (this.loading) { return } - setTimeout(() => { - this.angle = 360 - }, 1000) + this.angle = 0 if (!globalThis.timeInfo) { globalThis.type='1' @@ -118,6 +116,7 @@ struct Index { this.loading = false return } + if (!globalThis.carInfo) { promptAction.showToast({ message: `车辆信息接口获取失败`, @@ -125,10 +124,14 @@ struct Index { }); globalThis.type='1' AppStorage.SetOrCreate('errorMsg', 1); + console.log('testXMLToJSONInWorker5',JSON.stringify(globalThis.carInfo)) + globalThis.title='车辆信息接口获取失败' this.loading = false return } + console.log('testXMLToJSONInWorker6',JSON.stringify(globalThis.carInfo)) + this.testXMLToJSONInWorker() @@ -143,6 +146,31 @@ struct Index { if (this.loading) { return } + if (!globalThis.timeInfo) { + globalThis.type='1' + AppStorage.SetOrCreate('errorMsg', 1); + globalThis.title='时间同步接口连接失败' + promptAction.showToast({ + message: `时间同步接口连接失败`, + duration: 3000 + }); + this.loading = false + return + } + + if (!globalThis.carInfo) { + promptAction.showToast({ + message: `车辆信息接口获取失败`, + duration: 3000 + }); + globalThis.type='1' + AppStorage.SetOrCreate('errorMsg', 1); + console.log('testXMLToJSONInWorker5',JSON.stringify(globalThis.carInfo)) + + globalThis.title='车辆信息接口获取失败' + this.loading = false + return + } //判断数据库是否有表数据,有则直接跳转,没有则读取本地数据 getSyncData('MA_SYSSET').then(data => { console.log('datadata', JSON.stringify(data)) @@ -151,7 +179,7 @@ struct Index { url: 'pages/UserInfo', }, router.RouterMode.Single) } else { - this.loading = true + this.testXMLToJSONInWorker() } }) @@ -301,21 +329,26 @@ struct Index { if (this.loading) { return } + console.log('globalThis.timeInfo11111',JSON.stringify(globalThis.timeInfo),'globalThis.carInfo',JSON.stringify(globalThis.carInfo)) + let workerInstance = new worker.ThreadWorker('entry/ets/workers/worker.ts'); const param = { + singlePlay: this.isSingle, carId: globalThis.carInfo?.carId, examinationRoomId: globalThis.carInfo?.examinationRoomId, judgeVersion: globalThis.judgeVersion, shellVersion: globalThis.version, paraKdid: globalThis.timeInfo?.paraKdid, mode: globalThis.timeInfo?.mode, - context: this.context, host: globalThis.host, - centerHost: globalThis.timeInfo.url, - singlePlay: globalThis.singlePlay + centerHost: globalThis.timeInfo?.url, + context: this.context, } console.log('globalThis.timeInfo',JSON.stringify(globalThis.timeInfo),'globalThis.carInfo',JSON.stringify(globalThis.carInfo)) this.loading = true + setTimeout(() => { + this.angle = 360 + }, 1000) workerInstance.postMessage(param); workerInstance.onmessage = (e: MessageEvents): void => { console.log("baoyihu after postMessage :", JSON.stringify(e.data)); @@ -365,11 +398,11 @@ struct Index { console.log('globalThis.singlePlay', globalThis.singlePlay) if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { + globalThis.singlePlay = false this.vocObj.playAudio({ type: 1, name: 'welcome.wav' }) - globalThis.singlePlay = false } this.isSingle = globalThis.singlePlay this.loading = false