From f440fd7630490b98f90ac7c9ed73bd3e6992786b Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Thu, 15 Aug 2024 13:42:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A4=96=E6=AE=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/service/initable.ts | 7 +-- entry/src/main/ets/common/utils/TcpClient.ts | 7 --- entry/src/main/ets/common/utils/request.ts | 2 +- entry/src/main/ets/pages/Index.ets | 60 ++++++++++++------- entry/src/main/ets/pages/UserInfo.ets | 31 +++++++--- 5 files changed, 61 insertions(+), 46 deletions(-) diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index 713ff39d..659518a3 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -338,16 +338,10 @@ export async function upDataZhongxinginitialization(param) { console.log('teststet0') 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++){ - console.log('teststet1',tableList[i]) const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + `/config/tableList/${tableList[i]}.txt`); - console.log('teststet1',data) - await sqlInsertCommonFn(tableList[i], JSON.parse(data) || [], param.context) - console.log('teststet2',data) } - console.log('teststetfinsh') resolve(true) return } @@ -422,6 +416,7 @@ function setSyncCenterSqlData(key, res, param) { const fileUtil = new FileUtil(param.context) const folderPath = await fileUtil.initFolder(`/config/tableList`); fileUtil.addFile(`${folderPath}/${mapName[key]}.txt`, JSON.stringify(arrList)) + console.log('mapName[key]', mapName[key], key) sqlInsertCommonFn(mapName[key], arrList, param.context).then((result) => { console.log(key, '表建立成功') diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index 72b950f4..4639c7d0 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -106,13 +106,6 @@ export default class TcpClient { this.tcp.setExtraOptions({ keepAlive: true, - // OOBInline: true, - // TCPNoDelay: true, - // socketLinger: { on:true, linger:10 }, - // receiveBufferSize: 1000, - // sendBufferSize: 1000, - // reuseAddress: true, - // socketTimeout: 3000, }, err => { if (err) { console.log('testTagtestTagerrrrr,success') diff --git a/entry/src/main/ets/common/utils/request.ts b/entry/src/main/ets/common/utils/request.ts index b963036c..f159a0e6 100644 --- a/entry/src/main/ets/common/utils/request.ts +++ b/entry/src/main/ets/common/utils/request.ts @@ -40,7 +40,7 @@ export default async function request(req: any) { let baseUrl=host?host:globalThis.host // let baseUrl=host?config.csptHost:config.host' - console.log('响应头地址' + baseUrl) + console.log('响应头地址' + baseUrl,url) // writeLog({ // time:dateFormat(new Date()), // url, diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 209a8cf5..1bbc7bf6 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -16,6 +16,8 @@ import worker, { MessageEvents } from '@ohos.worker'; import promptAction from '@ohos.promptAction' import { voiceService } from '../common/service/voiceService'; // import errorMsgDialog from './compontents/errorMsgDialog' +import { getSyncData } from '../common/service/initable'; + @Entry @Component struct Index { @@ -73,28 +75,28 @@ struct Index { .onClick(() => { this.dialogVisiable=true return - promptAction.showDialog({ - title: '提示', - message: '确认是否退出应用', - buttons: [ - { - text: '确认', - color: '#000000', - }, - { - text: '取消', - color: '#000000', - } - ], - }) - .then(data => { - if (data.index == 0) { - router.back() - } - }) - .catch(err => { - // reslove(false) - }) + // promptAction.showDialog({ + // title: '提示', + // message: '确认是否退出应用', + // buttons: [ + // { + // text: '确认', + // color: '#000000', + // }, + // { + // text: '取消', + // color: '#000000', + // } + // ], + // }) + // .then(data => { + // if (data.index == 0) { + // router.back() + // } + // }) + // .catch(err => { + // // reslove(false) + // }) }) } } @@ -132,7 +134,19 @@ struct Index { if (this.loading) { return } - this.testXMLToJSONInWorker() + //判断数据库是否有表数据,有则直接跳转,没有则读取本地数据 + getSyncData('MA_SYSSET').then(data => { + console.log('datadata',JSON.stringify(data)) + if (data?.[0]) { + router.pushUrl({ + url:'pages/UserInfo', + }, router.RouterMode.Single) + }else{ + this.loading=true + this.testXMLToJSONInWorker() + } + }) + ; }) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 2e8442ab..6412cdba 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -102,6 +102,8 @@ struct UserInfo { ] async onPageShow() { + this.updateTimeLimit=false + console.log('响应头地址响应头地址') const mediaTest = new FilePhoto(this.context); this.filePhoto = new FilePhoto(this.context); //语音功能 @@ -115,6 +117,11 @@ struct UserInfo { this.initSysset() //心跳处理 this.heartMsg() + getSyncData('USER').then(data => { + if (data?.[0]) { + this.getExaminationStudentInfoFn() + } + }) this.isExamStart = false this.sczbkf = []; this.avPlayer = new VoiceAnnounce(); @@ -139,9 +146,9 @@ struct UserInfo { } // 通过身份证获取当前学员 - getCurrentStudent(id) { + async getCurrentStudent(id) { let flag = false - this.pageIndex + // this.pageIndex this.list.map((res, index) => { if (res.sfzmhm == id) { flag = true @@ -170,10 +177,12 @@ struct UserInfo { }) this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) if (!flag) { - promptAction.showToast({ - message: '未匹配到对应下载学员', - duration: 3000 - }); + await upDateTableByArray('USER', []) + this.currentUser=this.list[0] + // promptAction.showToast({ + // message: '未匹配到对应下载学员', + // duration: 3000 + // }); } } @@ -255,9 +264,11 @@ struct UserInfo { globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm globalThis.lsh = this.lsh } else { - this.getExaminationStudentInfoFn() + // this.getExaminationStudentInfoFn() } const syssetParams = await getSyncData('MA_SYSSET'); + console.log('响应头地址响应头地址0') + //@ts-ignore syssetParams.forEach(sys => { //364 绕车一周评判时机(1-开始考试后判 2-开始考试前判) @@ -330,6 +341,7 @@ struct UserInfo { } } // that.FaceOpenStatue = '0' + console.log('响应头地址响应头地址3',that.studentRefreshStatue) //0不自动更新 1自动更新(不限次数) 2没有考生更新2次 if (that.studentRefreshStatue == '2') { @@ -382,6 +394,7 @@ struct UserInfo { //获取下载考生 getExaminationStudentInfoFn() { + console.log('响应头地址',globalThis.singlePlay,this.updateTimeLimit) if (globalThis.singlePlay || this.updateTimeLimit) { return } @@ -990,9 +1003,9 @@ struct LabelBlock { build() { Row() { - Text(this.label).fontSize(16 * this.ratio).fontColor('#99948A') + Text(this.label).fontSize(18 * this.ratio).fontColor('#99948A') Row() { - Text(decodeURIComponent(this.value)).fontColor('#fff').textAlign(TextAlign.Center).width('100%') + Text(decodeURIComponent(this.value)).fontColor('#fff').textAlign(TextAlign.Center).width('100%').fontSize(20 * this.ratio) } .commLabelStyle() }.margin({ bottom: 10 * this.ratio }) From 295c8c10cff2bee9206db45a777e373db3f690f8 Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Thu, 15 Aug 2024 17:55:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?userinfo=E5=96=AE=E6=A9=9F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/utils/TcpClient.ts | 2 +- entry/src/main/ets/pages/UserInfo.ets | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index 4639c7d0..679c9d76 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -185,7 +185,6 @@ export default class TcpClient { globalThis.tcpUdpError = true; }, 2000) },3000) - // callback(value.message) }); } @@ -193,6 +192,7 @@ export default class TcpClient { offTcp(callback) { console.log(TAG, 'tcpofff') + this.tcp.off('testTagofmessg', callback); } diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index fb618dc9..3b50ab07 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -743,7 +743,7 @@ struct UserInfo { .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) .backgroundImageSize({ width: '100%', height: '100%' }) .onClick(() => { - if (this.isExamStart) { + if (this.isExamStart&&!globalThis.singlePlay) { return } this.currentUser = item @@ -997,9 +997,9 @@ struct LabelBlock { build() { Row() { - Text(this.label).fontSize(16 * this.ratio).fontColor('#99948A') + Text(this.label).fontSize(20 * this.ratio).fontColor('#99948A') Row() { - Text(decodeURIComponent(this.value)).fontColor('#fff').textAlign(TextAlign.Center).width('100%') + Text(decodeURIComponent(this.value)).fontColor('#fff').textAlign(TextAlign.Center).width('100%').fontSize(18 * this.ratio) } .commLabelStyle() }.margin({ bottom: 10 * this.ratio })