新代码
This commit is contained in:
parent
0fe5385625
commit
848282fe04
@ -27,6 +27,7 @@ export default class UdpClient {
|
|||||||
private oppositeIpPort: string = ''
|
private oppositeIpPort: string = ''
|
||||||
|
|
||||||
private udp: any = null
|
private udp: any = null
|
||||||
|
private stashFn
|
||||||
|
|
||||||
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
||||||
this.localIp = udplocalIp
|
this.localIp = udplocalIp
|
||||||
@ -72,7 +73,9 @@ export default class UdpClient {
|
|||||||
console.log(`${TAG} udp bind failed:${JSON.stringify(err)}`);
|
console.log(`${TAG} udp bind failed:${JSON.stringify(err)}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
setMsgCallBack(callback){
|
||||||
|
this.stashFn=callback
|
||||||
|
}
|
||||||
sendMsg(msg: string) {
|
sendMsg(msg: string) {
|
||||||
let promise = this.udp.send({
|
let promise = this.udp.send({
|
||||||
data: msg,
|
data: msg,
|
||||||
@ -114,6 +117,8 @@ export default class UdpClient {
|
|||||||
if (strachArr[0] != '#DN_GD') {
|
if (strachArr[0] != '#DN_GD') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.stashFn(str)
|
||||||
|
this.stashFn=()=>{}
|
||||||
callback(str)
|
callback(str)
|
||||||
} else {
|
} else {
|
||||||
callback('')
|
callback('')
|
||||||
|
|||||||
@ -161,12 +161,15 @@ export default class UdpClientByCenter {
|
|||||||
console.log(`${TAG} udpLine send fail:${JSON.stringify(err)}`);
|
console.log(`${TAG} udpLine send fail:${JSON.stringify(err)}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
setMsgCallBack(callback){
|
||||||
|
this.stashFn=callback
|
||||||
|
}
|
||||||
sendMsg(param,context?) {
|
sendMsg(param,context?) {
|
||||||
if(context){
|
if(context){
|
||||||
this.context=context
|
this.context=context
|
||||||
}
|
}
|
||||||
this.sendId=param.id
|
this.sendId=param.id
|
||||||
|
console.log('sendMsg',JSON.stringify(param))
|
||||||
const msgData=this.setWholeMsg(param)
|
const msgData=this.setWholeMsg(param)
|
||||||
// const msgData=this.setMsyBody('31','010000000000000')
|
// const msgData=this.setMsyBody('31','010000000000000')
|
||||||
let promise = this.udp.send({
|
let promise = this.udp.send({
|
||||||
@ -176,7 +179,6 @@ export default class UdpClientByCenter {
|
|||||||
port: parseInt(this.oppositeIpPort),
|
port: parseInt(this.oppositeIpPort),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.stashFn=param.callback?param.callback:()=>{}
|
|
||||||
promise.then(() => {
|
promise.then(() => {
|
||||||
if(param.sendCallback){
|
if(param.sendCallback){
|
||||||
param.sendCallback()
|
param.sendCallback()
|
||||||
|
|||||||
@ -184,7 +184,8 @@ struct Index {
|
|||||||
for (let i = 0;i < str.length; i++) {
|
for (let i = 0;i < str.length; i++) {
|
||||||
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
|
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
|
||||||
}
|
}
|
||||||
const param= {id: 31,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId}
|
const param= {id: 31,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRomId}
|
||||||
|
// globalThis.udpClient2.initHeartSendMsg(param,this.context)
|
||||||
globalThis.udpClient2.sendMsg(param, this.context)
|
globalThis.udpClient2.sendMsg(param, this.context)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,11 +195,10 @@ struct Index {
|
|||||||
getUDP()
|
getUDP()
|
||||||
getUDP2()
|
getUDP2()
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
setliushuiNum(this.context)
|
setliushuiNum()
|
||||||
this.heartMsg(this.context)
|
this.heartMsg()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
// getTCP()
|
// getTCP()
|
||||||
|
|
||||||
// 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)
|
||||||
|
|
||||||
if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) {
|
if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) {
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import WebRTCVoice from './webRTC/'
|
|||||||
import promptAction from '@ohos.promptAction'
|
import promptAction from '@ohos.promptAction'
|
||||||
import { CandidateData, EmptyCandidateObject } from "../mock/CandidateData"
|
import { CandidateData, EmptyCandidateObject } from "../mock/CandidateData"
|
||||||
import {string2Bytes} from '../common/utils/tools'
|
import {string2Bytes} from '../common/utils/tools'
|
||||||
|
import { getSyncData } from '../common/service/initable'
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
struct UserInfo {
|
struct UserInfo {
|
||||||
@ -69,8 +70,6 @@ struct UserInfo {
|
|||||||
@State grantDept: string = '';
|
@State grantDept: string = '';
|
||||||
@State effectDate: string = '';
|
@State effectDate: string = '';
|
||||||
@State interval: any = null;
|
@State interval: any = null;
|
||||||
@State interval2: any = null;
|
|
||||||
@State interval3: any = null;
|
|
||||||
@State studentRefreshStatue: string = '0';
|
@State studentRefreshStatue: string = '0';
|
||||||
@State photo: string = 'data:image/bmp;base64,';
|
@State photo: string = 'data:image/bmp;base64,';
|
||||||
@State numCount: number = 0;
|
@State numCount: number = 0;
|
||||||
@ -80,21 +79,21 @@ struct UserInfo {
|
|||||||
subscriber;
|
subscriber;
|
||||||
@State faceCatchImg: string = ''
|
@State faceCatchImg: string = ''
|
||||||
|
|
||||||
onPageShow() {
|
async onPageShow() {
|
||||||
//语音功能
|
//语音功能
|
||||||
|
const systemParms:any = await getSyncData('MA_SYSTEMPARM')
|
||||||
|
console.log('systemParms',systemParms.length)
|
||||||
new WebRTCVoice(this.context);
|
new WebRTCVoice(this.context);
|
||||||
//初始化数据
|
//初始化数据
|
||||||
this.initData()
|
this.initData()
|
||||||
//身份证读卡器初始化
|
//身份证读卡器初始化
|
||||||
this.openDeviceByIDCard()
|
// this.openDeviceByIDCard()
|
||||||
// 如果是单机模式则模拟假数据
|
// 如果是单机模式则模拟假数据
|
||||||
|
|
||||||
this.initSysset()
|
this.initSysset()
|
||||||
initJudgeUdp()
|
initJudgeUdp()
|
||||||
this.interval=setInterval(()=>{
|
this.heartMsg()
|
||||||
this.heartMsg()
|
|
||||||
},1000)
|
|
||||||
}
|
}
|
||||||
//身份证读卡器初始化
|
//身份证读卡器初始化
|
||||||
openDeviceByIDCard(){
|
openDeviceByIDCard(){
|
||||||
@ -107,6 +106,9 @@ struct UserInfo {
|
|||||||
console.error("zzctest Failed to Open Device");
|
console.error("zzctest Failed to Open Device");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stopDeviceById(){
|
||||||
|
testNapi&&testNapi.StopReadCard()
|
||||||
|
}
|
||||||
// 通过身份证获取当前学员
|
// 通过身份证获取当前学员
|
||||||
getCurrentStudent(id) {
|
getCurrentStudent(id) {
|
||||||
let flag = false
|
let flag = false
|
||||||
@ -122,7 +124,7 @@ struct UserInfo {
|
|||||||
// this.currentUser.kszp=this.photo+res.kszp
|
// this.currentUser.kszp=this.photo+res.kszp
|
||||||
// this.currentUser.ksmjzp=this.photo+this.currentUser.ksmjzp
|
// this.currentUser.ksmjzp=this.photo+this.currentUser.ksmjzp
|
||||||
if (globalThis.singlePlay) {
|
if (globalThis.singlePlay) {
|
||||||
testNapi.StopReadCard();
|
this.stopDeviceById()
|
||||||
// globalThis.statue=4
|
// globalThis.statue=4
|
||||||
router.pushUrl({
|
router.pushUrl({
|
||||||
url: 'pages/Judge',
|
url: 'pages/Judge',
|
||||||
@ -224,15 +226,7 @@ struct UserInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async heartMsg() {
|
async heartMsg() {
|
||||||
const arr = [globalThis.signNum||0, globalThis.statue||1]
|
globalThis.udpClient2.setMsgCallBack((val)=>{
|
||||||
let tmpList = [];
|
|
||||||
tmpList.push(string2Bytes(arr[0], 1 * 8)[0])
|
|
||||||
tmpList.push(string2Bytes(arr[1], 1 * 8)[0])
|
|
||||||
const str =globalThis.lsh|| '0000000000000'
|
|
||||||
for (let i = 0;i < str.length; i++) {
|
|
||||||
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
|
|
||||||
}
|
|
||||||
const param= {id: 31,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId,callback:(val)=>{
|
|
||||||
if(val.id=='32'){
|
if(val.id=='32'){
|
||||||
globalThis.signNum=val.body[1]
|
globalThis.signNum=val.body[1]
|
||||||
if(val.body[0]=='7'){
|
if(val.body[0]=='7'){
|
||||||
@ -243,8 +237,7 @@ struct UserInfo {
|
|||||||
console.log('qkfnqkfn',val.body[0])
|
console.log('qkfnqkfn',val.body[0])
|
||||||
this.qkFn()
|
this.qkFn()
|
||||||
}
|
}
|
||||||
}}
|
})
|
||||||
globalThis.udpClient2.sendMsg(param, this.context)
|
|
||||||
}
|
}
|
||||||
getqkFn() {
|
getqkFn() {
|
||||||
let tmpList = [];
|
let tmpList = [];
|
||||||
@ -277,21 +270,28 @@ 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 === '17')
|
const faceParam = syssetParams.filter(sys => sys.v_no === '2313')
|
||||||
that.FaceOpenStatue = faceParam?.[0]?.v_value || '0'
|
that.FaceOpenStatue =faceParam?.[0]?.v_value=='3'? '1':'0'
|
||||||
|
that.FaceOpenStatue = '0'
|
||||||
|
console.log('that.FaceOpenStatue',that.FaceOpenStatue)
|
||||||
|
// faceParam?.[0]?.v_value ||
|
||||||
|
// 1身份证读卡器 2指纹 3人脸
|
||||||
|
if(faceParam?.[0]?.v_value=='1'){
|
||||||
|
that.openDeviceByIDCard()
|
||||||
|
}
|
||||||
console.log('mmmmm',that.FaceOpenStatue)
|
console.log('mmmmm',that.FaceOpenStatue)
|
||||||
//0不自动更新 1自动更新(不限次数) 2没有考生更新2次
|
//0不自动更新 1自动更新(不限次数) 2没有考生更新2次
|
||||||
if (that.studentRefreshStatue == '2') {
|
if (that.studentRefreshStatue == '2') {
|
||||||
clearInterval(that.interval2)
|
clearInterval(that.interval)
|
||||||
that.interval2 = setInterval(() => {
|
that.interval = setInterval(() => {
|
||||||
if (that.dataList.length == 0 && that.numCount < 3) {
|
if (that.dataList.length == 0 && that.numCount < 3) {
|
||||||
that.numCount++
|
that.numCount++
|
||||||
that.getExaminationStudentInfoFn()
|
that.getExaminationStudentInfoFn()
|
||||||
}
|
}
|
||||||
}, 5000)
|
}, 5000)
|
||||||
} else if (that.studentRefreshStatue == '1') {
|
} else if (that.studentRefreshStatue == '1') {
|
||||||
clearInterval(that.interval2)
|
clearInterval(that.interval)
|
||||||
that.interval2 = setInterval(() => {
|
that.interval = setInterval(() => {
|
||||||
if (that.dataList.length == 0) {
|
if (that.dataList.length == 0) {
|
||||||
that.getExaminationStudentInfoFn()
|
that.getExaminationStudentInfoFn()
|
||||||
}
|
}
|
||||||
@ -303,6 +303,7 @@ struct UserInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeFaceCompareSuccess() {
|
changeFaceCompareSuccess() {
|
||||||
|
globalThis.statue = 2
|
||||||
console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser))
|
console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser))
|
||||||
if (this.faceCompareSucess > 0) {
|
if (this.faceCompareSucess > 0) {
|
||||||
this.sfbdinterfaceFn()
|
this.sfbdinterfaceFn()
|
||||||
@ -334,12 +335,12 @@ struct UserInfo {
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
this.dataList = []
|
this.dataList = []
|
||||||
this.currentUser = EmptyCandidateObject
|
this.currentUser = EmptyCandidateObject
|
||||||
console.log('currentUser', JSON.stringify(this.currentUser))
|
|
||||||
this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage)
|
this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let dataList = []
|
let dataList = []
|
||||||
this.list = []
|
this.list = []
|
||||||
|
|
||||||
for (let key in res.getExaminationStudentInfoRsp.body) {
|
for (let key in res.getExaminationStudentInfoRsp.body) {
|
||||||
const a = res.getExaminationStudentInfoRsp.body[key]
|
const a = res.getExaminationStudentInfoRsp.body[key]
|
||||||
if (a instanceof Array) {
|
if (a instanceof Array) {
|
||||||
@ -438,7 +439,7 @@ struct UserInfo {
|
|||||||
ksxtbh: this.ksxtbh || '222',
|
ksxtbh: this.ksxtbh || '222',
|
||||||
sfzmhm: this.currentUser.sfzmhm || '',
|
sfzmhm: this.currentUser.sfzmhm || '',
|
||||||
ksysfzmhm: this.currentUser.ksy1sfzmhm || '',
|
ksysfzmhm: this.currentUser.ksy1sfzmhm || '',
|
||||||
zp: encodeURIComponent(this.faceCatchImg || ''),
|
zp: encodeURIComponent((this.faceCatchImg||this.currentUser.kszp.substr(22)) || ''),
|
||||||
kssj: dateFormat(date) || '',
|
kssj: dateFormat(date) || '',
|
||||||
kchp: decodeURI(plateNo),
|
kchp: decodeURI(plateNo),
|
||||||
Ksy2sfzmhm: this.currentUser.ksy2sfzmhm || ''
|
Ksy2sfzmhm: this.currentUser.ksy2sfzmhm || ''
|
||||||
@ -455,6 +456,7 @@ struct UserInfo {
|
|||||||
globalThis.lsh = this.currentUser.lsh
|
globalThis.lsh = this.currentUser.lsh
|
||||||
globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm
|
globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm
|
||||||
this.currentUser.id = '1'
|
this.currentUser.id = '1'
|
||||||
|
console.log('codecode',code)
|
||||||
if (code) {
|
if (code) {
|
||||||
this.AccountTable.query('0', (result) => {
|
this.AccountTable.query('0', (result) => {
|
||||||
if (result.length == 0) {
|
if (result.length == 0) {
|
||||||
@ -466,7 +468,8 @@ struct UserInfo {
|
|||||||
url: 'pages/Judge',
|
url: 'pages/Judge',
|
||||||
params: { examItems: examItems?.getExaminationItemRsp?.body?.ykxx }
|
params: { examItems: examItems?.getExaminationItemRsp?.body?.ykxx }
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
testNapi.StopReadCard();
|
this.stopDeviceById()
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -478,7 +481,7 @@ struct UserInfo {
|
|||||||
params: { examItems: examItems?.getExaminationItemRsp?.body?.ykxx }
|
params: { examItems: examItems?.getExaminationItemRsp?.body?.ykxx }
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
globalThis.statue = 4
|
globalThis.statue = 4
|
||||||
testNapi.StopReadCard();
|
this.stopDeviceById()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -492,8 +495,8 @@ struct UserInfo {
|
|||||||
}
|
}
|
||||||
outClick() {
|
outClick() {
|
||||||
clearInterval(this.interval)
|
clearInterval(this.interval)
|
||||||
clearInterval(this.interval2)
|
this.stopDeviceById()
|
||||||
testNapi.StopReadCard();
|
globalThis.udpClient2.setMsgCallBack(()=>{})
|
||||||
}
|
}
|
||||||
// 几个按钮公共样式
|
// 几个按钮公共样式
|
||||||
@Styles
|
@Styles
|
||||||
@ -646,7 +649,7 @@ struct UserInfo {
|
|||||||
router.pushUrl({
|
router.pushUrl({
|
||||||
url: 'pages/Judge',
|
url: 'pages/Judge',
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
testNapi.StopReadCard();
|
this.stopDeviceById()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -655,7 +658,7 @@ struct UserInfo {
|
|||||||
router.pushUrl({
|
router.pushUrl({
|
||||||
url: 'pages/Judge',
|
url: 'pages/Judge',
|
||||||
}, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
testNapi.StopReadCard();
|
this.stopDeviceById()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -678,8 +681,8 @@ struct UserInfo {
|
|||||||
faceCompareSucess: $faceCompareSucess,
|
faceCompareSucess: $faceCompareSucess,
|
||||||
getqkFlag: $getqkFlag,
|
getqkFlag: $getqkFlag,
|
||||||
faceCatchImg: $faceCatchImg,
|
faceCatchImg: $faceCatchImg,
|
||||||
lsh: globalThis.lsh,
|
|
||||||
showFaceCompare: $showFaceCompare,
|
showFaceCompare: $showFaceCompare,
|
||||||
|
lsh: globalThis.lsh,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (this.qkFlag) {
|
if (this.qkFlag) {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import common from '@ohos.app.ability.common';
|
|||||||
import promptAction from '@ohos.promptAction'
|
import promptAction from '@ohos.promptAction'
|
||||||
import { startRecordVideo, endRecordVideo,takePhoto } from '../common/service/videoService'
|
import { startRecordVideo, endRecordVideo,takePhoto } from '../common/service/videoService'
|
||||||
import configAddress from '../common/utils/FileConfig'
|
import configAddress from '../common/utils/FileConfig'
|
||||||
|
import util from '@ohos.util';
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
struct Index {
|
struct Index {
|
||||||
@ -33,7 +34,7 @@ struct Index {
|
|||||||
shuiying: true,
|
shuiying: true,
|
||||||
pztd: '2',
|
pztd: '2',
|
||||||
ljlx: '',
|
ljlx: '',
|
||||||
ip: '192.168.7.112',
|
ip: '192.168.36.94',
|
||||||
port: '554',
|
port: '554',
|
||||||
userName: 'admin',
|
userName: 'admin',
|
||||||
pwd: '12345qwe',
|
pwd: '12345qwe',
|
||||||
@ -60,7 +61,7 @@ struct Index {
|
|||||||
shuiying: true,
|
shuiying: true,
|
||||||
pztd: '2',
|
pztd: '2',
|
||||||
ljlx: '',
|
ljlx: '',
|
||||||
ip: '192.168.7.112',
|
ip: '192.168.36.94',
|
||||||
port: '554',
|
port: '554',
|
||||||
userName: 'admin',
|
userName: 'admin',
|
||||||
pwd: '12345qwe',
|
pwd: '12345qwe',
|
||||||
@ -148,7 +149,9 @@ struct Index {
|
|||||||
}
|
}
|
||||||
for (let i = 1; i <= 4; i++) {
|
for (let i = 1; i <= 4; i++) {
|
||||||
if (this.param['videoRecord'+i]) {
|
if (this.param['videoRecord'+i]) {
|
||||||
this.getfilehandleCode(i)
|
// setTimeout(()=>{
|
||||||
|
this.getfilehandleCode(i)
|
||||||
|
// },500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
@ -163,6 +166,7 @@ struct Index {
|
|||||||
.margin({ bottom: 10 * this.ratio })
|
.margin({ bottom: 10 * this.ratio })
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
for (let i = 1; i <= 4; i++) {
|
for (let i = 1; i <= 4; i++) {
|
||||||
|
console.log('rocord_handle',JSON.stringify(this.rocordHandleObj))
|
||||||
if (this.rocordHandleObj['rocord_handle'+i]) {
|
if (this.rocordHandleObj['rocord_handle'+i]) {
|
||||||
endRecordVideo(this.rocordHandleObj['rocord_handle'+i])
|
endRecordVideo(this.rocordHandleObj['rocord_handle'+i])
|
||||||
this.rocordHandleObj['rocord_handle'+i] = -1
|
this.rocordHandleObj['rocord_handle'+i] = -1
|
||||||
@ -186,11 +190,31 @@ struct Index {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await takePhoto(this.param,this.context,0,'pz')
|
try{
|
||||||
promptAction.showToast({
|
const buffer =await takePhoto(this.param,this.context,1,'pz/')
|
||||||
message: '抓图完成',
|
// let view: Uint8Array = new Uint8Array(buffer); // 使用Uint8Array读取arrayBuffer的数据
|
||||||
duration: 3000
|
// let textDecoder: util.TextDecoder = util.TextDecoder.create(); // 调用util模块的TextDecoder类
|
||||||
})
|
// const str = textDecoder.decodeWithStream(view).trim(); // 对view解码
|
||||||
|
// console.log("daihai base64 str = " + str);
|
||||||
|
// console.log("daihai base64 length = " + str.length);
|
||||||
|
promptAction.showToast({
|
||||||
|
message: '抓图完成',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
// takePhoto(this.param,this.context,1,'pz/').then((data) => {
|
||||||
|
// console.log('daihai suc')
|
||||||
|
promptAction.showToast({
|
||||||
|
message: '抓图完成',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
// }).catch((err) => {
|
||||||
|
// console.log('daihai err: ' + err)
|
||||||
|
// })
|
||||||
|
|
||||||
|
}catch (error){
|
||||||
|
console.log('daihai',error)
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
.margin({ bottom: 10 * this.ratio })
|
.margin({ bottom: 10 * this.ratio })
|
||||||
}.margin({ right: 38 * this.ratio, top: 110 * this.ratio })
|
}.margin({ right: 38 * this.ratio, top: 110 * this.ratio })
|
||||||
@ -371,7 +395,7 @@ struct Index {
|
|||||||
.onChange((value: string) => {
|
.onChange((value: string) => {
|
||||||
this.param.ip = value
|
this.param.ip = value
|
||||||
})
|
})
|
||||||
TextInput({ text: this.param['td'+index+1], controller: this.inputController })
|
TextInput({ text: this.param['td'+(Number(index)+1)], controller: this.inputController })
|
||||||
.type(InputType.Normal)
|
.type(InputType.Normal)
|
||||||
.borderRadius(2)
|
.borderRadius(2)
|
||||||
.width(96 * this.ratio)
|
.width(96 * this.ratio)
|
||||||
@ -380,7 +404,7 @@ struct Index {
|
|||||||
.margin({ right: 10 * this.ratio })
|
.margin({ right: 10 * this.ratio })
|
||||||
.fontSize(this.inputFontSize * this.ratio)
|
.fontSize(this.inputFontSize * this.ratio)
|
||||||
.onChange((value: string) => {
|
.onChange((value: string) => {
|
||||||
this.param.td1 = value
|
this.param['td'+(Number(index)+1)] = value
|
||||||
})
|
})
|
||||||
TextInput({ text: this.param.userName, controller: this.inputController })
|
TextInput({ text: this.param.userName, controller: this.inputController })
|
||||||
.type(InputType.Normal)
|
.type(InputType.Normal)
|
||||||
@ -589,7 +613,7 @@ struct Index {
|
|||||||
.width('100%')
|
.width('100%')
|
||||||
.height(395 * this.ratio)
|
.height(395 * this.ratio)
|
||||||
.backgroundColor('#CCC4B8')
|
.backgroundColor('#CCC4B8')
|
||||||
.position({ x: 0, y: 460 * this.ratio })
|
.position({ x: 0, y: 260 * this.ratio })
|
||||||
.border({ radius: { topLeft: 24 * this.ratio, topRight: 24 * this.ratio } })
|
.border({ radius: { topLeft: 24 * this.ratio, topRight: 24 * this.ratio } })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,7 +628,7 @@ struct Index {
|
|||||||
}
|
}
|
||||||
async getfilehandleCode(td){
|
async getfilehandleCode(td){
|
||||||
const record_handle = await startRecordVideo(this.param,td,this.context,'lp')
|
const record_handle = await startRecordVideo(this.param,td,this.context,'lp')
|
||||||
this.rocordHandleObj['rocord_handle1'+td]=record_handle
|
this.rocordHandleObj['rocord_handle'+td]=record_handle
|
||||||
}
|
}
|
||||||
outClick() {
|
outClick() {
|
||||||
this.openFlag = false
|
this.openFlag = false
|
||||||
@ -622,6 +646,9 @@ struct Index {
|
|||||||
|
|
||||||
async writeConfig() {
|
async writeConfig() {
|
||||||
this.oldParam = JSON.parse(JSON.stringify(this.param))
|
this.oldParam = JSON.parse(JSON.stringify(this.param))
|
||||||
|
this.videoArr=JSON.parse(JSON.stringify(this.videoArr))
|
||||||
|
console.log('videoArr',JSON.stringify(this.videoArr))
|
||||||
|
console.log('videoArr2',JSON.stringify(this.param))
|
||||||
const folderPath = await this.fileUtil.initFolder(`/config`);
|
const folderPath = await this.fileUtil.initFolder(`/config`);
|
||||||
this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.param), 'overWrite')
|
this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.param), 'overWrite')
|
||||||
this.showFlag = false
|
this.showFlag = false
|
||||||
|
|||||||
@ -23,13 +23,14 @@ struct FaceCompare {
|
|||||||
@Prop lsh: string;
|
@Prop lsh: string;
|
||||||
@Prop firstImage: string;
|
@Prop firstImage: string;
|
||||||
@Link faceCompareSucess: number;
|
@Link faceCompareSucess: number;
|
||||||
|
@Link showFaceCompare: boolean;
|
||||||
@Link getqkFlag: boolean;
|
@Link getqkFlag: boolean;
|
||||||
@Link faceCatchImg: string;
|
@Link faceCatchImg: string;
|
||||||
@State imageThumbnail: string = '';
|
@State imageThumbnail: string = '';
|
||||||
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发
|
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发
|
||||||
private vocObj = null;
|
private vocObj = null;
|
||||||
@State callBackFlag: boolean = false;
|
@State callBackFlag: boolean = false;
|
||||||
@State @Watch('clearIntervalFn') showFaceCompare: Boolean = false;
|
@State @Watch('clearIntervalFn') showFaceCompareFlag: Boolean = false;
|
||||||
@State video_url: string = 'rtsp://admin:12345qwe@192.168.5.41:8000/h264/ch2/main/av_stream'
|
@State video_url: string = 'rtsp://admin:12345qwe@192.168.5.41:8000/h264/ch2/main/av_stream'
|
||||||
@State previewUri: Resource = $r('app.media.2_nor')
|
@State previewUri: Resource = $r('app.media.2_nor')
|
||||||
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
|
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
|
||||||
@ -87,6 +88,7 @@ struct FaceCompare {
|
|||||||
.width('48%')
|
.width('48%')
|
||||||
.height('100%')
|
.height('100%')
|
||||||
|
|
||||||
|
|
||||||
Row() {
|
Row() {
|
||||||
Image(this.firstImage)
|
Image(this.firstImage)
|
||||||
.width('100%')
|
.width('100%')
|
||||||
@ -155,8 +157,8 @@ struct FaceCompare {
|
|||||||
this.controller.stop()
|
this.controller.stop()
|
||||||
this.vocObj && this.vocObj.releasePlayer()
|
this.vocObj && this.vocObj.releasePlayer()
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
|
this.showFaceCompareFlag=!this.showFaceCompareFlag
|
||||||
this.faceCompareSucess = -1
|
this.faceCompareSucess = -1
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.width('100%')
|
.width('100%')
|
||||||
@ -193,7 +195,11 @@ struct FaceCompare {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async faceComparFn() {
|
async faceComparFn() {
|
||||||
const result = await takePhoto(this.param, this.context, 1,'jt')
|
console.log('mmmmm0',1)
|
||||||
|
|
||||||
|
const result = await takePhoto(this.param, this.context, 1,'jt/')
|
||||||
|
console.log('mmmmm8',9)
|
||||||
|
|
||||||
faceCompare({
|
faceCompare({
|
||||||
sfzh: this.sfzh,
|
sfzh: this.sfzh,
|
||||||
firstImage: this.firstImage.substr(22),
|
firstImage: this.firstImage.substr(22),
|
||||||
@ -201,9 +207,12 @@ struct FaceCompare {
|
|||||||
type: 2,
|
type: 2,
|
||||||
verifyType: 1
|
verifyType: 1
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
console.log('mmmmm8',res)
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
this.controller.stop()
|
this.controller.stop()
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
|
this.showFaceCompareFlag=!this.showFaceCompareFlag
|
||||||
this.faceCompareSucess = 1;
|
this.faceCompareSucess = 1;
|
||||||
// this.faceCatchImg = result
|
// this.faceCatchImg = result
|
||||||
this.vocObj.playAudio({
|
this.vocObj.playAudio({
|
||||||
@ -239,6 +248,7 @@ struct FaceCompare {
|
|||||||
this.callBackFlag = true
|
this.callBackFlag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param, this.context)
|
||||||
this.interval = setInterval(() => {
|
this.interval = setInterval(() => {
|
||||||
if (this.callBackFlag) {
|
if (this.callBackFlag) {
|
||||||
const param2 = {
|
const param2 = {
|
||||||
@ -246,31 +256,32 @@ struct FaceCompare {
|
|||||||
list: tmpList,
|
list: tmpList,
|
||||||
carNo: globalThis.carInfo.carNo,
|
carNo: globalThis.carInfo.carNo,
|
||||||
placeId: globalThis.carInfo.examinationRoomId,
|
placeId: globalThis.carInfo.examinationRoomId,
|
||||||
callback: (val) => {
|
|
||||||
if (val.id == '48') {
|
|
||||||
if (val.body[13] == '1') {
|
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
|
||||||
this.vocObj && this.vocObj.releasePlayer()
|
|
||||||
this.faceCompareSucess = 1
|
|
||||||
clearInterval(this.interval)
|
|
||||||
} else if (val.body[13] == '0' && this.callBackFlag) {
|
|
||||||
globalThis.statue = 2
|
|
||||||
this.vocObj && this.vocObj.playAudio({
|
|
||||||
type: 1,
|
|
||||||
name: 'face_chekc_fail.wav'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param2, this.context)
|
globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param2, this.context)
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param, this.context)
|
globalThis.udpClient2.setMsgCallBack((val) => {
|
||||||
|
if (val.id == '48') {
|
||||||
|
if (val.body[13] == '1') {
|
||||||
|
this.showFaceCompareFlag=!this.showFaceCompareFlag
|
||||||
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
|
this.vocObj && this.vocObj.releasePlayer()
|
||||||
|
this.faceCompareSucess = 1
|
||||||
|
clearInterval(this.interval)
|
||||||
|
} else if (val.body[13] == '0' && this.callBackFlag) {
|
||||||
|
globalThis.statue = 2
|
||||||
|
this.vocObj && this.vocObj.playAudio({
|
||||||
|
type: 1,
|
||||||
|
name: 'face_chekc_fail.wav'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getVideoConfig() {
|
async getVideoConfig() {
|
||||||
|
console.log('faceEnterIn')
|
||||||
this.vocObj = new voiceService(async (status, val, next) => {
|
this.vocObj = new voiceService(async (status, val, next) => {
|
||||||
if (status == 'idle') {
|
if (status == 'idle') {
|
||||||
if (val == 'face_check.mp3' || val == 'face_fail.mp3') {
|
if (val == 'face_check.mp3' || val == 'face_fail.mp3') {
|
||||||
@ -289,6 +300,7 @@ struct FaceCompare {
|
|||||||
}
|
}
|
||||||
} else if (val == 'yzcg.wav') {
|
} else if (val == 'yzcg.wav') {
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
|
this.showFaceCompareFlag=!this.showFaceCompareFlag
|
||||||
globalThis.statue = 4
|
globalThis.statue = 4
|
||||||
this.faceCompareSucess = 1;
|
this.faceCompareSucess = 1;
|
||||||
this.vocObj && this.vocObj.releasePlayer()
|
this.vocObj && this.vocObj.releasePlayer()
|
||||||
@ -297,11 +309,14 @@ struct FaceCompare {
|
|||||||
this.vocObj && this.vocObj.releasePlayer()
|
this.vocObj && this.vocObj.releasePlayer()
|
||||||
this.faceCompareSucess = -1
|
this.faceCompareSucess = -1
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
|
this.showFaceCompareFlag=!this.showFaceCompareFlag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = await this.fileUtil.readFile(configAddress.comoonfileWriteAddress + '/config/config3.txt');
|
const data = await this.fileUtil.readFile(configAddress.comoonfileWriteAddress + '/config/config3.txt');
|
||||||
|
console.log('faceEnterIn,data',data)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.vocObj && this.vocObj.playAudio({
|
this.vocObj && this.vocObj.playAudio({
|
||||||
type: 1,
|
type: 1,
|
||||||
@ -310,10 +325,10 @@ struct FaceCompare {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
this.param = JSON.parse(data)
|
this.param = JSON.parse(data)
|
||||||
this.param.userName = JSON.parse(data).userName
|
this.param.userName = JSON.parse(data).userName
|
||||||
this.param.ip = JSON.parse(data).ip
|
this.param.ip = this.param.ip
|
||||||
this.param.pwd = JSON.parse(data).pwd
|
this.param.pwd = this.param.pwd
|
||||||
this.param.port = JSON.parse(data).port
|
this.param.port = this.param.port
|
||||||
this.param.rlls = JSON.parse(data).rlls
|
this.param.rlls = this.param.rlls
|
||||||
this.controller.start()
|
this.controller.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user