diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index 6818a8e4..a91c34ba 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -152,10 +152,10 @@ export async function getSingleCenterTable(param) { // reslove(false) // }) console.log('联网更新失败,请检查网络后重新更新') - promptAction.showToast({ - message: `联网更新表数据失败,请重新更新`, - duration: 3000 - }); + // promptAction.showToast({ + // message: `联网更新表数据失败,请重新更新`, + // duration: 3000 + // }); reslove(false) } }).catch((error) => { diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index 20a9016c..4946d97d 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -26,6 +26,8 @@ import DeviceInfoTable from '../constants/DeviceInfoTable'; import USER from '../constants/USER'; import util from '@ohos.util'; import FileModel from '../../pages/judgeSDK/utils/fileModel'; +import FileUtil from '../../common/utils/File'; +import { GlobalConfig } from '../../config/index'; // @ts-nocheck //读表 @@ -330,6 +332,27 @@ export async function upDataZhongxinginitialization(param) { resolve(false) return } + if(param.singlePlay){ + const fileUtil = new FileUtil(param.context) + const tableList=['MA_ITEMINFO','MA_MARKRULE','MA_SYSTEMPARM','MA_MAP_COLLECT','MA_MAP_COLLECT_SHAPE','MA_MAP_ITEMCLASS','MA_MAP_POINT','MA_MAP_POINT_ITEM','MA_MAP_ROAD','MA_MAP_ROAD_LANE','MAP_SUBITEM','MA_SYSSET','ES_CARINFO','MA_MARKRULESET','MA_CDSBINFO','MA_T_CARPARMSET']; + tableList.map(async(tableName)=>{ + const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + `/config/tableList/${tableName}.txt`); + if(data&&JSON.parse(data)){ + sqlInsertCommonFn(tableName, JSON.parse(data), param.context).then((result) => { + console.log(key, '单机表建立成功') + if (result) { + resolve(true) + } else { + resolve(false) + } + }).catch((msg) => { + reject(false) + console.log(key, '单机表建立失败') + }) + } + }) + return + } const str = { "carId": param.carId, // 表名 "examinationRoomId": param.examinationRoomId, //考试平台kdid @@ -370,7 +393,7 @@ export async function upDataZhongxinginitialization(param) { } function setSyncCenterSqlData(key, res, param) { - return new Promise((resolve, reject) => { + return new Promise(async(resolve, reject) => { const mapName = { 'ItemInfo': 'MA_ITEMINFO', 'MarkRule': 'MA_MARKRULE', @@ -389,7 +412,6 @@ function setSyncCenterSqlData(key, res, param) { 'MarkRuleSet': 'MA_MARKRULESET', 'Cdsbinfo': 'MA_CDSBINFO', 'T_CarParmSet': 'MA_T_CARPARMSET', - // 'ES_CAR_VIDEO_PARAMETER':ES_CAR_VIDE0pO_PARAMETER } // const accountTable = new AccountTable(() => { // }, centerToMap[key],param.context); @@ -399,6 +421,9 @@ function setSyncCenterSqlData(key, res, param) { } else { arrList = [res.initializationRsp.body[key].record] } + 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/service/terminalService.ts b/entry/src/main/ets/common/service/terminalService.ts index f1f06a9d..09f5fa15 100644 --- a/entry/src/main/ets/common/service/terminalService.ts +++ b/entry/src/main/ets/common/service/terminalService.ts @@ -9,29 +9,21 @@ import FileUtil from '../../common/utils/File' //获取设备信息 export async function getDeviceInfo(context) { - // globalThis.deviceNo = '153216400880'; //科目三设备 - // globalThis.deviceNo = '150667400235'; //科目三设备 - // globalThis.deviceNo = '1649018001275'; //洛阳科目三设备 - // globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489 - // globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备 - globalThis.deviceNo = 'MAC-B2A3A8FD'; //杭州科目二设备 - return return new Promise(async (resolve, reject) => { const fileUtil = new FileUtil(context) const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); + console.log('globalThis.deviceNoglobalThis.deviceNo',data) if (data === '' || data === undefined) { promptAction.showToast({ message: `请先进行设备注册`, duration: 3000 }); - router.pushUrl({ - url: 'pages/Register', - }, router.RouterMode.Single); resolve('') } else { const fileData=JSON.parse(data) globalThis.deviceNo = fileData.deviceName - getCarInfo() + console.log('globalThis.deviceNo', globalThis.deviceNo) + // getCarInfo() resolve(fileData.deviceName) } }) @@ -40,6 +32,8 @@ export async function getDeviceInfo(context) { //获取考车信息 export async function getCarInfo() { let date = new Date(); + console.log('globalThis.carInfo2222', globalThis.deviceNo) + let params = { time: dateFormat(date), deviceNo: globalThis.deviceNo }; let res: any = await obtainCarExamInfo(params) if (!res?.obtainCarExamInfoRsp?.body) { @@ -48,7 +42,7 @@ export async function getCarInfo() { // }, router.RouterMode.Single); } else { globalThis.carInfo = res.obtainCarExamInfoRsp.body - console.log('globalThis.carInfo', JSON.stringify(globalThis.carInfo)); + console.log('globalThis.carInfo2222', JSON.stringify(res)); // globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo) } diff --git a/entry/src/main/ets/common/utils/GlobalUdp.ts b/entry/src/main/ets/common/utils/GlobalUdp.ts index 9799d36a..24fc9119 100644 --- a/entry/src/main/ets/common/utils/GlobalUdp.ts +++ b/entry/src/main/ets/common/utils/GlobalUdp.ts @@ -13,6 +13,7 @@ export async function getUDP(context,errorFlag?) { return new Promise(async (reslove,reject)=>{ const fileUtil = new FileUtil(context) const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); + console.log('ttttt',data) if (data === '' || data === undefined) { console.log(` getUDP has no IPConfigTable `); globalThis.udpClient = {} @@ -45,6 +46,7 @@ export async function getUDP(context,errorFlag?) { else { // 未绑定 console.log(` getUDP has no udclent and bind `); + console.log('ttttttdata',JSON.stringify(result)) const udpClient: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort) udpClient.bindUdp() udpClient.sendMsg('111') @@ -62,7 +64,7 @@ export async function getUDP(context,errorFlag?) { } }) getChuankouFn() - reslove(`http://${result[0].centerIp}:${result[0].centerPort}`) + reslove(`http://${result.centerIp}:${result.centerPort}`) } diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index 96f9e90f..4452f33d 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -1,6 +1,7 @@ import socket from '@ohos.net.socket'; import hilog from '@ohos.hilog'; import { getTCP } from './GlobalTcp'; +import prompt from '@ohos.prompt'; const TAG = 'socketTag[TcpDemo.TcpClient]' @@ -152,6 +153,7 @@ export default class TcpClient { onMessage(callback?) { this.tcp.on('message', value => { console.log(TAG, 'Tcponmessage', value.length, value) + globalThis.tcpUdpError = false // console.log('messageLengt',,value.message.length)) console.log('testTagtcpmsg') @@ -165,6 +167,22 @@ export default class TcpClient { } else { callback && callback('') } + clearInterval(globalThis.intervaltcp) + globalThis.intervaltcp=setInterval(()=>{ + setTimeout(async () => { + //程序断开 + if (globalThis.tcpUdpError) { + console.log(TAG,'tcp信号丢失') + getTCP() + prompt.showToast({ + message: 'tcp信号丢失', + duration: 2000 + }); + } + globalThis.tcpUdpError = true; + }, 2000) + },3000) + // callback(value.message) }); } @@ -181,6 +199,7 @@ export default class TcpClient { let promise = this.tcp.close(); promise.then(() => { globalThis.getCloseTcp = true + console.log(TAG, 'tcpCloseSuccess') callback() reslove(true) diff --git a/entry/src/main/ets/common/utils/UdpClient.ts b/entry/src/main/ets/common/utils/UdpClient.ts index 23433ef5..0de4a2f9 100644 --- a/entry/src/main/ets/common/utils/UdpClient.ts +++ b/entry/src/main/ets/common/utils/UdpClient.ts @@ -16,7 +16,7 @@ import socket from '@ohos.net.socket'; import { Array2Byte } from '../utils/tools' import {getChuankouFn} from '../../common/service/indexService' - +import {getUDP} from './GlobalUdp' const TAG = 'socketTag[PLC.UdpClient]' import prompt from '@ohos.prompt' @@ -29,7 +29,7 @@ export default class UdpClient { private oppositeIpPort: string = '' private udp: any = null - // private stashFn:StashFuncotion + // private stashFn:StashFuncotionon constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) { this.localIp = udplocalIp @@ -176,14 +176,15 @@ export default class UdpClient { //程序断开 lightLineUdp?.send(globalThis.plcUdpError ? arrRedBuffer : (isJudge ? arrGreenBugger : arrBlueBuffer)); if (globalThis.plcUdpError) { - num++ + // num++ console.log(TAG,'plc udp信号丢失') - if(num==3){ - await this.bindUdp() - await this.sendMsg('111') - await this.onMessage(callback) - num=0 - } + // if(num==3){ + getUDP(globalThis.context,true) + // await this.bindUdp() + // await this.sendMsg('111') + // await this.onMessage(callback) + // num=0 + // } prompt.showToast({ message: 'plc udp信号丢失', duration: 2000 diff --git a/entry/src/main/ets/common/utils/UdpClientByCenter.ts b/entry/src/main/ets/common/utils/UdpClientByCenter.ts index 25659e50..50439566 100644 --- a/entry/src/main/ets/common/utils/UdpClientByCenter.ts +++ b/entry/src/main/ets/common/utils/UdpClientByCenter.ts @@ -23,6 +23,7 @@ const TAG = '[UdpDemo.UdpClient]' import hilog from '@ohos.hilog'; import prompt from '@ohos.prompt' import promptAction from '@ohos.promptAction'; +import { getUDP } from './GlobalUdp'; export default class UdpClientByCenter { @@ -144,7 +145,9 @@ export default class UdpClientByCenter { setMsgBody({id,list}) { let tmpList = [] tmpList = list + return tmpList; + } sendHeadMsg(msgData) { @@ -153,37 +156,35 @@ export default class UdpClientByCenter { console.log('getUDPsendHeadMsg exit') } - sendMsg(msg, sendCallback?) { - if (!this.isWorking && sendCallback) { - sendCallback() - } - this.udp.getState((err, data) => { - if (err) { - this.isWorking = false - return; - } else { - let promise = this.udp.send({ - data: msg, - address: { - address: this.oppositeIp, - port: parseInt(this.oppositeIpPort), - } - }); - promise.then(() => { - if (sendCallback) { - sendCallback() - } - console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); - }).catch(err => { - console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); - promptAction.showToast({ - message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`, - duration:4000 - }) - }); + sendMsg(msg, sendCallback?) + { + console.log(`${TAG}getUDPudpCLient sendMsg enter oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`); + if (!this.isWorking ) { + console.log(`${TAG}getUDPudpCLient sendMsg is closed return `); + if(sendCallback) { + sendCallback() } - console.log('getUDPgetState success:' + JSON.stringify(data)); - }) + return; + } + let promise = this.udp.send({ + data: msg, + address: { + address: this.oppositeIp, + port: parseInt(this.oppositeIpPort), + } + }); + promise.then(() => { + if (sendCallback) { + sendCallback() + } + console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); + }).catch(err => { + console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); + promptAction.showToast({ + message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`, + duration:4000 + }) + }); } sendMsgExt(param, context?) { @@ -334,9 +335,8 @@ export default class UdpClientByCenter { num++ console.log(TAG, 'plc udp信号丢失') if (num == 3) { - await this.bindUdp() - await this.sendMsg('111', null) - await this.onMessage_1(callback) + getUDP(globalThis.context,true) + num = 0 } prompt.showToast({ diff --git a/entry/src/main/ets/common/utils/request.ts b/entry/src/main/ets/common/utils/request.ts index 67b8dd70..b963036c 100644 --- a/entry/src/main/ets/common/utils/request.ts +++ b/entry/src/main/ets/common/utils/request.ts @@ -3,6 +3,9 @@ import convertxml from '@ohos.convertxml'; import prompt from '@ohos.prompt' import { sendGreen } from '../../pages/judgeSDK/utils/judgeCommon'; import {GlobalConfig} from '../../config/index' +import FileUtil from '../../common/utils/File'; +import { dateFormat } from '../utils/tools' + const config = { host:GlobalConfig.host, } @@ -36,16 +39,31 @@ export default async function request(req: any) { try { let baseUrl=host?host:globalThis.host // let baseUrl=host?config.csptHost:config.host' - console.log('响应头地址' + paramsStr) + + console.log('响应头地址' + baseUrl) + // writeLog({ + // time:dateFormat(new Date()), + // url, + // extraData: JSON.stringify(data), + // state:'start' + // }) const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options); + // fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList)) + // writeLog({ + // time:dateFormat(new Date()), + // url, + // result:JSON.stringify(result), + // extraData: JSON.stringify(data), + // state:'end' + // }) console.log('响应头地址' + JSON.stringify(result)) let res:any = xml ? xmlToJson(result,url) : result; console.log('响应头地址' + JSON.stringify(res)) + let resObj = null; if(typeof res === "string"){ res=JSON.parse(res) } - //处理中心服务code if(res.Envelope){ const msgXml = res.Envelope.Body.writeObjectOutResponse.return; @@ -99,7 +117,12 @@ export default async function request(req: any) { } } +async function writeLog(param){ + const fileUtil = new FileUtil(globalThis.context) + const folderPath = await fileUtil.initFolder(`/errorMsg/`); + fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(param)+`\n`) +} //xml格式转JSON function xmlToJson(result,url) { console.log("xmlToJson begin",url); diff --git a/entry/src/main/ets/entryability/EntryAbility.ts b/entry/src/main/ets/entryability/EntryAbility.ts index 983a375a..f3b0e18c 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ts +++ b/entry/src/main/ets/entryability/EntryAbility.ts @@ -30,6 +30,8 @@ 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.judgeVersion = '2024.11.22.14' globalThis.videoVersion= '1.0' // globalThis.version = '2023.12.13.01' // globalThis.judgeVersion = '2023.09.30.1' diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 0a555f1f..8d3a72ec 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -1,5 +1,4 @@ // @ts-nocheck -import { VideoConfig } from './interfaces' import common from '@ohos.app.ability.common'; import router from '@ohos.router'; import { getCarInfo, getDeviceInfo } from '../common/service/terminalService'; @@ -16,7 +15,7 @@ import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; import worker, { MessageEvents } from '@ohos.worker'; import promptAction from '@ohos.promptAction' import { voiceService } from '../common/service/voiceService'; - +// import errorMsgDialog from './compontents/errorMsgDialog' @Entry @Component struct Index { @@ -48,7 +47,13 @@ struct Index { .backgroundImageSize({ width: '100%', height: '100%' }) .margin({ bottom: 12 * this.ratio}) } - + // dialogController: CustomDialogController | null = new CustomDialogController({ + // builder: errorMsgDialog( + // title, + // isDialog, + // // cancel: ()=> { }, + // // confirm: ()=> { } + // }) build() { Column() { Column() { @@ -100,7 +105,7 @@ struct Index { Column() { Row() { if (!this.isSingle) { - Image($r('app.media.index_lw')).width('28%').height('71%').margin({left:10 * globalThis.ratio}).onClick(async () => { + Image($r('app.media.index_lw')).width('28%').height('71%').margin({left:80 * globalThis.ratio}).onClick(async () => { if (this.loading) { return } @@ -123,7 +128,7 @@ struct Index { }) } if (this.isSingle) { - Image($r('app.media.index_dj')).width('30.5%').height('74%').margin({left:10 * globalThis.ratio}).onClick(() => { + Image($r('app.media.index_dj')).width('28%').height('71%').margin({left:80 * globalThis.ratio}).onClick(() => { if (this.loading) { return } @@ -133,7 +138,7 @@ struct Index { }, router.RouterMode.Single); }) } - Image($r('app.media.index_zj')).width('28%').height('71%').margin({right:10* globalThis.ratio}).onClick(() => { + Image($r('app.media.index_zj')).width('28%').height('71%').margin({right:80* globalThis.ratio}).onClick(() => { if (this.loading) { return } @@ -257,8 +262,7 @@ struct Index { this.dialogVisiable=false this.angle = 0 this.loading = false - this.vocObj = new voiceService(async (status, val, next) => { - }); + } async testXMLToJSONInWorker() { @@ -272,7 +276,8 @@ struct Index { mode: globalThis.timeInfo?.mode, context: this.context, host:globalThis.host, - centerHost:globalThis.timeInfo.url + centerHost:globalThis.timeInfo.url, + singlePlay:globalThis.singlePlay } workerInstance.postMessage(param); workerInstance.onmessage = (e: MessageEvents): void => { @@ -306,6 +311,7 @@ struct Index { carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId } + console.log('paramparam',JSON.stringify(param)) // globalThis.udpClient2.initHeartSendMsg(param,this.context) if (globalThis.udpClient2.getStatus()) { globalThis.udpClient2.sendMsgExt(param, this.context) @@ -313,26 +319,14 @@ struct Index { } async onPageShow() { - this.loading = false + console.log('ttttt',1111) this.userAuth(); - this.createAlbum() - await getUDP(this.context,false) - await getUDP2(this.context,false) - this.num=0 - clearInterval(this.interval) - this.interval = setInterval(() => { - this.num++ - setliushuiNum(this.context) - getliushuiNum(this.context) - if(this.num>=3){ - this.heartMsg() - } - }, 1000) + console.log('ttttt2222',1111) - // - getTCP() - // const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) + this.vocObj = new voiceService(async (status, val, next) => { + }); + console.log('globalThis.singlePlay',globalThis.singlePlay) if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { this.vocObj.playAudio({ type: 1, @@ -341,6 +335,14 @@ struct Index { globalThis.singlePlay = false } this.isSingle = globalThis.singlePlay + this.loading = false + this.createAlbum() + + this.num=0 + + + // + // const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) console.info('Index onPageShow'); @@ -378,16 +380,31 @@ struct Index { } async initParams() { + //设置plc udp 同步requesthost + await getUDP(this.context,false) this.loading = false - takePhotoFn(this.context) - this.deviceId=await getDeviceInfo(this.context) || '' + console.log('globalThis.deviceNo000') + await getDeviceInfo(this.context) await getCarInfo() + await getUDP2(this.context,false) + getTCP() + this.deviceId= globalThis.carInfo.carNo await setCurrentTime(); this.carNum = globalThis.carInfo.plateNo; this.version = globalThis.version; this.hasAuth = globalThis.hasAuth; initJudgeUdp() + takePhotoFn(this.context) console.log('deviceIddeviceId',globalThis.deviceNo,this.deviceNo) + clearInterval(this.interval) + this.interval = setInterval(() => { + this.num++ + setliushuiNum(this.context) + getliushuiNum(this.context) + if(this.num>=3){ + this.heartMsg() + } + }, 1000) //下载模型 // await this.getModel() // const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00] diff --git a/entry/src/main/ets/pages/Settings.ets b/entry/src/main/ets/pages/Settings.ets index daa47348..6e490924 100644 --- a/entry/src/main/ets/pages/Settings.ets +++ b/entry/src/main/ets/pages/Settings.ets @@ -55,7 +55,7 @@ export default struct Index { } .margin({ left: 24 * this.ratio }) - Text('考车号:' + globalThis.deviceNo) + Text('考车号:' + globalThis.carInfo.carNo) .fontColor('#CCAE7A') .fontSize(22 * this.ratio) .margin({ right: 24 * this.ratio }) diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index 0c6907d9..6813c5f3 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -135,7 +135,6 @@ struct Index { async aboutToAppear() { const fileUtil = new FileUtil(this.context) const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); - console.log('datadata',data) if (data === '' || data === undefined) { }else{ const result=JSON.parse(data) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index fa4b41bf..89a1cb8a 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -28,7 +28,6 @@ import { initJudgeUdp } from '../common/utils/UdpJudge'; struct UserInfo { private filePhoto: FilePhoto private avPlayer - @State pageIndex: number = 0 @State ratio: number = 1700 / 960 @State index: number = 0 @@ -70,10 +69,9 @@ struct UserInfo { @State numCount: number = 0; @State signNum: number = 0; @State isCanClick: boolean = true; - @State updateTimeLimit: boolean = true + @State updateTimeLimit: boolean = false @State faceFlag: string = '0'; @State FaceOpenStatue: string = '0'; //是否开启人脸识别 - subscriber; @State faceCatchImg: string = '' @State Param803Str:string = '' // 过程照片拍照 @@ -318,7 +316,6 @@ struct UserInfo { const faceParam = syssetParams.filter(sys => sys.v_no == '2413') - // that.FaceOpenStatue = '0' // faceParam?.[0]?.v_value || // 1身份证读卡器 2指纹 3人脸 if(openCheckFlag=='1'){ @@ -328,7 +325,6 @@ struct UserInfo { that.openDeviceByIDCard() } } - //0不自动更新 1自动更新(不限次数) 2没有考生更新2次 if (that.studentRefreshStatue == '2') { clearInterval(that.interval) @@ -376,11 +372,18 @@ struct UserInfo { } this.pageIndex--; this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) + this.dataList.forEach(listData => { + for (let i in listData) { + listData[i] = decodeURI(listData[i]) + } + listData.kszp = this.photo + listData.kszp + listData.ksmjzp = this.photo + listData.ksmjzp + }) } //获取下载考生 getExaminationStudentInfoFn() { - if (globalThis.singlePlay && this.updateTimeLimit) { + if (globalThis.singlePlay || this.updateTimeLimit) { return } const param = `${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}${globalThis.carInfo.carId}${globalThis.carInfo.examinationRoomId}${globalThis.username}` diff --git a/entry/src/main/ets/pages/VideoConfig.ets b/entry/src/main/ets/pages/VideoConfig.ets index a64d4abb..e09fb7b9 100644 --- a/entry/src/main/ets/pages/VideoConfig.ets +++ b/entry/src/main/ets/pages/VideoConfig.ets @@ -217,7 +217,7 @@ struct Index { this.param.faceFlag = value console.info('Checkbox1 change is' + value) }) - Text('启用过程人脸比对').fontColor('#333333').fontSize(16 * this.ratio) + Text('启用人脸比对').fontColor('#333333').fontSize(16 * this.ratio) TextInput({ text: this.param.rlls, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) @@ -229,7 +229,7 @@ struct Index { .onChange((value) => { this.param.rlls = value }) - Text('拍照通道').fontColor('#333333').fontSize(16 * this.ratio) + Text('过程拍照通道').fontColor('#333333').fontSize(16 * this.ratio) TextInput({ text: this.param.pztd, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) diff --git a/entry/src/main/ets/pages/compontents/FaceCompare.ets b/entry/src/main/ets/pages/compontents/FaceCompare.ets index 8a05b977..ae138df9 100644 --- a/entry/src/main/ets/pages/compontents/FaceCompare.ets +++ b/entry/src/main/ets/pages/compontents/FaceCompare.ets @@ -45,7 +45,7 @@ export default struct FaceCompare { Column() { Column() { Text('照片比对') - .lineHeight('16%') + // .lineHeight('16%') .height('16%') .fontWeight(FontWeight.Bold) .fontSize(24) @@ -78,11 +78,11 @@ export default struct FaceCompare { .height('100%') } .width('88.9%') - .height('53.2%') + .height('52%') .justifyContent(FlexAlign.SpaceBetween) Text('正在等待拍照…') - .lineHeight('16%') + // .lineHeight('16%') .height('16%') .fontWeight(FontWeight.Bold) .fontColor('#CC7E00') @@ -178,7 +178,7 @@ export default struct FaceCompare { async faceComparFn() { console.log('mmmmm0', 2) - + this.param.pztd=this.param.rlls const data=await takePhoto(this.param, this.context, 'jt/', 1,) this.base64=this.imageBase64 + data.base64 console.log('mmmmt',this.base64) @@ -191,7 +191,6 @@ export default struct FaceCompare { }) .then(res => { console.log('mmmmm8', res) - if (res) { this.controller.stop() this.showFaceCompare = !this.showFaceCompare