問題修改

This commit is contained in:
lvyuankang 2024-08-10 14:00:18 +08:00
parent 34017a09d1
commit 3458289d19
13 changed files with 327 additions and 78 deletions

View File

@ -153,7 +153,7 @@ export async function getSingleCenterTable(param) {
// }) // })
console.log('联网更新失败,请检查网络后重新更新') console.log('联网更新失败,请检查网络后重新更新')
promptAction.showToast({ promptAction.showToast({
message: `联网更新失败,请检查网络后重新更新`, message: `联网更新表数据失败,请重新更新`,
duration: 3000 duration: 3000
}); });
reslove(false) reslove(false)
@ -229,7 +229,6 @@ export async function takePhotoFn(context) {
if (param[key1]) { if (param[key1]) {
param.pztd = param[`td${Number(i) + 1}`] param.pztd = param[`td${Number(i) + 1}`]
takePhoto(param, context, 'jt/', 0, (data) => { takePhoto(param, context, 'jt/', 0, (data) => {
consoele.log('getPhtogetPhto',data)
if (Number(data.fileSize) <= (Number(param.zdyz) * 1000)) { if (Number(data.fileSize) <= (Number(param.zdyz) * 1000)) {
console.log('getPhtot0000') console.log('getPhtot0000')

View File

@ -167,7 +167,6 @@ export async function getDataBaseTable(params, reqParam) {
export async function upDateTableByArray(tableName, arr) { export async function upDateTableByArray(tableName, arr) {
return new Promise(async (reslove,reject)=>{ return new Promise(async (reslove,reject)=>{
const data =await sqlInsertCommonFn(tableName, arr) const data =await sqlInsertCommonFn(tableName, arr)
console.log('sqlsqlinsertsqlsqlinsertkkk',data)
reslove(data) reslove(data)
}) })
} }

View File

@ -2,6 +2,7 @@
import { obtainCarExamInfo } from '../../api/index' import { obtainCarExamInfo } from '../../api/index'
import { dateFormat } from '../utils/tools' import { dateFormat } from '../utils/tools'
import router from '@ohos.router' import router from '@ohos.router'
import promptAction from '@ohos.promptAction'
import { getSyncData } from '../../common/service/initable' import { getSyncData } from '../../common/service/initable'
import { GlobalConfig } from '../../config/index' import { GlobalConfig } from '../../config/index'
import FileUtil from '../../common/utils/File' import FileUtil from '../../common/utils/File'
@ -13,11 +14,16 @@ export async function getDeviceInfo(context) {
// globalThis.deviceNo = '1649018001275'; //洛阳科目三设备 // globalThis.deviceNo = '1649018001275'; //洛阳科目三设备
// globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489 // globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489
// globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备 // globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备
globalThis.deviceNo = 'MAC-B2A3A8FD'; //杭州科目二设备
return
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const fileUtil = new FileUtil(context) const fileUtil = new FileUtil(context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
if (data === '' || data === undefined) { if (data === '' || data === undefined) {
promptAction.showToast({
message: `请先进行设备注册`,
duration: 3000
});
router.pushUrl({ router.pushUrl({
url: 'pages/Register', url: 'pages/Register',
}, router.RouterMode.Single); }, router.RouterMode.Single);

View File

@ -99,7 +99,7 @@ export async function takePhoto(param, context,dir,flag=1,callback?) {
const num = Math.floor(Math.random() * 10000) const num = Math.floor(Math.random() * 10000)
const fileName = `picture_record${num}.jpg` const fileName = `picture_record${num}.jpg`
console.log('baoyihubaoyihu',video_uri,flag)
console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName` + fileName); console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName` + fileName);
// @ts-ignore // @ts-ignore
@ -112,8 +112,10 @@ export async function takePhoto(param, context,dir,flag=1,callback?) {
} }
else{ else{
console.log('baoyihubaoyihu1',video_uri,flag)
return new Promise<takePhotoParam>((resolve,reject)=>{ return new Promise<takePhotoParam>((resolve,reject)=>{
rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{ rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{
console.log('baoyihubaoyihu',video_uri,flag,JSON.stringify(snapResult))
console.log('getPhtot',JSON.stringify(snapResult)) console.log('getPhtot',JSON.stringify(snapResult))
resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize,errorCode:snapResult.errorCode }) resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize,errorCode:snapResult.errorCode })
}); });

View File

@ -1,10 +1,71 @@
import TcpClient from './TcpClient'; import TcpClient from './TcpClient';
import { getSyncData } from '../service/initable'; import { getSyncData } from '../service/initable';
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import FileUtil from '../../common/utils/File'
import { GlobalConfig } from '../../config/index'
export async function getTCP() { export async function getTCP() {
const fileUtil = new FileUtil(globalThis.context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
if (data === '' || data === undefined) {
globalThis.TcpClient = {}
globalThis.TcpClient.onMessage = () => {
}
}else{
const result=JSON.parse(data)
if (globalThis.TcpClient && globalThis.TcpClient.closeTcp) {
globalThis.TcpClient.closeTcp(async () => {
// const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
// globalThis.TcpClient = tcpClient
setTimeout(async () => {
await globalThis.TcpClient.rebindTcp(result.tcplocalIp, result.tcplocalIpPort, result.tcpOppositeIp, result.tcpOppositePort)
await globalThis.TcpClient.connectTcp()
await globalThis.TcpClient.sendMsg('1002') //1002
globalThis.TcpClient.onError((val) => {
setTimeout(() => {
getTCP()
}, 1000)
})
await globalThis.TcpClient.onMessage((val) => {
setTimeout(() => {
globalThis.TcpClient.sendMsg('1002') //1002
if (val) {
// const msg=val.substring(5,val.length-1)
console.log('socketTag[PLC.UdpClient] status:', globalThis.udpClient.getStatus())
globalThis.udpClient?.sendMsg(val)
}
}, 1000)
})
}, 2000)
})
}
else {
const tcpClient: TcpClient = new TcpClient(result.tcplocalIp, result.tcplocalIpPort, result.tcpOppositeIp, result.tcpOppositePort)
globalThis.TcpClient = tcpClient
await globalThis.TcpClient.bindTcp()
await globalThis.TcpClient.connectTcp()
await globalThis.TcpClient.sendMsg('1002') //1002
globalThis.TcpClient.onError((val) => {
setTimeout(() => {
getTCP()
}, 1000)
})
await globalThis.TcpClient.onMessage((val) => {
hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
setTimeout(() => {
globalThis.TcpClient.sendMsg('1002') //1002
if (val && globalThis.udpClient?.sendMsg) {
globalThis.udpClient?.sendMsg(val)
}
}, 1000)
})
}
}
return
getSyncData('IpConfigTable').then(async (result: Array<any>) => { getSyncData('IpConfigTable').then(async (result: Array<any>) => {
console.log('result222', JSON.stringify(result)) console.log('result222', JSON.stringify(result))
if (result.length) { if (result.length) {
if (globalThis.TcpClient && globalThis.TcpClient.closeTcp) { if (globalThis.TcpClient && globalThis.TcpClient.closeTcp) {
@ -34,7 +95,8 @@ export async function getTCP() {
}, 2000) }, 2000)
}) })
} else { }
else {
const tcpClient: TcpClient = new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort, result[0].tcpOppositeIp, result[0].tcpOppositePort) const tcpClient: TcpClient = new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort, result[0].tcpOppositeIp, result[0].tcpOppositePort)
globalThis.TcpClient = tcpClient globalThis.TcpClient = tcpClient
await globalThis.TcpClient.bindTcp() await globalThis.TcpClient.bindTcp()

View File

@ -2,13 +2,72 @@
import UdpClientByCenter from './UdpClientByCenter'; import UdpClientByCenter from './UdpClientByCenter';
import { getSyncData } from '../service/initable' import { getSyncData } from '../service/initable'
import { getChuankouFn } from '../../common/service/indexService' import { getChuankouFn } from '../../common/service/indexService'
import FileUtil from '../../common/utils/File'
import { GlobalConfig } from '../../config/index'
export async function sendMsg(val) { export async function sendMsg(val) {
// globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val) // globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val)
} }
export async function getUDP(errorFlag?) { export async function getUDP(context,errorFlag?) {
return new Promise((reslove,reject)=>{ return new Promise(async (reslove,reject)=>{
const fileUtil = new FileUtil(context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
if (data === '' || data === undefined) {
console.log(` getUDP has no IPConfigTable `);
globalThis.udpClient = {}
globalThis.host = ''
reslove('')
} else {
const result=JSON.parse(data)
console.log(` getUDP has IPConfigTable `);
if (globalThis.udpClient && globalThis.udpClient.closeUdp) {
console.log(` getUDP has udclent close and rebind `);
globalThis.udpClient.closeUdp(() => {
setTimeout(() => {
globalThis.udpClient.rebindUdp(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort)
globalThis.udpClient.sendMsg('111', null)
globalThis.host = `http://${result.centerIp}:${result.centerPort}`
globalThis.udpClient.onError_Callback(()=>{
console.log('getUDPgetUDPgetUDP')
getUDP(context,true)
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
}
})
reslove(`http://${result.centerIp}:${result.centerPort}`)
// globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
}, 1000)
})
}
else {
// 未绑定
console.log(` getUDP has no udclent and bind `);
const udpClient: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort)
udpClient.bindUdp()
udpClient.sendMsg('111')
globalThis.host = `http://${result.centerIp}:${result.centerPort}`
globalThis.udpClient = udpClient
globalThis.udpClient.onMessage_1(()=>{
console.log('getUDPonMessage_1msgmsgByGloalUdp')
})
globalThis.udpClient.onError_Callback(()=>{
getUDP(context,true)
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
}
})
getChuankouFn()
reslove(`http://${result[0].centerIp}:${result[0].centerPort}`)
}
}
return
getSyncData('IpConfigTable').then((result: Array<any>) => { getSyncData('IpConfigTable').then((result: Array<any>) => {
if (result.length) { if (result.length) {
console.log(` getUDP has IPConfigTable `); console.log(` getUDP has IPConfigTable `);
@ -21,7 +80,7 @@ export async function getUDP(errorFlag?) {
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}` globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
globalThis.udpClient.onError_Callback(()=>{ globalThis.udpClient.onError_Callback(()=>{
console.log('getUDPgetUDPgetUDP') console.log('getUDPgetUDPgetUDP')
getUDP(true) getUDP(true,context)
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){ if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1 globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
} }
@ -47,7 +106,7 @@ export async function getUDP(errorFlag?) {
}) })
globalThis.udpClient.onError_Callback(()=>{ globalThis.udpClient.onError_Callback(()=>{
getUDP(true) getUDP(true,context)
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){ if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1 globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
} }
@ -77,7 +136,68 @@ export async function getUDP(errorFlag?) {
} }
export async function getUDP2(errorFlag?) { export async function getUDP2(context,errorFlag?) {
const fileUtil = new FileUtil(context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
if (data === '' || data === undefined) {
globalThis.udpClient2 = {}
globalThis.udpClient2.setMsgCallBack = () => {
}
}else{
const result=JSON.parse(data)
console.log(` getUDP2 has IPConfigTable `);
if (globalThis.udpClient2 && globalThis.udpClient2.closeUdp) {
console.log(` getUDP2 has udclent ,close and rebind `);
globalThis.udpClient2.closeUdp(async () => {
setTimeout(() => {
globalThis.udpClient2.rebindUdp(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
globalThis.udpClient2.onError_Callback(()=>{
getUDP2(context,true);
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
}
})
}, 1000)
})
}
else {
// 未绑定
console.log(` getUDP2 has no udclent and bind `);
const udpClient2: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
await udpClient2.bindUdp()
await udpClient2.onError_Callback(()=>{
getUDP2(context,true);
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
}
})
if(!errorFlag){
await udpClient2.onMessage_2((val) => {
console.log('getUDPOnmessageByGlobalUDP2Message')
if (val.id == '32') {
globalThis.signNum = val.body[1]
} else if (val.id == '46') {
let tmpList = []
const str = globalThis.lsh
for (let i = 0; i < str.length; i++) {
tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
}
const param = {
id: 47,
list: tmpList,
carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId
}
globalThis.udpClient2.send(param)
}
})
}
globalThis.udpClient2 = udpClient2
}
}
return
console.log(` getUDP2 enter`); console.log(` getUDP2 enter`);
getSyncData('IpConfigTable').then(async (result: Array<any>) => { getSyncData('IpConfigTable').then(async (result: Array<any>) => {
if (result.length) { if (result.length) {
@ -140,9 +260,13 @@ export async function getUDP2(errorFlag?) {
} }
export async function setTopLineUdp() { export async function setTopLineUdp() {
const config = await getSyncData('IpConfigTable'); const fileUtil = new FileUtil(globalThis.context)
if (config && config[0] && config[0].udplocalIp) { const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config[0]; const config = JSON.parse(data)
// const config = await getSyncData('IpConfigTable');
if (config && config.udplocalIp) {
const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config;
const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509', udpOppositeIp, udpOppositeIpPort) const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509', udpOppositeIp, udpOppositeIpPort)
udpClient.bindUdp() udpClient.bindUdp()
@ -156,8 +280,12 @@ export async function setTopLineUdp() {
// //
export async function setJudgeUdp() { export async function setJudgeUdp() {
const config = await getSyncData('IpConfigTable'); const fileUtil = new FileUtil(globalThis.context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
const config = JSON.parse(data)
//
// const config = await getSyncData('IpConfigTable');
let udpIndex = 0; let udpIndex = 0;
let currentUdpIndex = 0; let currentUdpIndex = 0;
let judgeUdpTimer let judgeUdpTimer
@ -166,11 +294,11 @@ export async function setJudgeUdp() {
udpIndex += 1; udpIndex += 1;
}, 1000); }, 1000);
if (config && config[0] && config[0].udplocalIp) { if (config && config.udplocalIp) {
const {udplocalIp} = config[0]; const {udplocalIp} = config;
const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort) const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort)
await udpClientbyCenter.bindUdp() await udpClientbyCenter.bindUdp()
await udpClientbyCenter.onMessage_1((val) => { await udpClientbyCenter.onMessage_2((val) => {
console.log('valval', val) console.log('valval', val)
}) })

View File

@ -9,6 +9,7 @@ export default class TcpClient {
private localIpPort: string = '' private localIpPort: string = ''
private oppositeIp: string = '' private oppositeIp: string = ''
private oppositeIpPort: string = '' private oppositeIpPort: string = ''
private num: number = 0//重连次数
private tcp: any = null private tcp: any = null
@ -120,8 +121,12 @@ export default class TcpClient {
resolve(true) resolve(true)
}).catch(err => { }).catch(err => {
globalThis.getCloseTcp = true globalThis.getCloseTcp = true
this.num++
if(this.num>3){
return
}
setTimeout(() => { setTimeout(() => {
this.connectTcp() getTCP()
resolve(false) resolve(false)
}, 2000) }, 2000)
console.log('testTagconnect,error') console.log('testTagconnect,error')

View File

@ -3,6 +3,8 @@ import { Array2Byte, fillZero, string2Bytes, stringToASC } from '../../common/ut
import { testKmItems } from '../../pages/judgeSDK/dataTest/index'; import { testKmItems } from '../../pages/judgeSDK/dataTest/index';
import { setJudgeUdp, setTopLineUdp } from './GlobalUdp'; import { setJudgeUdp, setTopLineUdp } from './GlobalUdp';
import { convertGpsCoord2 } from '../utils/tools'; import { convertGpsCoord2 } from '../utils/tools';
import common from '@ohos.app.ability.common';
export const initJudgeUdp = async () => { export const initJudgeUdp = async () => {

View File

@ -24,6 +24,7 @@ struct Index {
@State version: string = '' @State version: string = ''
@State url: string = '' @State url: string = ''
@State hasAuth: boolean = false; @State hasAuth: boolean = false;
@State dialogVisiable: boolean = false;
@State isSingle: boolean = false; @State isSingle: boolean = false;
@State deviceId: string = ''; @State deviceId: string = '';
@State angle: number = 0 @State angle: number = 0
@ -38,6 +39,15 @@ struct Index {
private workerInstance = null; private workerInstance = null;
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
@Styles
commStyle(){
.width(220 * this.ratio)
.height(69 * this.ratio)
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 12 * this.ratio })
}
build() { build() {
Column() { Column() {
Column() { Column() {
@ -55,6 +65,8 @@ struct Index {
}) })
Image($r('app.media.btn_back')).width('14.4%').height('12.2%') Image($r('app.media.btn_back')).width('14.4%').height('12.2%')
.onClick(() => { .onClick(() => {
this.dialogVisiable=true
return
promptAction.showDialog({ promptAction.showDialog({
title: '提示', title: '提示',
message: '确认是否退出应用', message: '确认是否退出应用',
@ -87,7 +99,7 @@ struct Index {
Column() { Column() {
Row() { Row() {
if (!this.isSingle) { if (!this.isSingle) {
Image($r('app.media.index_lw')).width('30.5%').height('74%').onClick(async () => { Image($r('app.media.index_lw')).width('28%').height('71%').margin({left:10 * globalThis.ratio}).onClick(async () => {
if (this.loading) { if (this.loading) {
return return
} }
@ -98,10 +110,11 @@ struct Index {
this.angle = 0 this.angle = 0
if (!globalThis.timeInfo) { if (!globalThis.timeInfo) {
promptAction.showToast({ promptAction.showToast({
message: `网络连接失败`, message: `时间同步接口连接失败`,
duration: 3000 duration: 3000
}); });
this.loading = false this.loading = false
return
} }
this.testXMLToJSONInWorker() this.testXMLToJSONInWorker()
@ -109,7 +122,7 @@ struct Index {
}) })
} }
if (this.isSingle) { if (this.isSingle) {
Image($r('app.media.index_dj')).width('30.5%').height('74%').onClick(() => { Image($r('app.media.index_dj')).width('30.5%').height('74%').margin({left:10 * globalThis.ratio}).onClick(() => {
if (this.loading) { if (this.loading) {
return return
} }
@ -117,12 +130,9 @@ struct Index {
url: 'pages/UserInfo', url: 'pages/UserInfo',
params: { judge: true } params: { judge: true }
}, router.RouterMode.Single); }, router.RouterMode.Single);
// router.pushUrl({
// url: 'pages/UserInfo',
// }, router.RouterMode.Single);
}) })
} }
Image($r('app.media.index_zj')).width('30.5%').height('74%').onClick(() => { Image($r('app.media.index_zj')).width('28%').height('71%').margin({right:10* globalThis.ratio}).onClick(() => {
if (this.loading) { if (this.loading) {
return return
} }
@ -172,6 +182,36 @@ struct Index {
} }
// //
if (this.dialogVisiable) {
Flex({justifyContent:FlexAlign.Center}) {
Text('确认是否退出应用')
.fontSize(28 * this.ratio)
.margin({top:100*this.ratio})
Row() {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(' 取 消 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
}
.commStyle()
.onClick(() => {
this.dialogVisiable = false
})
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(' 确 定 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio)
}
.commStyle()
.onClick(() => {
router.back()
})
}.position({ y: 265 * this.ratio, x: 115 * this.ratio })
}
.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) { if (this.loading) {
Column() { Column() {
Image($r('app.media.open_loading')) Image($r('app.media.open_loading'))
@ -212,6 +252,7 @@ struct Index {
} }
aboutToAppear() { aboutToAppear() {
this.dialogVisiable=false
this.angle = 0 this.angle = 0
this.loading = false this.loading = false
this.vocObj = new voiceService(async (status, val, next) => { this.vocObj = new voiceService(async (status, val, next) => {
@ -271,11 +312,11 @@ struct Index {
async onPageShow() { async onPageShow() {
this.loading = false this.loading = false
this.createAlbum()
await getUDP()
await getUDP2()
this.num=0
this.userAuth(); this.userAuth();
this.createAlbum()
await getUDP(this.context,false)
await getUDP2(this.context,false)
this.num=0
clearInterval(this.interval) clearInterval(this.interval)
this.interval = setInterval(() => { this.interval = setInterval(() => {
this.num++ this.num++

View File

@ -4,6 +4,8 @@ import ethernet from '@ohos.net.ethernet';
import prompt from '@ohos.prompt' import prompt from '@ohos.prompt'
import { upDateTableByArray} from '../common/service/initable' import { upDateTableByArray} from '../common/service/initable'
import { getSyncData} from '../common/service/initable' import { getSyncData} from '../common/service/initable'
import FileUtil from '../common/utils/File';
import common from '@ohos.app.ability.common';
@Entry @Entry
@ -19,14 +21,13 @@ struct Index {
// @State inputTextList2: string[] = ['192.168.7.124','20022'] // @State inputTextList2: string[] = ['192.168.7.124','20022']
// @State inputTextList1: string[] = ['172.37.55.191','18782','192.168.7.1','8082','255.255.255.0','192.168.7.170','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122'] // @State inputTextList1: string[] = ['172.37.55.191','18782','192.168.7.1','8082','255.255.255.0','192.168.7.170','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122']
@State inputTextList1: string[] = ['192.168.1.144','18782','192.168.1.144','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] @State inputTextList1: string[] = ['192.168.1.146','18782','192.168.1.146','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122']
// @State inputTextList2: string[] = [] // @State inputTextList2: string[] = []
// 112.80.35.83 11052 // 112.80.35.83 11052
// @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000'] // @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
// @State inputTextList2: string[] = ['192.168.36.139','20022'] // @State inputTextList2: string[] = ['192.168.36.139','20022']
private fileUtil: FileUtil
private context = getContext(this) as common.UIAbilityContext;
@State @Watch('outClick') outFlag: boolean = false; private vocObj = null; @State @Watch('outClick') outFlag: boolean = false; private vocObj = null;
scroller: Scroller = new Scroller() scroller: Scroller = new Scroller()
@ -78,8 +79,12 @@ struct Index {
.height('80%') .height('80%')
.borderRadius('25px') .borderRadius('25px')
Column() { Column() {
Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{ Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(async ()=>{
upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]}]) const fileUtil = new FileUtil(this.context)
const folderPath = await fileUtil.initFolder(`/config`);
const param={udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]}
fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param))
// upDateTableByArray('IpConfigTable',[])
ethernet.setIfaceConfig("eth0", { ethernet.setIfaceConfig("eth0", {
mode: 0, mode: 0,
ipAddr:this.inputTextList1[9], ipAddr:this.inputTextList1[9],

View File

@ -107,11 +107,13 @@ struct UserInfo {
new WebRTCVoice(this.context); new WebRTCVoice(this.context);
//初始化数据 //初始化数据
this.initData() this.initData()
//身份证读卡器初始化 //身份证读卡器初始化
// this.openDeviceByIDCard() // this.openDeviceByIDCard()
// 如果是单机模式则模拟假数据 // 如果是单机模式则模拟假数据
//获取sysset表数据 //获取sysset表数据
this.initSysset() this.initSysset()
//心跳处理 //心跳处理
this.heartMsg() this.heartMsg()
this.isExamStart = false this.isExamStart = false
@ -164,7 +166,6 @@ struct UserInfo {
return return
} }
this.showFaceCompare = true
this.pageIndex = Math.floor(index / 4) this.pageIndex = Math.floor(index / 4)
} }
}) })
@ -311,10 +312,10 @@ struct UserInfo {
that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222' that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222'
const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452')
that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0'
const faceParam = syssetParams.filter(sys => sys.v_no === '2413') const faceParam = syssetParams.filter(sys => sys.v_no == '2413')
that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0' that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0'
that.FaceOpenStatue = '0' that.FaceOpenStatue = '0'
console.log('that.FaceOpenStatue', that.FaceOpenStatue) // that.FaceOpenStatue = '0'
// faceParam?.[0]?.v_value || // faceParam?.[0]?.v_value ||
// 1身份证读卡器 2指纹 3人脸 // 1身份证读卡器 2指纹 3人脸
this.faceFlag = faceParam?.[0]?.v_value || '0' this.faceFlag = faceParam?.[0]?.v_value || '0'
@ -360,13 +361,6 @@ struct UserInfo {
} }
this.pageIndex++; this.pageIndex++;
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) 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
})
} }
prevClick() { prevClick() {
@ -375,13 +369,6 @@ struct UserInfo {
} }
this.pageIndex--; this.pageIndex--;
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) 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
})
} }
//获取下载考生 //获取下载考生
@ -390,7 +377,7 @@ struct UserInfo {
return return
} }
const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName></body></getExaminationStudentInfoReq>` const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName></body></getExaminationStudentInfoReq>`
getExaminationStudentInfo(param).then(res => { getExaminationStudentInfo(param).then(async(res) => {
setTimeout(() => { setTimeout(() => {
this.updateTimeLimit = true this.updateTimeLimit = true
}, 30000) }, 30000)
@ -417,14 +404,15 @@ struct UserInfo {
} }
this.list = JSON.parse(JSON.stringify(dataList)) this.list = JSON.parse(JSON.stringify(dataList))
dataList = dataList.length > 4 ? dataList.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : dataList; this.list.forEach(listData => {
dataList.forEach(listData => {
for (let i in listData) { for (let i in listData) {
listData[i] = decodeURI(listData[i]) listData[i] = decodeURI(listData[i])
} }
listData.kszp = this.photo + listData.kszp listData.kszp = this.photo + listData.kszp
listData.ksmjzp = this.photo + listData.ksmjzp listData.ksmjzp = this.photo + listData.ksmjzp
}) })
dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list;
this.dataList = dataList this.dataList = dataList
if (this.dataList.length) { if (this.dataList.length) {
this.currentUser = this.dataList[0] this.currentUser = this.dataList[0]
@ -437,6 +425,12 @@ struct UserInfo {
globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm
console.log('this.currentUse3' + JSON.stringify(this.currentUser)) console.log('this.currentUse3' + JSON.stringify(this.currentUser))
this.pageIndex = 0 this.pageIndex = 0
getSyncData('USER').then(data=>{
if(data?.[0]){
this.getCurrentStudent(data[0].sfzmhm)
}
})
}).catch((error) => { }).catch((error) => {
console.log('error12error' + error) console.log('error12error' + error)
}) })
@ -661,6 +655,9 @@ struct UserInfo {
.backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg'))
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => { .onClick(() => {
if(this.isExamStart){
return
}
this.currentUser = item this.currentUser = item
}) })
}) })
@ -778,6 +775,7 @@ struct UserInfo {
this.stopDeviceById() this.stopDeviceById()
return return
} }
console.log('this.FaceOpenStatue',this.FaceOpenStatue)
if (this.FaceOpenStatue != '0') { if (this.FaceOpenStatue != '0') {
this.showFaceCompare = true this.showFaceCompare = true
} else { } else {

View File

@ -12,6 +12,7 @@ import { VideoConfigData } from '../../mock';
@Component @Component
export default struct FaceCompare { export default struct FaceCompare {
@State imageBase64: string = 'data:image/jpeg;base64,' @State imageBase64: string = 'data:image/jpeg;base64,'
@State base64: string = ''
@Prop sfzh: string; @Prop sfzh: string;
@Prop lsh: string; @Prop lsh: string;
@Prop firstImage: string; @Prop firstImage: string;
@ -68,7 +69,7 @@ export default struct FaceCompare {
Row() { Row() {
Image(this.firstImage) Image(this.base64)
.width('100%') .width('100%')
.height('100%') .height('100%')
.backgroundColor(Color.Black) .backgroundColor(Color.Black)
@ -176,16 +177,19 @@ export default struct FaceCompare {
} }
async faceComparFn() { async faceComparFn() {
console.log('mmmmm0', 1) console.log('mmmmm0', 2)
takePhoto(this.param, this.context, 'jt/', 0, ({base64}) => { const data=await takePhoto(this.param, this.context, 'jt/', 1,)
this.base64=this.imageBase64 + data.base64
console.log('mmmmt',this.base64)
faceCompare({ faceCompare({
sfzh: this.sfzh, sfzh: this.sfzh,
firstImage: this.firstImage.substr(22), firstImage: this.firstImage.substr(22),
secondImage: base64, secondImage: data.base64,
type: 2, type: 2,
verifyType: 1 verifyType: 1
}).then(res => { })
.then(res => {
console.log('mmmmm8', res) console.log('mmmmm8', res)
if (res) { if (res) {
@ -208,7 +212,6 @@ export default struct FaceCompare {
} }
}) })
})
console.log('mmmmm8', 9) console.log('mmmmm8', 9)

View File

@ -2,7 +2,7 @@ import router from '@ohos.router';
import UdpClient from '../../common/utils/UdpClient'; import UdpClient from '../../common/utils/UdpClient';
import FileLog from '../judgeSDK/utils/fileLog'; import FileLog from '../judgeSDK/utils/fileLog';
import RealTime from '../compontents/judge/RealTime'; import RealTime from '../compontents/judge/RealTime';
import { GPSData, SignalData, RoadData } from '../../mock'; import { GPSData, SignalData } from '../../mock';
import { SignalDataType } from '../../model'; import { SignalDataType } from '../../model';
@Component @Component
@ -159,7 +159,7 @@ export default struct SignDisplayCom {
.fontSize(14 * this.ratio) .fontSize(14 * this.ratio)
.width('30%') .width('30%')
.textAlign(TextAlign.Start) .textAlign(TextAlign.Start)
Text("改正数数据长度*数据长度-基准站RTCM改正数类型" + this.signArr[62] || '0') Text("改正数次数/改正数大小:" + this.signArr[58] || '0')
.fontColor('#FFF5E5') .fontColor('#FFF5E5')
.fontSize(14 * this.ratio) .fontSize(14 * this.ratio)
.textAlign(TextAlign.Start) .textAlign(TextAlign.Start)
@ -169,12 +169,11 @@ export default struct SignDisplayCom {
Text("本机IP" + this.signArr[53] || '0') Text("本机IP" + this.signArr[53] || '0')
.fontColor('#FFF5E5') .fontColor('#FFF5E5')
.fontSize(14 * this.ratio) .fontSize(14 * this.ratio)
.width('30%') .width('25%')
.textAlign(TextAlign.Start) .textAlign(TextAlign.Start)
Text("改正数次数/改正数大小:" + this.signArr[58] || '0') Text("改正数数据长度*数据长度-基准站RTCM改正数类型" + this.signArr[62] || '0')
.fontColor('#FFF5E5') .fontColor('#FFF5E5')
.fontSize(14 * this.ratio) .fontSize(14 * this.ratio)
.width('30%')
.textAlign(TextAlign.Start) .textAlign(TextAlign.Start)
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio }) }.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
} }
@ -223,9 +222,9 @@ export default struct SignDisplayCom {
Text('速度:' + this.signArr[97]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('速度:' + this.signArr[97]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
} }
.backgroundColor('#1A1A1A') .backgroundColor('#1A1A1A')
.width(138 * this.ratio) .width(170 * this.ratio)
.height(300 * this.ratio) .height(300 * this.ratio)
.position({ y: 0 * this.ratio, x: 750 * this.ratio }) .position({ y: 0 * this.ratio, x: 720 * this.ratio })
}.backgroundColor('#282828').width(this.ratio * 890).height(308 * this.ratio).margin({ top: 3 * this.ratio }) }.backgroundColor('#282828').width(this.ratio * 890).height(308 * this.ratio).margin({ top: 3 * this.ratio })
} }
.width(936 * this.ratio) .width(936 * this.ratio)
@ -328,7 +327,7 @@ export default struct SignDisplayCom {
if (showBack) { if (showBack) {
this.ratio = 1.4 this.ratio = 1.4
globalThis.udpClient.onMessage_1((msg) => { globalThis.udpClient.onMessage_1&&globalThis.udpClient.onMessage_1((msg) => {
console.log('getUDPonMessage_1bysignDisplay0', msg) console.log('getUDPonMessage_1bysignDisplay0', msg)
if (msg) { if (msg) {
getSignal(msg) getSignal(msg)
@ -353,7 +352,7 @@ export default struct SignDisplayCom {
const that = this const that = this
const showBack = this.showBack; const showBack = this.showBack;
if (showBack) { if (showBack) {
globalThis.udpClient.onMessage_1((msg) => { globalThis.udpClient.onMessage_1&&globalThis.udpClient.onMessage_1((msg) => {
console.log('getUDPonMessage_1bysignDisplay2', msg) console.log('getUDPonMessage_1bysignDisplay2', msg)
getSignal(msg) getSignal(msg)