main #1
@ -162,11 +162,11 @@ export default class Rdb {
 | 
				
			|||||||
      callback(ret);
 | 
					      callback(ret);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  sqlOperate(str,name,callback) {
 | 
					  async sqlOperate(str,name,callback) {
 | 
				
			||||||
    this.rdbStore.executeSql(str,(err)=>{
 | 
					    this.rdbStore.executeSql(str,(err)=>{
 | 
				
			||||||
      if (err) {
 | 
					      if (err) {
 | 
				
			||||||
        callback(false)
 | 
					 | 
				
			||||||
        console.info("ExecuteSql failed, err: "+name + JSON.stringify(err))
 | 
					        console.info("ExecuteSql failed, err: "+name + JSON.stringify(err))
 | 
				
			||||||
 | 
					        callback(false)
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      console.log('ExecuteSqlsuccess')
 | 
					      console.log('ExecuteSqlsuccess')
 | 
				
			||||||
 | 
				
			|||||||
@ -101,20 +101,16 @@ export async function getDoubleCeneterTable() {
 | 
				
			|||||||
//单中心存表
 | 
					//单中心存表
 | 
				
			||||||
export async function getSingleCenterTable() {
 | 
					export async function getSingleCenterTable() {
 | 
				
			||||||
   return new Promise((reslove,reject)=>{
 | 
					   return new Promise((reslove,reject)=>{
 | 
				
			||||||
      upDataZhongxinginitialization().then((flag)=>{
 | 
					      upDataZhongxinginitialization().then((result)=>{
 | 
				
			||||||
          if(flag){
 | 
					          if(result){
 | 
				
			||||||
              router.pushUrl({
 | 
					              router.pushUrl({
 | 
				
			||||||
                  url: 'pages/ExaminerLogin',
 | 
					                  url: 'pages/ExaminerLogin',
 | 
				
			||||||
              }, router.RouterMode.Single)
 | 
					              }, router.RouterMode.Single)
 | 
				
			||||||
              reslove(true)
 | 
					              reslove(true)
 | 
				
			||||||
          }else{
 | 
					          }else{
 | 
				
			||||||
              // router.pushUrl({
 | 
					 | 
				
			||||||
              //     url: 'pages/ExaminerLogin',
 | 
					 | 
				
			||||||
              // }, router.RouterMode.Single)
 | 
					 | 
				
			||||||
              // reslove(true)
 | 
					 | 
				
			||||||
              promptAction.showToast({
 | 
					              promptAction.showToast({
 | 
				
			||||||
                  message: '联网更新失败,请检查网络后重新更新',
 | 
					                  message: `联网更新失败,请检查网络后重新更新`,
 | 
				
			||||||
                  duration: 1000
 | 
					                  duration: 500
 | 
				
			||||||
              });
 | 
					              });
 | 
				
			||||||
              reslove(false)
 | 
					              reslove(false)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
				
			|||||||
@ -73,6 +73,7 @@ const centerToMap={
 | 
				
			|||||||
  't_carparmset':MA_T_CARPARMSET,
 | 
					  't_carparmset':MA_T_CARPARMSET,
 | 
				
			||||||
  // 'ES_CAR_VIDEO_PARAMETER':ES_CAR_VIDE0pO_PARAMETER
 | 
					  // 'ES_CAR_VIDEO_PARAMETER':ES_CAR_VIDE0pO_PARAMETER
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function sqlInsertCommonFn(tableName,resultArr){
 | 
					function sqlInsertCommonFn(tableName,resultArr){
 | 
				
			||||||
  return new Promise((resolve,reject)=>{
 | 
					  return new Promise((resolve,reject)=>{
 | 
				
			||||||
    const accountTable = new AccountTable(() => {
 | 
					    const accountTable = new AccountTable(() => {
 | 
				
			||||||
@ -138,6 +139,7 @@ function sqlInsertCommonFn(tableName,resultArr){
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function getDataBaseTable(params) {
 | 
					export async function getDataBaseTable(params) {
 | 
				
			||||||
  return new Promise((resolve, reject) => {
 | 
					  return new Promise((resolve, reject) => {
 | 
				
			||||||
    const accountTable = new AccountTable(() => {
 | 
					    const accountTable = new AccountTable(() => {
 | 
				
			||||||
@ -199,7 +201,11 @@ export async function getDataBaseTable(params) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					//依据数组和表名更新sql表
 | 
				
			||||||
 | 
					export async function upDateTableByArray(tableName,arr) {
 | 
				
			||||||
 | 
					  sqlInsertCommonFn(tableName,arr)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//更新双中心表
 | 
				
			||||||
export async function upDateTable(params) {
 | 
					export async function upDateTable(params) {
 | 
				
			||||||
  return new Promise((resolve, reject) => {
 | 
					  return new Promise((resolve, reject) => {
 | 
				
			||||||
    const date = new Date()
 | 
					    const date = new Date()
 | 
				
			||||||
@ -237,11 +243,6 @@ export async function upDateTable(params) {
 | 
				
			|||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
export async function upDateTableConfig(tableName,arr) {
 | 
					 | 
				
			||||||
  sqlInsertCommonFn(tableName,arr)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
//考试平台
 | 
					//考试平台
 | 
				
			||||||
export async function getMySystemSetTable(params) {
 | 
					export async function getMySystemSetTable(params) {
 | 
				
			||||||
  return new Promise((resolve, reject) => {
 | 
					  return new Promise((resolve, reject) => {
 | 
				
			||||||
@ -276,6 +277,7 @@ export async function getMySystemSetTable(params) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//依据表名同步获取数据
 | 
				
			||||||
export async function getSyncData(tableName) {
 | 
					export async function getSyncData(tableName) {
 | 
				
			||||||
  return new Promise((resolve, reject) => {
 | 
					  return new Promise((resolve, reject) => {
 | 
				
			||||||
    const accountTable = new AccountTable(() => {
 | 
					    const accountTable = new AccountTable(() => {
 | 
				
			||||||
@ -288,6 +290,7 @@ export async function getSyncData(tableName) {
 | 
				
			|||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function delSyncTable(tableName){
 | 
					export async function delSyncTable(tableName){
 | 
				
			||||||
  return new Promise((resolve,reject)=>{
 | 
					  return new Promise((resolve,reject)=>{
 | 
				
			||||||
    const accountTable = new AccountTable(() => {
 | 
					    const accountTable = new AccountTable(() => {
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ import { dateFormat} from '../utils/tools'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//获取设备信息
 | 
					//获取设备信息
 | 
				
			||||||
export async function getDeviceInfo() {
 | 
					export async function getDeviceInfo() {
 | 
				
			||||||
    globalThis.deviceNo = 'J43405J003101'; //设备mac
 | 
					    // globalThis.deviceNo = 'J43405J003101'; //设备mac
 | 
				
			||||||
    globalThis.deviceNo = 'FE-FC-FE-7C-5C-77'; //设备mac
 | 
					    globalThis.deviceNo = 'FE-FC-FE-7C-5C-77'; //设备mac
 | 
				
			||||||
    globalThis.diskId = '1231231231'; //硬盘号
 | 
					    globalThis.diskId = '1231231231'; //硬盘号
 | 
				
			||||||
    globalThis.hasAuth = true;
 | 
					    globalThis.hasAuth = true;
 | 
				
			||||||
 | 
				
			|||||||
@ -3,55 +3,43 @@ import onvifclient from '@ohos.onvifclient';
 | 
				
			|||||||
import fs from '@ohos.file.fs'
 | 
					import fs from '@ohos.file.fs'
 | 
				
			||||||
import util from '@ohos.util';
 | 
					import util from '@ohos.util';
 | 
				
			||||||
import configAddress from '../../common/utils/FileConfig'
 | 
					import configAddress from '../../common/utils/FileConfig'
 | 
				
			||||||
import {getCurrentTime} from '../utils/tools'
 | 
					import { getCurrentTime } from '../utils/tools'
 | 
				
			||||||
 | 
					import record from '@ohos.rtsprecord';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const rtsp_server = record.createServer();
 | 
				
			||||||
//开始录屏
 | 
					//开始录屏
 | 
				
			||||||
export async function startRecordVideo(param,td,context) {
 | 
					export async function startRecordVideo(param, td, context, dir) {
 | 
				
			||||||
  return new Promise<videoPlayRes>(async (reslove,reject)=>{
 | 
					  return new Promise<videoPlayRes>((reslove, reject) => {
 | 
				
			||||||
    var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
 | 
					    var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
 | 
				
			||||||
    // var result3 = onvifclient.startRecordVideo(video_uri, "video/" );
 | 
					    if (rtsp_server != null) {
 | 
				
			||||||
    // const record_handle = result3.dataInt;
 | 
					      console.log(`Rtsprecord startRecordVideo begin`);
 | 
				
			||||||
    // console.info( `baoyihu startRecordVideo  result:`+result3.result+ ` VideoFile:`+result3.dataString );
 | 
					      var recordResult = rtsp_server.startRecordVideo(context, video_uri, dir);
 | 
				
			||||||
    // reslove(record_handle)
 | 
					      const handleId = recordResult.dataInt;
 | 
				
			||||||
    // return
 | 
					      reslove(handleId)
 | 
				
			||||||
    var mediaTest = mediaLibrary.getMediaLibrary(context);
 | 
					      console.log(`Rtsprecord startRecordVideo record_handle` + recordResult.dataInt);
 | 
				
			||||||
    let mediaType = mediaLibrary.MediaType.VIDEO;
 | 
					    }
 | 
				
			||||||
    let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_VIDEO;
 | 
					    else {
 | 
				
			||||||
    const num = Math.floor(Math.random() * 10000)
 | 
					      console.log(`Rtsprecord startRecordVideo rtsp_server isnull`);
 | 
				
			||||||
    const name = `movie_record${getCurrentTime(1)}.mp4`
 | 
					      reslove(0)
 | 
				
			||||||
    const path = await mediaTest.getPublicDirectory(DIR_DOCUMENTS);
 | 
					    }
 | 
				
			||||||
    mediaTest.createAsset(mediaType, name, path, (error, asset) => {
 | 
					    console.log(`Rtsprecord startRecordVideo end`);
 | 
				
			||||||
      const file_asset = asset; // 记录 ,关闭时用到
 | 
					 | 
				
			||||||
      asset.open('rw', (error, fd) => {
 | 
					 | 
				
			||||||
        if (fd > 0) {
 | 
					 | 
				
			||||||
          var file_path = configAddress.videoSavePath + name;
 | 
					 | 
				
			||||||
          var result = onvifclient.startRecordVideo(video_uri, file_path, fd);
 | 
					 | 
				
			||||||
          var rocord_handle = result.dataInt; // 记录 ,关闭时用到
 | 
					 | 
				
			||||||
          reslove({fd,rocord_handle,file_asset})
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          reslove({fd:0,rocord_handle:0,file_asset:0})
 | 
					 | 
				
			||||||
          console.error('baoyihu startRecordVideo File Open failed with error: ' + error);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//结束录屏
 | 
					//结束录屏
 | 
				
			||||||
export async function endRecordVideo(record_handle) {
 | 
					export async function endRecordVideo(record_handle) {
 | 
				
			||||||
  if(this.record_handle >0)
 | 
					  if (rtsp_server != null && record_handle > 0) {
 | 
				
			||||||
  {
 | 
					    console.log(`Rtsprecord endRecordVideo begin`);
 | 
				
			||||||
    var result = onvifclient.endRecordVideo(record_handle);
 | 
					    var recordResult = rtsp_server.endRecordVideo(record_handle);
 | 
				
			||||||
    // this.record_handle = -1;
 | 
					    console.log(`Rtsprecord startRecordVideo record_handle` + recordResult.dataInt + ` filename:` + recordResult.fileName);
 | 
				
			||||||
    console.info( `baoyihu endRecordVideo  result:`+result.result+ ` VideoFile:`+result.dataString );
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else {
 | 
				
			||||||
  {
 | 
					    console.log(`Rtsprecord endRecordVideo handleId isnull`);
 | 
				
			||||||
    console.info( `baoyihu endRecordVideo  no task error`);
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  // var result = onvifclient.endRecordVideo(filehandle);
 | 
					  // var result = onvifclient.endRecordVideo(record_handle);
 | 
				
			||||||
  // fs.closeSync(filehandle);
 | 
					  // fs.closeSync(record_handle);
 | 
				
			||||||
  // file_asset.close(filehandle);
 | 
					  // file_asset.close(record_handle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -60,65 +48,49 @@ export async function endRecordVideo(record_handle) {
 | 
				
			|||||||
 * @param context
 | 
					 * @param context
 | 
				
			||||||
 * @param type=0不获取base64
 | 
					 * @param type=0不获取base64
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export async function takePhoto(param,context,type=0) {
 | 
					export async function takePhoto(param, context, type = 0, dir) {
 | 
				
			||||||
  return new Promise(async (reslove,reject)=>{
 | 
					  return new Promise((reslove, reject) => {
 | 
				
			||||||
    var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
 | 
					    var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
 | 
				
			||||||
 | 
					    var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, dir);
 | 
				
			||||||
    var mediaTest = mediaLibrary.getMediaLibrary(context);
 | 
					    console.log(`baoyihu Rtsprecord getVideoSnapshot file:` + snapResult.dataString);
 | 
				
			||||||
    let mediaType = mediaLibrary.MediaType.IMAGE;
 | 
					    if (type == 1) {
 | 
				
			||||||
    let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_IMAGE;
 | 
					      reslove(snapResult.dataString)
 | 
				
			||||||
    const path = await mediaTest.getPublicDirectory(DIR_DOCUMENTS);
 | 
					    } else {
 | 
				
			||||||
    const name="picture_record" + getCurrentTime(1) + ".jpg"
 | 
					      reslove('')
 | 
				
			||||||
    // if(type==1){
 | 
					    }
 | 
				
			||||||
    //   var result = onvifclient.getVideoSnapshot(video_uri,"")
 | 
					 | 
				
			||||||
    //   reslove(result.dataString)
 | 
					 | 
				
			||||||
    // }else{
 | 
					 | 
				
			||||||
    //   var result = onvifclient.getVideoSnapshot(video_uri,"")
 | 
					 | 
				
			||||||
    //   reslove('')
 | 
					 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
    // return
 | 
					 | 
				
			||||||
    mediaTest.createAsset(mediaType, name, path, (error, asset) => {
 | 
					 | 
				
			||||||
      asset.open('rw', (error, fd) => {
 | 
					 | 
				
			||||||
        if (fd > 0) {
 | 
					 | 
				
			||||||
          var file_path =configAddress.picSavePath + name
 | 
					 | 
				
			||||||
          // var result3 = onvifclient.getVideoSnapshot(video_uri,"");
 | 
					 | 
				
			||||||
          var result3 = onvifclient.getVideoSnapshot(video_uri, file_path, fd);
 | 
					 | 
				
			||||||
          fs.closeSync(fd);
 | 
					 | 
				
			||||||
          asset.close(fd);
 | 
					 | 
				
			||||||
          if(type==1){
 | 
					 | 
				
			||||||
            fs.lstat(file_path).then((stat) => {
 | 
					 | 
				
			||||||
              let file = fs.openSync(file_path, fs.OpenMode.READ_WRITE);
 | 
					 | 
				
			||||||
              const size = Number(stat.size) + 100
 | 
					 | 
				
			||||||
              let buf = new ArrayBuffer(size);
 | 
					 | 
				
			||||||
              let num = fs.readSync(file.fd, buf);
 | 
					 | 
				
			||||||
              var that = new util.Base64();
 | 
					 | 
				
			||||||
              var array = new Uint8Array(buf);
 | 
					 | 
				
			||||||
              var result = that.encodeToStringSync(array); //base64圖片
 | 
					 | 
				
			||||||
              mediaTest.deleteAsset(file_path).then(() => {
 | 
					 | 
				
			||||||
                console.log('delSuccess')
 | 
					 | 
				
			||||||
              }).catch(() => {
 | 
					 | 
				
			||||||
                console.log('delError')
 | 
					 | 
				
			||||||
              })
 | 
					 | 
				
			||||||
              this.fileUtil.deleteF(file_path, 3)
 | 
					 | 
				
			||||||
              reslove(result)
 | 
					 | 
				
			||||||
            }).catch((err) => {
 | 
					 | 
				
			||||||
              console.info("get link status failed with error message: " + err.message + ", error code: " + err.code);
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
          }else{
 | 
					 | 
				
			||||||
            reslove('')
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          console.error('baoyihu getVideoSnapshot File Open failed with error: ' + error);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function deleteAllFile(dir,context) {
 | 
				
			||||||
 | 
					  const mediaType = mediaLibrary.MediaType.IMAGE
 | 
				
			||||||
 | 
					  var mymediaLib = await mediaLibrary.getMediaLibrary(context);
 | 
				
			||||||
 | 
					  let fetchOp = { selections: `media_type =? `, selectionArgs: [`${mediaType}`] }
 | 
				
			||||||
 | 
					  console.info(`baoyihu deleteRecordFile  fetchOp:` + fetchOp);
 | 
				
			||||||
 | 
					  var asset = await mymediaLib.getFileAssets(fetchOp);
 | 
				
			||||||
 | 
					  if (mediaType == mediaLibrary.MediaType.IMAGE) {
 | 
				
			||||||
 | 
					    var base_Dir = "/storage/media/100/local/files/Pictures/";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  else {
 | 
				
			||||||
 | 
					    var base_Dir = "/storage/media/100/local/files/Videos/";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  var my_dir = dir;
 | 
				
			||||||
 | 
					  asset.getAllObject((eer, fileArray) => {
 | 
				
			||||||
 | 
					    for (let onfile of fileArray) {
 | 
				
			||||||
 | 
					      var delet_dir = base_Dir + my_dir + onfile.uri
 | 
				
			||||||
 | 
					      console.info(`baoyihu deleteRecordFile  uri:` + delet_dir);
 | 
				
			||||||
 | 
					      mymediaLib.deleteAsset(delet_dir, (error, asset) => {
 | 
				
			||||||
 | 
					        console.info(`baoyihu deleteRecordFile  3 error:` + error);
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					  console.log(`Rtsprecord getVideoSnapshot end:`);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface videoPlayRes {
 | 
					export interface videoPlayRes {
 | 
				
			||||||
  rocord_handle?: number;
 | 
					  rocord_handle?: number;
 | 
				
			||||||
  fd?: number;
 | 
					  fd?: number;
 | 
				
			||||||
  file_asset?:any
 | 
					  file_asset?: any
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -14,12 +14,9 @@ export async function getUDP() {
 | 
				
			|||||||
    if(result.length){
 | 
					    if(result.length){
 | 
				
			||||||
      if(globalThis.udpClient&&globalThis.udpClient.closeUdp){
 | 
					      if(globalThis.udpClient&&globalThis.udpClient.closeUdp){
 | 
				
			||||||
        globalThis.udpClient.closeUdp(()=>{
 | 
					        globalThis.udpClient.closeUdp(()=>{
 | 
				
			||||||
 | 
					          // const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800','192.168.36.9','11111')//杭州
 | 
				
			||||||
          globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort)
 | 
					          globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort)
 | 
				
			||||||
 | 
					 | 
				
			||||||
          globalThis.udpClient.sendMsg('111')
 | 
					          globalThis.udpClient.sendMsg('111')
 | 
				
			||||||
 | 
					 | 
				
			||||||
          // globalThis.udpClient = udpClient
 | 
					 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      }else{
 | 
					      }else{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -42,48 +39,31 @@ export async function getUDP2() {
 | 
				
			|||||||
    if(result.length){
 | 
					    if(result.length){
 | 
				
			||||||
      if(globalThis.udpClient2&&globalThis.udpClient2.closeUdp){
 | 
					      if(globalThis.udpClient2&&globalThis.udpClient2.closeUdp){
 | 
				
			||||||
        globalThis.udpClient2.closeUdp(async ()=>{
 | 
					        globalThis.udpClient2.closeUdp(async ()=>{
 | 
				
			||||||
          // globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800','112.80.35.83','11056')
 | 
					          // const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800','192.168.36.9','11111')//杭州
 | 
				
			||||||
          globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
 | 
					          globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
 | 
				
			||||||
          // globalThis.udpClient2.rebindUdp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | 
					 | 
				
			||||||
          // globalThis.udpClient2.rebindUdp(result[0].udplocalIp, result[0].udpLocalIpByGPS,result[0].udpOppositeIp,result[0].udpOppositeIpPortByGPS)
 | 
					 | 
				
			||||||
          globalThis.udpClient2.onMessage((val)=>{
 | 
					          globalThis.udpClient2.onMessage((val)=>{
 | 
				
			||||||
            // globalThis.udpClnt2.sendMsg(heartMsg(context))
 | 
					            // globalThis.udpClnt2.sendMsg(heartMsg(context))
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      }else{
 | 
					      }else{
 | 
				
			||||||
        // const udpClient: UdpClient =new UdpClient(result[0].udplocalIp, result[0].udpLocalIpByGPS,result[0].udpOppositeIp,result[0].udpOppositeIpPortByGPS)
 | 
					 | 
				
			||||||
        const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
 | 
					        const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
 | 
				
			||||||
        // const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800','112.80.35.83','11056')
 | 
					 | 
				
			||||||
        // const udpClient: UdpClient =new UdpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        globalThis.udpClient2 = udpClient
 | 
					        globalThis.udpClient2 = udpClient
 | 
				
			||||||
        globalThis.udpClient2.bindUdp()
 | 
					        globalThis.udpClient2.bindUdp()
 | 
				
			||||||
 | 
					 | 
				
			||||||
        // globalThis.udpClient2.sendMsg(heartMsg(context))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        globalThis.udpClient2.onMessage((val)=>{
 | 
					        globalThis.udpClient2.onMessage((val)=>{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          if(val.id=='32'){
 | 
					          if(val.id=='32'){
 | 
				
			||||||
            globalThis.signNum=val.body[1]
 | 
					            globalThis.signNum=val.body[1]
 | 
				
			||||||
          }else if(val.id=='46'){
 | 
					          }else if(val.id=='46'){
 | 
				
			||||||
 | 
					 | 
				
			||||||
            let tmpList = []
 | 
					            let tmpList = []
 | 
				
			||||||
            console.log('lsh',globalThis.lsh)
 | 
					            console.log('lsh',globalThis.lsh)
 | 
				
			||||||
            const str = globalThis.lsh
 | 
					            const str = globalThis.lsh
 | 
				
			||||||
            for (let i = 0;i < str.length; i++) {
 | 
					            for (let i = 0;i < str.length; i++) {
 | 
				
			||||||
              tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
 | 
					              tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
            const param = { id: 47, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId }
 | 
					            const param = { id: 47, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId }
 | 
				
			||||||
            globalThis.udpClient2.send(param)
 | 
					            globalThis.udpClient2.send(param)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					 | 
				
			||||||
          // setTimeout(async ()=>{
 | 
					 | 
				
			||||||
          //
 | 
					 | 
				
			||||||
          //   globalThis.udpClient2.sendMsg(heartMsg(context))
 | 
					 | 
				
			||||||
          //
 | 
					 | 
				
			||||||
          // },1000)
 | 
					 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }else{
 | 
					    }else{
 | 
				
			||||||
@ -98,7 +78,6 @@ export async function setTopLineUdp(){
 | 
				
			|||||||
  if(config && config[0] && config[0].udplocalIp){
 | 
					  if(config && config[0] && config[0].udplocalIp){
 | 
				
			||||||
    const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config[0];
 | 
					    const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config[0];
 | 
				
			||||||
    const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509',udpOppositeIp,udpOppositeIpPort)
 | 
					    const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509',udpOppositeIp,udpOppositeIpPort)
 | 
				
			||||||
    // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333')
 | 
					 | 
				
			||||||
    udpClient.bindUdp()
 | 
					    udpClient.bindUdp()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
@ -114,7 +93,7 @@ export async function setJudgeUdp(){
 | 
				
			|||||||
  const config = await getSyncData('IpConfigTable');
 | 
					  const config = await getSyncData('IpConfigTable');
 | 
				
			||||||
  if(config && config[0] && config[0].udplocalIp){
 | 
					  if(config && config[0] && config[0].udplocalIp){
 | 
				
			||||||
    const {udplocalIp} = config[0];
 | 
					    const {udplocalIp} = config[0];
 | 
				
			||||||
    // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080','192.168.32.167','33333')
 | 
					    // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080','192.168.36.9','33333')
 | 
				
			||||||
    const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080',globalThis.carInfo?.gpsAddress,globalThis.carInfo?.hintPort)
 | 
					    const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080',globalThis.carInfo?.gpsAddress,globalThis.carInfo?.hintPort)
 | 
				
			||||||
    // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333')
 | 
					    // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333')
 | 
				
			||||||
    udpClient.bindUdp()
 | 
					    udpClient.bindUdp()
 | 
				
			||||||
 | 
				
			|||||||
@ -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,7 +161,9 @@ 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
 | 
				
			||||||
@ -177,11 +179,13 @@ export default class UdpClientByCenter {
 | 
				
			|||||||
                port: parseInt(this.oppositeIpPort),
 | 
					                port: parseInt(this.oppositeIpPort),
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        this.stashFn=param.callback?param.callback:()=>{}
 | 
					 | 
				
			||||||
        promise.then(() => {
 | 
					        promise.then(() => {
 | 
				
			||||||
            if(this.sendId=='46'&¶m.callback){
 | 
					            if(param.sendCallback){
 | 
				
			||||||
                param.callback()
 | 
					                param.sendCallback()
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            // if(this.sendId=='46'&¶m.callback){
 | 
				
			||||||
 | 
					            //     param.callback()
 | 
				
			||||||
 | 
					            // }
 | 
				
			||||||
            console.log(`${TAG} udp send success:`);
 | 
					            console.log(`${TAG} udp send success:`);
 | 
				
			||||||
        }).catch(err => {
 | 
					        }).catch(err => {
 | 
				
			||||||
            console.log(`${TAG} udp send fail:${JSON.stringify(err)}`);
 | 
					            console.log(`${TAG} udp send fail:${JSON.stringify(err)}`);
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,7 @@ import router from '@ohos.router'
 | 
				
			|||||||
import TopLogo from './compontents/topLogo'
 | 
					import TopLogo from './compontents/topLogo'
 | 
				
			||||||
import { examinerLoginService } from '../common/service/ExaminerService'
 | 
					import { examinerLoginService } from '../common/service/ExaminerService'
 | 
				
			||||||
import Md5  from '../common/utils/md5';
 | 
					import Md5  from '../common/utils/md5';
 | 
				
			||||||
import prompt from '@ohos.prompt'
 | 
					import promptAction from '@ohos.promptAction'
 | 
				
			||||||
import { voiceService } from '../common/service/voiceService'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Entry
 | 
					@Entry
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
@ -17,127 +16,118 @@ struct Index {
 | 
				
			|||||||
  @State @Watch('outClick') outFlag: boolean = false;
 | 
					  @State @Watch('outClick') outFlag: boolean = false;
 | 
				
			||||||
  private vocObj = null;
 | 
					  private vocObj = null;
 | 
				
			||||||
  build() {
 | 
					  build() {
 | 
				
			||||||
 | 
					    Column() {
 | 
				
			||||||
 | 
					      TopLogo({outFlag:$outFlag})
 | 
				
			||||||
      Column() {
 | 
					      Column() {
 | 
				
			||||||
        TopLogo({outFlag:$outFlag})
 | 
					        Text('请考官输入用户名密码').fontColor('#FFAD33').fontSize(36*this.ratio)
 | 
				
			||||||
 | 
					        Row() {
 | 
				
			||||||
 | 
					          ForEach(this.inputPlaceholderArr, (item:any, index:number) => {
 | 
				
			||||||
 | 
					            Row(){
 | 
				
			||||||
 | 
					              TextInput({ placeholder: `${item}`,text: this.inputTextArr[index] })
 | 
				
			||||||
 | 
					                .fontSize(42*this.ratio)
 | 
				
			||||||
 | 
					                .fontColor('white')
 | 
				
			||||||
 | 
					                .placeholderFont({ size: 42*this.ratio })
 | 
				
			||||||
 | 
					                .placeholderColor('gray')
 | 
				
			||||||
 | 
					                .caretColor('white')
 | 
				
			||||||
 | 
					                .backgroundColor('transparent')
 | 
				
			||||||
 | 
					                .width('90%')
 | 
				
			||||||
 | 
					                .margin({left: '4%'})
 | 
				
			||||||
 | 
					                .type(index === 0 ? InputType.Normal : InputType.Password)
 | 
				
			||||||
 | 
					                .focusable(false)
 | 
				
			||||||
 | 
					                .onClick(() => {
 | 
				
			||||||
 | 
					                  this.currentInputIndex = index;
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            .backgroundImage(this.currentInputIndex == index ?  $r('app.media.kuang_pre') :  $r('app.media.kuang_nor'))
 | 
				
			||||||
 | 
					            .backgroundImageSize({width:'100%',height:'100%'})
 | 
				
			||||||
 | 
					            .width('48%')
 | 
				
			||||||
 | 
					            .height('14.9%')
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        .width('90%')
 | 
				
			||||||
 | 
					        .margin({top: 25*this.ratio}) //20
 | 
				
			||||||
 | 
					        .justifyContent(FlexAlign.SpaceBetween)
 | 
				
			||||||
        Column() {
 | 
					        Column() {
 | 
				
			||||||
          Text('请考官输入用户名密码').fontColor('#FFAD33').fontSize(36*this.ratio)
 | 
					          Flex({wrap: FlexWrap.Wrap,
 | 
				
			||||||
          Row() {
 | 
					            justifyContent:FlexAlign.SpaceAround,
 | 
				
			||||||
            ForEach(this.inputPlaceholderArr, (item:any, index:number) => {
 | 
					            alignContent: FlexAlign.SpaceAround}) {
 | 
				
			||||||
              Row(){
 | 
					            ForEach(this.imgArr1, (item:Resource, index:number) => {
 | 
				
			||||||
                TextInput({ placeholder: `${item}`,text: this.inputTextArr[index] })
 | 
					              if(index === this.imgArr1.length -1 ) {
 | 
				
			||||||
                  .fontSize(42*this.ratio)
 | 
					                Image(item).width('38%').height('24%').onClick(() => {
 | 
				
			||||||
                  .fontColor('white')
 | 
					 | 
				
			||||||
                  .placeholderFont({ size: 42*this.ratio })
 | 
					 | 
				
			||||||
                  .placeholderColor('gray')
 | 
					 | 
				
			||||||
                  .caretColor('white')
 | 
					 | 
				
			||||||
                  .backgroundColor('transparent')
 | 
					 | 
				
			||||||
                  .width('90%')
 | 
					 | 
				
			||||||
                  .margin({left: '4%'})
 | 
					 | 
				
			||||||
                  .type(index === 0 ? InputType.Normal : InputType.Password)
 | 
					 | 
				
			||||||
                  .focusable(false)
 | 
					 | 
				
			||||||
                  .onClick(() => {
 | 
					 | 
				
			||||||
                    this.currentInputIndex = index;
 | 
					 | 
				
			||||||
                  })
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
              .backgroundImage(this.currentInputIndex == index ?  $r('app.media.kuang_pre') :  $r('app.media.kuang_nor'))
 | 
					 | 
				
			||||||
              .backgroundImageSize({width:'100%',height:'100%'})
 | 
					 | 
				
			||||||
              .width('48%')
 | 
					 | 
				
			||||||
              .height('14.9%')
 | 
					 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          .width('90%')
 | 
					 | 
				
			||||||
          .margin({top: 25*this.ratio}) //20
 | 
					 | 
				
			||||||
          .justifyContent(FlexAlign.SpaceBetween)
 | 
					 | 
				
			||||||
          Column() {
 | 
					 | 
				
			||||||
            Flex({wrap: FlexWrap.Wrap,
 | 
					 | 
				
			||||||
                  justifyContent:FlexAlign.SpaceAround,
 | 
					 | 
				
			||||||
                  alignContent: FlexAlign.SpaceAround}) {
 | 
					 | 
				
			||||||
              ForEach(this.imgArr1, (item:Resource, index:number) => {
 | 
					 | 
				
			||||||
                if(index === this.imgArr1.length -1 ) {
 | 
					 | 
				
			||||||
                  Image(item).width('38%').height('24%').onClick(() => {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if(this.inputTextArr[0].trim()==''||this.inputTextArr[1].trim()==''){
 | 
					                  if(this.inputTextArr[0].trim()==''||this.inputTextArr[1].trim()==''){
 | 
				
			||||||
                      prompt.showToast({
 | 
					                    promptAction.showToast({
 | 
				
			||||||
                        message: '请输入用户名和密码',
 | 
					                      message: '请输入用户名和密码',
 | 
				
			||||||
                        duration: 3000
 | 
					                      duration: 3000
 | 
				
			||||||
                      });
 | 
					                    });
 | 
				
			||||||
                      return
 | 
					                    return
 | 
				
			||||||
                    }
 | 
					                  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    const param = {
 | 
					                  const param = {
 | 
				
			||||||
                      carId: globalThis.carInfo.carId,
 | 
					                    carId: globalThis.carInfo.carId,
 | 
				
			||||||
                      examinationRoomId: globalThis.carInfo.examinationRoomId,
 | 
					                    examinationRoomId: globalThis.carInfo.examinationRoomId,
 | 
				
			||||||
                      username: this.inputTextArr[0],
 | 
					                    username: this.inputTextArr[0],
 | 
				
			||||||
                      password: Md5.Instance.get_md5(this.inputTextArr[1])
 | 
					                    password: Md5.Instance.get_md5(this.inputTextArr[1])
 | 
				
			||||||
                    }
 | 
					                  }
 | 
				
			||||||
                    console.log('paramparam',JSON.stringify(globalThis.carInfo))
 | 
					                  console.log('paramparam',JSON.stringify(globalThis.carInfo))
 | 
				
			||||||
                    examinerLoginService(param).then(res => {
 | 
					                  examinerLoginService(param).then(res => {
 | 
				
			||||||
                      // this.vocObj.playAudio({
 | 
					 | 
				
			||||||
                      //   type: 1,
 | 
					 | 
				
			||||||
                      //   name: 'media_button.wav'
 | 
					 | 
				
			||||||
                      // })
 | 
					 | 
				
			||||||
                      // this.url='pages/userInfo'
 | 
					 | 
				
			||||||
                      router.pushUrl({
 | 
					 | 
				
			||||||
                        url: 'pages/UserInfo',
 | 
					 | 
				
			||||||
                      },router.RouterMode.Single);
 | 
					 | 
				
			||||||
                      console.log('res11',JSON.stringify(res))
 | 
					 | 
				
			||||||
                      globalThis.username=this.inputTextArr[0]
 | 
					 | 
				
			||||||
                    })
 | 
					 | 
				
			||||||
                  })
 | 
					 | 
				
			||||||
                }else {
 | 
					 | 
				
			||||||
                  Image(item).width('18%').height('24%').onClick(() => {
 | 
					 | 
				
			||||||
                    // this.vocObj.playAudio({
 | 
					                    // this.vocObj.playAudio({
 | 
				
			||||||
                    //   type: 1,
 | 
					                    //   type: 1,
 | 
				
			||||||
                    //   name: 'media_button.wav'
 | 
					                    //   name: 'media_button.wav'
 | 
				
			||||||
                    // })
 | 
					                    // })
 | 
				
			||||||
                    this.url=''
 | 
					                    // this.url='pages/userInfo'
 | 
				
			||||||
                    if(index < 9) {
 | 
					                    router.pushUrl({
 | 
				
			||||||
                      this.inputTextArr[this.currentInputIndex] +=  (index + 1).toString()
 | 
					                      url: 'pages/UserInfo',
 | 
				
			||||||
                    }else {
 | 
					                    },router.RouterMode.Single);
 | 
				
			||||||
                      if(index === 9) {
 | 
					                    console.log('res11',JSON.stringify(res))
 | 
				
			||||||
                        this.inputTextArr[this.currentInputIndex] +=  (0).toString()
 | 
					                    globalThis.username=this.inputTextArr[0]
 | 
				
			||||||
                      }  if(index === 10) {
 | 
					 | 
				
			||||||
                        this.inputTextArr[this.currentInputIndex] +=  'X';
 | 
					 | 
				
			||||||
                      } else if(index === 11) {
 | 
					 | 
				
			||||||
                        this.inputTextArr[this.currentInputIndex] =  '';
 | 
					 | 
				
			||||||
                      } if(index === 12) {
 | 
					 | 
				
			||||||
                        this.inputTextArr[this.currentInputIndex] = this.inputTextArr[this.currentInputIndex].slice(0, -1)
 | 
					 | 
				
			||||||
                      }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    console.log(this.inputTextArr[this.currentInputIndex])
 | 
					 | 
				
			||||||
                  })
 | 
					                  })
 | 
				
			||||||
                }
 | 
					                })
 | 
				
			||||||
              })
 | 
					              }else {
 | 
				
			||||||
            }
 | 
					                Image(item).width('18%').height('24%').onClick(() => {
 | 
				
			||||||
            .height('100%')
 | 
					                  // this.vocObj.playAudio({
 | 
				
			||||||
 | 
					                  //   type: 1,
 | 
				
			||||||
 | 
					                  //   name: 'media_button.wav'
 | 
				
			||||||
 | 
					                  // })
 | 
				
			||||||
 | 
					                  this.url=''
 | 
				
			||||||
 | 
					                  if(index < 9) {
 | 
				
			||||||
 | 
					                    this.inputTextArr[this.currentInputIndex] +=  (index + 1).toString()
 | 
				
			||||||
 | 
					                  }else {
 | 
				
			||||||
 | 
					                    if(index === 9) {
 | 
				
			||||||
 | 
					                      this.inputTextArr[this.currentInputIndex] +=  (0).toString()
 | 
				
			||||||
 | 
					                    }  if(index === 10) {
 | 
				
			||||||
 | 
					                      this.inputTextArr[this.currentInputIndex] +=  'X';
 | 
				
			||||||
 | 
					                    } else if(index === 11) {
 | 
				
			||||||
 | 
					                      this.inputTextArr[this.currentInputIndex] =  '';
 | 
				
			||||||
 | 
					                    } if(index === 12) {
 | 
				
			||||||
 | 
					                      this.inputTextArr[this.currentInputIndex] = this.inputTextArr[this.currentInputIndex].slice(0, -1)
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                  }
 | 
				
			||||||
 | 
					                  console.log(this.inputTextArr[this.currentInputIndex])
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            })
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          .margin({top: 20*this.ratio})
 | 
					          .height('100%')
 | 
				
			||||||
          .width('90%')
 | 
					 | 
				
			||||||
          .height('62.7%')
 | 
					 | 
				
			||||||
          .backgroundColor('#E5E3DF')
 | 
					 | 
				
			||||||
          .borderRadius(20*this.ratio)
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        .margin({top: -10*this.ratio})
 | 
					        .margin({top: 20*this.ratio})
 | 
				
			||||||
        .justifyContent(FlexAlign.SpaceAround)
 | 
					        .width('90%')
 | 
				
			||||||
 | 
					        .height('62.7%')
 | 
				
			||||||
 | 
					        .backgroundColor('#E5E3DF')
 | 
				
			||||||
 | 
					        .borderRadius(20*this.ratio)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      .width('100%')
 | 
					      .margin({top: -10*this.ratio})
 | 
				
			||||||
      .height('100%')
 | 
					      .justifyContent(FlexAlign.SpaceAround)
 | 
				
			||||||
      .justifyContent(FlexAlign.SpaceBetween)
 | 
					    }
 | 
				
			||||||
      .backgroundImagePosition({x: 0, y: 0})
 | 
					    .width('100%')
 | 
				
			||||||
      .backgroundImage($r('app.media.index_bg'))
 | 
					    .height('100%')
 | 
				
			||||||
      .backgroundImageSize({ width: '100%', height: '100%' })
 | 
					    .justifyContent(FlexAlign.SpaceBetween)
 | 
				
			||||||
 | 
					    .backgroundImagePosition({x: 0, y: 0})
 | 
				
			||||||
 | 
					    .backgroundImage($r('app.media.index_bg'))
 | 
				
			||||||
 | 
					    .backgroundImageSize({ width: '100%', height: '100%' })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  aboutToAppear() {
 | 
					  aboutToAppear() {
 | 
				
			||||||
    this.url=''
 | 
					    this.url=''
 | 
				
			||||||
    // this.vocObj = new voiceService(async (status,val) => {
 | 
					 | 
				
			||||||
    //   if (status == 'idle') {
 | 
					 | 
				
			||||||
    //     if(this.url=='pages/userInfo'){
 | 
					 | 
				
			||||||
    //       router.pushUrl({
 | 
					 | 
				
			||||||
    //         url: this.url,
 | 
					 | 
				
			||||||
    //       });
 | 
					 | 
				
			||||||
    //     }
 | 
					 | 
				
			||||||
    //   }
 | 
					 | 
				
			||||||
    // });
 | 
					 | 
				
			||||||
    console.info('ExmainerLogin aboutToAppear');
 | 
					    console.info('ExmainerLogin aboutToAppear');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  onPageShow() {
 | 
					  onPageShow() {
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,7 @@ import { getUDP, getUDP2 } from '../common/utils/GlobleUdp'
 | 
				
			|||||||
import {initJudgeUdp} from '../common/utils/UdpJudge'
 | 
					import {initJudgeUdp} from '../common/utils/UdpJudge'
 | 
				
			||||||
import { getTCP } from '../common/utils/GlobleTcp'
 | 
					import { getTCP } from '../common/utils/GlobleTcp'
 | 
				
			||||||
import TcpClient from '../common/utils/TcpClient';
 | 
					import TcpClient from '../common/utils/TcpClient';
 | 
				
			||||||
 | 
					import testNapi from '@ohos.hiserialsdk'
 | 
				
			||||||
import {setliushuiNum,getSingleCenterTable,getDoubleCeneterTable} from '../common/service/indexService'
 | 
					import {setliushuiNum,getSingleCenterTable,getDoubleCeneterTable} from '../common/service/indexService'
 | 
				
			||||||
@Entry
 | 
					@Entry
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
@ -175,7 +175,7 @@ struct Index {
 | 
				
			|||||||
    this.loading = false
 | 
					    this.loading = false
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async heartMsg(context) {
 | 
					  async heartMsg() {
 | 
				
			||||||
    const arr = [globalThis.signNum||0, globalThis.statue||1]
 | 
					    const arr = [globalThis.signNum||0, globalThis.statue||1]
 | 
				
			||||||
    let tmpList = [];
 | 
					    let tmpList = [];
 | 
				
			||||||
    tmpList.push(string2Bytes(arr[0], 1 * 8)[0])
 | 
					    tmpList.push(string2Bytes(arr[0], 1 * 8)[0])
 | 
				
			||||||
@ -184,11 +184,9 @@ 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)
 | 
				
			||||||
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onPageShow() {
 | 
					  onPageShow() {
 | 
				
			||||||
@ -197,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) {
 | 
				
			||||||
@ -226,6 +223,7 @@ struct Index {
 | 
				
			|||||||
    // await this.getModel()
 | 
					    // await this.getModel()
 | 
				
			||||||
    // const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00]
 | 
					    // const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00]
 | 
				
			||||||
    // globalThis.udpClientByTopLine.sendMsg(Array2Byte(arr).buffer)
 | 
					    // globalThis.udpClientByTopLine.sendMsg(Array2Byte(arr).buffer)
 | 
				
			||||||
 | 
					    console.info(testNapi)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  async getModel() {
 | 
					  async getModel() {
 | 
				
			||||||
    const context = this.context;
 | 
					    const context = this.context;
 | 
				
			||||||
 | 
				
			|||||||
@ -18,13 +18,13 @@ struct Index {
 | 
				
			|||||||
      Column() {
 | 
					      Column() {
 | 
				
			||||||
        Row() {
 | 
					        Row() {
 | 
				
			||||||
          Image($r('app.media.setting_clzc')).width('30.5%').height('74%').onClick(()=>{
 | 
					          Image($r('app.media.setting_clzc')).width('30.5%').height('74%').onClick(()=>{
 | 
				
			||||||
            this.url='pages/register'
 | 
					            this.url='pages/Register'
 | 
				
			||||||
            router.pushUrl({
 | 
					            router.pushUrl({
 | 
				
			||||||
              url: this.url,
 | 
					              url: this.url,
 | 
				
			||||||
            },router.RouterMode.Single);
 | 
					            },router.RouterMode.Single);
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
          Image($r('app.media.setting_spjk')).width('30.5%').height('74%').onClick(()=>{
 | 
					          Image($r('app.media.setting_spjk')).width('30.5%').height('74%').onClick(()=>{
 | 
				
			||||||
            this.url='pages/videoConfig'
 | 
					            this.url='pages/VideoConfig'
 | 
				
			||||||
            router.pushUrl({
 | 
					            router.pushUrl({
 | 
				
			||||||
              url: this.url,
 | 
					              url: this.url,
 | 
				
			||||||
            },router.RouterMode.Single);
 | 
					            },router.RouterMode.Single);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										191
									
								
								entry/src/main/ets/pages/TeminalInfos.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										191
									
								
								entry/src/main/ets/pages/TeminalInfos.ets
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,191 @@
 | 
				
			|||||||
 | 
					import router from '@ohos.router'
 | 
				
			||||||
 | 
					import TopLogo from './compontents/topLogo'
 | 
				
			||||||
 | 
					import ethernet from '@ohos.net.ethernet';
 | 
				
			||||||
 | 
					import prompt from '@ohos.prompt'
 | 
				
			||||||
 | 
					import { upDateTableByArray} from '../common/service/initable'
 | 
				
			||||||
 | 
					import { getSyncData} from '../common/service/initable'
 | 
				
			||||||
 | 
					import { voiceService } from '../common/service/voiceService'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Entry
 | 
				
			||||||
 | 
					@Component
 | 
				
			||||||
 | 
					struct Index {
 | 
				
			||||||
 | 
					  @State textList1: string[] = ['ftp服务器IP:','响应端口','前置机IP','响应端口', '子网掩码','默认网关','用户名:', '密码:','dns','差分服务器IP: ', '响应端口:',]
 | 
				
			||||||
 | 
					  @State textList2: string[] = ['后置机IP:','响应端口:', '本地端口:']
 | 
				
			||||||
 | 
					  @State ratio: number = 850 / 960
 | 
				
			||||||
 | 
					  @State inputFontSize:number=12  //12
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  @State inputTextList1: string[] = ['192.168.36.2','8083','192.168.36.92','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.203','8000',]
 | 
				
			||||||
 | 
					  @State inputTextList2: string[] = ['192.168.36.91','20022']
 | 
				
			||||||
 | 
					  // 112.80.35.83 11052
 | 
				
			||||||
 | 
					  // @State inputTextList1: string[] = ['192.168.7.254','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11052']
 | 
				
			||||||
 | 
					  // @State inputTextList2: string[] = ['192.168.7.124','20022']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @State @Watch('outClick') outFlag: boolean = false;
 | 
				
			||||||
 | 
					  private vocObj = null;
 | 
				
			||||||
 | 
					  scroller: Scroller = new Scroller()
 | 
				
			||||||
 | 
					  build() {
 | 
				
			||||||
 | 
					    Column() {
 | 
				
			||||||
 | 
					      TopLogo({outFlag:$outFlag})
 | 
				
			||||||
 | 
					      Column() {
 | 
				
			||||||
 | 
					        Column() {
 | 
				
			||||||
 | 
					          Scroll(this.scroller){
 | 
				
			||||||
 | 
					            Flex({'wrap':FlexWrap.Wrap}) {
 | 
				
			||||||
 | 
					              ForEach(this.textList1, (item:string, index:number) => {
 | 
				
			||||||
 | 
					                Row() {
 | 
				
			||||||
 | 
					                  Text(item)
 | 
				
			||||||
 | 
					                    .width('40%')
 | 
				
			||||||
 | 
					                    .height('100%')
 | 
				
			||||||
 | 
					                    .fontColor('#E5CBA1')
 | 
				
			||||||
 | 
					                    .padding({'left': '35px'})
 | 
				
			||||||
 | 
					                    .fontSize(this.inputFontSize*this.ratio)
 | 
				
			||||||
 | 
					                  TextInput({'text':this.inputTextList1[index]?this.inputTextList1[index]: ''})
 | 
				
			||||||
 | 
					                    .width('50%')
 | 
				
			||||||
 | 
					                    .height('60%')
 | 
				
			||||||
 | 
					                    .fontColor('#fff')
 | 
				
			||||||
 | 
					                    .borderColor('#E6E0D8')
 | 
				
			||||||
 | 
					                    .borderRadius('10px')
 | 
				
			||||||
 | 
					                    .borderWidth('2px')
 | 
				
			||||||
 | 
					                    .fontSize(this.inputFontSize*this.ratio)
 | 
				
			||||||
 | 
					                    .padding({top:0,bottom:0})
 | 
				
			||||||
 | 
					                    .linearGradient({
 | 
				
			||||||
 | 
					                      angle: 0,
 | 
				
			||||||
 | 
					                      colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
 | 
				
			||||||
 | 
					                    }).onChange((value: string) => {
 | 
				
			||||||
 | 
					                    this.inputTextList1[index]=value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                  })
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                .width('50%')
 | 
				
			||||||
 | 
					                .height('16.7%')
 | 
				
			||||||
 | 
					              })
 | 
				
			||||||
 | 
					              ForEach(this.textList2, (item:string, index:number) => {
 | 
				
			||||||
 | 
					                Row() {
 | 
				
			||||||
 | 
					                  Text(item)
 | 
				
			||||||
 | 
					                    .width('40%')
 | 
				
			||||||
 | 
					                    .height('100%')
 | 
				
			||||||
 | 
					                    .fontColor('#E5CBA1')
 | 
				
			||||||
 | 
					                    .fontSize(this.inputFontSize*this.ratio)
 | 
				
			||||||
 | 
					                    .padding({'left': '35px'})
 | 
				
			||||||
 | 
					                  TextInput({'text':this.inputTextList2[index]?this.inputTextList2[index]: ''})
 | 
				
			||||||
 | 
					                    .width('60%')
 | 
				
			||||||
 | 
					                    .height('60%')
 | 
				
			||||||
 | 
					                    .fontColor('#fff')
 | 
				
			||||||
 | 
					                    .borderColor('#E6E0D8')
 | 
				
			||||||
 | 
					                    .borderRadius('10px')
 | 
				
			||||||
 | 
					                    .borderWidth('2px')
 | 
				
			||||||
 | 
					                    .padding({top:0,bottom:0})
 | 
				
			||||||
 | 
					                    .fontSize(this.inputFontSize*this.ratio)
 | 
				
			||||||
 | 
					                    .linearGradient({
 | 
				
			||||||
 | 
					                      angle: 0,
 | 
				
			||||||
 | 
					                      colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                    .onChange((value: string) => {
 | 
				
			||||||
 | 
					                      this.inputTextList2[index]=value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                .width('32.5%')
 | 
				
			||||||
 | 
					                .height('16.7%')
 | 
				
			||||||
 | 
					              })
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          .width('95%')
 | 
				
			||||||
 | 
					          .height('90%')
 | 
				
			||||||
 | 
					          .margin({'top': '2%'})
 | 
				
			||||||
 | 
					          .backgroundColor('#282828')
 | 
				
			||||||
 | 
					          .borderRadius('15px')
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        .width('100%')
 | 
				
			||||||
 | 
					        .height('80%')
 | 
				
			||||||
 | 
					        .borderRadius('25px')
 | 
				
			||||||
 | 
					        Column() {
 | 
				
			||||||
 | 
					          Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{
 | 
				
			||||||
 | 
					            upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[2],udplocalIpPort:this.inputTextList1[3],udpOppositeIp:this.inputTextList2[0],udpOppositeIpPort:this.inputTextList2[1],tcplocalIp:this.inputTextList1[0],tcplocalIpPort:this.inputTextList1[1],tcpOppositeIp:this.inputTextList1[9],tcpOppositePort:this.inputTextList1[10],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[8]}])
 | 
				
			||||||
 | 
					            ethernet.setIfaceConfig("eth0", {
 | 
				
			||||||
 | 
					              mode: 0,
 | 
				
			||||||
 | 
					              ipAddr:this.inputTextList1[2],
 | 
				
			||||||
 | 
					              route: "0.0.0.0",
 | 
				
			||||||
 | 
					              gateway: this.inputTextList1[5],//value.gateway网关
 | 
				
			||||||
 | 
					              netMask: this.inputTextList1[4],//value.netMask网络掩码
 | 
				
			||||||
 | 
					              dnsServers: this.inputTextList1[8],
 | 
				
			||||||
 | 
					              // domain: ""
 | 
				
			||||||
 | 
					            }, (error) => {
 | 
				
			||||||
 | 
					              if (error) {
 | 
				
			||||||
 | 
					                prompt.showToast({
 | 
				
			||||||
 | 
					                  message: '设置失败'+JSON.stringify(error),
 | 
				
			||||||
 | 
					                  duration: 3000
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                prompt.showToast({
 | 
				
			||||||
 | 
					                  message: '设置成功',
 | 
				
			||||||
 | 
					                  duration: 3000
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        .backgroundColor('#CCC4B8')
 | 
				
			||||||
 | 
					        .width('100%')
 | 
				
			||||||
 | 
					        .height('20%')
 | 
				
			||||||
 | 
					        .borderRadius({'bottomLeft':'25px','bottomRight':'25px'})
 | 
				
			||||||
 | 
					        .justifyContent(FlexAlign.SpaceAround)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      .width('75%')
 | 
				
			||||||
 | 
					      .height('69.4%')
 | 
				
			||||||
 | 
					      .backgroundColor('#E6E3DF')
 | 
				
			||||||
 | 
					      .borderRadius('25px')
 | 
				
			||||||
 | 
					      .margin({'top':'7%'})
 | 
				
			||||||
 | 
					      .justifyContent(FlexAlign.SpaceAround)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    .width('100%')
 | 
				
			||||||
 | 
					    .height('100%')
 | 
				
			||||||
 | 
					    .backgroundImagePosition({x: 0, y: 0})
 | 
				
			||||||
 | 
					    .backgroundImage($r('app.media.index_bg'))
 | 
				
			||||||
 | 
					    .backgroundImageSize({ width: '100%', height: '100%' })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  aboutToAppear() {
 | 
				
			||||||
 | 
					    getSyncData('IpConfigTable').then((result:Array<any>)=>{
 | 
				
			||||||
 | 
					      console.log('result222',JSON.stringify(result))
 | 
				
			||||||
 | 
					      if(result.length){
 | 
				
			||||||
 | 
					        console.log('tagtag',JSON.stringify(result))
 | 
				
			||||||
 | 
					        this.inputTextList1[2]=result[0].udplocalIp
 | 
				
			||||||
 | 
					        this.inputTextList1[3]=result[0].udplocalIpPort
 | 
				
			||||||
 | 
					        this.inputTextList2[0]=result[0].udpOppositeIp
 | 
				
			||||||
 | 
					        this.inputTextList2[1]=result[0].udpOppositeIpPort
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.inputTextList1[0]=result[0].tcplocalIp
 | 
				
			||||||
 | 
					        this.inputTextList1[1]=result[0].tcplocalIpPort
 | 
				
			||||||
 | 
					        this.inputTextList1[9]=result[0].tcpOppositeIp
 | 
				
			||||||
 | 
					        this.inputTextList1[10]=result[0].tcpOppositePort
 | 
				
			||||||
 | 
					        this.inputTextList1[5]=result[0].gateway
 | 
				
			||||||
 | 
					        this.inputTextList1[4]=result[0].netMask
 | 
				
			||||||
 | 
					        this.inputTextList1[8]=result[0].dnsServers
 | 
				
			||||||
 | 
					        this.inputTextList1[11]=result[0].centerIp
 | 
				
			||||||
 | 
					        this.inputTextList1[12]=result[0].heartPort
 | 
				
			||||||
 | 
					        this.inputTextList1[13]=result[0].gpsPort
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    ethernet.getIfaceConfig("eth0", (error, value) => {
 | 
				
			||||||
 | 
					      if (error) {
 | 
				
			||||||
 | 
					        // that.errorMsg='error'
 | 
				
			||||||
 | 
					        console.log("boot_up getIp_new  callback error = " + JSON.stringify(error));
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        console.log("boot_up getIp_new callback ipAddr = " + JSON.stringify(value.ipAddr)); //
 | 
				
			||||||
 | 
					        console.log(" boot_up getIp_new callback mode = " + JSON.stringify(value.mode));
 | 
				
			||||||
 | 
					        console.log("boot_up getIp_new callback route = " + JSON.stringify(value.route));
 | 
				
			||||||
 | 
					        console.log("boot_up getIp_new callback gateway = " + JSON.stringify(value.gateway));
 | 
				
			||||||
 | 
					        console.log("boot_up getIp_new callback netMask = " + JSON.stringify(value.netMask));
 | 
				
			||||||
 | 
					        console.log("boot_up getIp_new callback dnsServers = " + JSON.stringify(value.dnsServers));
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  onPageShow() {
 | 
				
			||||||
 | 
					    console.info('Index onPageShow');
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  outClick(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -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,43 +70,30 @@ 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;
 | 
				
			||||||
  @State signNum: number = 0;
 | 
					  @State signNum: number = 0;
 | 
				
			||||||
  @State isCanClick: boolean = true;
 | 
					  @State isCanClick: boolean = true;
 | 
				
			||||||
 | 
					  @State FaceOpenStatue: string = '0';//是否开启人脸识别
 | 
				
			||||||
  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()
 | 
				
			||||||
    // 如果是单机模式则模拟假数据
 | 
					    // 如果是单机模式则模拟假数据
 | 
				
			||||||
    if (globalThis.singlePlay) {
 | 
					
 | 
				
			||||||
      // TODO 模拟假数据
 | 
					 | 
				
			||||||
      this.list = CandidateData
 | 
					 | 
				
			||||||
      this.pageIndex = 0
 | 
					 | 
				
			||||||
      this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
 | 
					 | 
				
			||||||
      this.currentUser = this.dataList[0]
 | 
					 | 
				
			||||||
      this.lsh = this.currentUser.lsh
 | 
					 | 
				
			||||||
      globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm
 | 
					 | 
				
			||||||
      globalThis.lsh = this.lsh
 | 
					 | 
				
			||||||
      return
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      //      this.getExaminationStudentInfoFn()
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    this.initSysset()
 | 
					    this.initSysset()
 | 
				
			||||||
    initJudgeUdp()
 | 
					    initJudgeUdp()
 | 
				
			||||||
    this.interval=setInterval(()=>{
 | 
					    this.heartMsg()
 | 
				
			||||||
      this.heartMsg()
 | 
					
 | 
				
			||||||
    },1000)
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  //身份证读卡器初始化
 | 
					  //身份证读卡器初始化
 | 
				
			||||||
  openDeviceByIDCard(){
 | 
					  openDeviceByIDCard(){
 | 
				
			||||||
@ -118,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
 | 
				
			||||||
@ -133,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',
 | 
				
			||||||
@ -219,18 +210,23 @@ struct UserInfo {
 | 
				
			|||||||
    this.currentUser = EmptyCandidateObject
 | 
					    this.currentUser = EmptyCandidateObject
 | 
				
			||||||
    globalThis.statue = 2
 | 
					    globalThis.statue = 2
 | 
				
			||||||
    this.numCount = 0
 | 
					    this.numCount = 0
 | 
				
			||||||
 | 
					    if (globalThis.singlePlay) {
 | 
				
			||||||
 | 
					      // TODO 模拟假数据
 | 
				
			||||||
 | 
					      this.list = CandidateData
 | 
				
			||||||
 | 
					      this.pageIndex = 0
 | 
				
			||||||
 | 
					      this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
 | 
				
			||||||
 | 
					      this.currentUser = this.dataList[0]
 | 
				
			||||||
 | 
					      this.lsh = this.currentUser.lsh
 | 
				
			||||||
 | 
					      globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm
 | 
				
			||||||
 | 
					      globalThis.lsh = this.lsh
 | 
				
			||||||
 | 
					      return
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      //      this.getExaminationStudentInfoFn()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  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'){
 | 
				
			||||||
@ -241,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 = [];
 | 
				
			||||||
@ -275,18 +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 === '2313')
 | 
				
			||||||
 | 
					        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)
 | 
				
			||||||
        //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()
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -298,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()
 | 
				
			||||||
@ -329,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) {
 | 
				
			||||||
@ -433,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 || ''
 | 
				
			||||||
@ -450,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) {
 | 
				
			||||||
@ -461,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 {
 | 
				
			||||||
@ -473,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()
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -487,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
 | 
				
			||||||
@ -641,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 {
 | 
				
			||||||
@ -650,14 +658,18 @@ struct UserInfo {
 | 
				
			|||||||
                        router.pushUrl({
 | 
					                        router.pushUrl({
 | 
				
			||||||
                          url: 'pages/Judge',
 | 
					                          url: 'pages/Judge',
 | 
				
			||||||
                        }, router.RouterMode.Single);
 | 
					                        }, router.RouterMode.Single);
 | 
				
			||||||
                        testNapi.StopReadCard();
 | 
					                        this.stopDeviceById()
 | 
				
			||||||
                      })
 | 
					                      })
 | 
				
			||||||
                    })
 | 
					                    })
 | 
				
			||||||
                  }
 | 
					                  }
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
                return
 | 
					                return
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
              this.showFaceCompare = true
 | 
					              if(this.FaceOpenStatue!='0'){
 | 
				
			||||||
 | 
					                this.showFaceCompare = true
 | 
				
			||||||
 | 
					              }else{
 | 
				
			||||||
 | 
					                this.sfbdinterfaceFn()
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -669,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) {
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,32 +1,19 @@
 | 
				
			|||||||
//@ts-ignore
 | 
					//@ts-ignore
 | 
				
			||||||
import camera from '@ohos.multimedia.camera';
 | 
					
 | 
				
			||||||
import image from '@ohos.multimedia.image'
 | 
					 | 
				
			||||||
import util from '@ohos.util';
 | 
					import util from '@ohos.util';
 | 
				
			||||||
import { writeFile } from '../../common/service/fileService'
 | 
					
 | 
				
			||||||
import TopLogo from '../compontents/topLogo'
 | 
					 | 
				
			||||||
import { cameraService } from '../../common/service/cameraService'
 | 
					 | 
				
			||||||
import { voiceService } from '../../common/service/voiceService'
 | 
					import { voiceService } from '../../common/service/voiceService'
 | 
				
			||||||
import { faceCompare } from '../../api/userInfo'
 | 
					import { faceCompare } from '../../api/userInfo'
 | 
				
			||||||
import prompt from '@ohos.prompt'
 | 
					 | 
				
			||||||
import grantPermission from '../../common/utils/PermissionUtils';
 | 
					 | 
				
			||||||
import CameraModel from '../../common/service/CameraModel';
 | 
					 | 
				
			||||||
import FileUtil from '../../common/utils/File'
 | 
					import FileUtil from '../../common/utils/File'
 | 
				
			||||||
import { VideoConfig } from '../interfaces'
 | 
					import { VideoConfig } from '../interfaces'
 | 
				
			||||||
import common from '@ohos.app.ability.common';
 | 
					import common from '@ohos.app.ability.common';
 | 
				
			||||||
import fs from '@ohos.file.fs'
 | 
					 | 
				
			||||||
import onvifclient from '@ohos.onvifclient';
 | 
					 | 
				
			||||||
import buffer from '@ohos.buffer';
 | 
					 | 
				
			||||||
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// import MediaModel from '../../common/utils/MediaModel';
 | 
					import { string2Bytes } from '../../common/utils/tools'
 | 
				
			||||||
let previewWidth;
 | 
					import { takePhoto } from '../../common/service/videoService'
 | 
				
			||||||
let previewHeight;
 | 
					import configAddress from '../../common/utils/FileConfig'
 | 
				
			||||||
 | 
					 | 
				
			||||||
const PERMISSIONS: Array<string> = [
 | 
					 | 
				
			||||||
  'ohos.permission.CAMERA']
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
export default struct FaceCompare {
 | 
					struct FaceCompare {
 | 
				
			||||||
  constructor() {
 | 
					  constructor() {
 | 
				
			||||||
    super()
 | 
					    super()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -35,21 +22,16 @@ export default struct FaceCompare {
 | 
				
			|||||||
  @Prop sfzh: string;
 | 
					  @Prop sfzh: string;
 | 
				
			||||||
  @Prop lsh: string;
 | 
					  @Prop lsh: string;
 | 
				
			||||||
  @Prop firstImage: string;
 | 
					  @Prop firstImage: string;
 | 
				
			||||||
  @Link showFaceCompare: boolean;
 | 
					 | 
				
			||||||
  @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 timer = null; //人脸比对执行任务定时器
 | 
					 | 
				
			||||||
  private stopClose = false; // 阻止用户关闭此组件
 | 
					 | 
				
			||||||
  private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发
 | 
					  private times = 1; //人脸比对失败次数, 超过3次将不会自动比对,需要点击重新打开重新触发
 | 
				
			||||||
  private vocObj = null;
 | 
					  private vocObj = null;
 | 
				
			||||||
  @State callBackFlag:boolean=false;
 | 
					  @State callBackFlag: boolean = false;
 | 
				
			||||||
  @State @Watch('changeFaceCompareSuccess') showFaceCompare2: Boolean = false;
 | 
					  @State @Watch('clearIntervalFn') showFaceCompareFlag: Boolean = false;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private surfaceId: string = '';
 | 
					 | 
				
			||||||
  @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'
 | 
				
			||||||
  private fileAsset: mediaLibrary.FileAsset = undefined;
 | 
					 | 
				
			||||||
  @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
 | 
				
			||||||
  @State showControls: boolean = false
 | 
					  @State showControls: boolean = false
 | 
				
			||||||
@ -58,10 +40,9 @@ export default struct FaceCompare {
 | 
				
			|||||||
  @State signNum: number = 0;
 | 
					  @State signNum: number = 0;
 | 
				
			||||||
  private fileUtil: FileUtil
 | 
					  private fileUtil: FileUtil
 | 
				
			||||||
  private interval: any
 | 
					  private interval: any
 | 
				
			||||||
  private mediaTest: mediaLibrary.MediaLibrary = mediaLibrary.getMediaLibrary(globalThis.abilityContext)
 | 
					 | 
				
			||||||
  private fd: number = -1;
 | 
					 | 
				
			||||||
  @State param: VideoConfig = {
 | 
					  @State param: VideoConfig = {
 | 
				
			||||||
    spls: '',
 | 
					    spls: '',
 | 
				
			||||||
 | 
					    videoNum: '1',
 | 
				
			||||||
    faceFlag: false,
 | 
					    faceFlag: false,
 | 
				
			||||||
    pztd: '1',
 | 
					    pztd: '1',
 | 
				
			||||||
    ljlx: '',
 | 
					    ljlx: '',
 | 
				
			||||||
@ -93,7 +74,7 @@ export default struct FaceCompare {
 | 
				
			|||||||
        Row() {
 | 
					        Row() {
 | 
				
			||||||
          Row() {
 | 
					          Row() {
 | 
				
			||||||
            Video({
 | 
					            Video({
 | 
				
			||||||
              src: `rtsp://${this.param.userName}:${this.param.pwd}@${this.param.ip}:${this.param.port}/h264/ch${this.param.rlls}/main/av_stream`,
 | 
					              src: this.showFaceCompare ? `rtsp://${this.param.userName}:${this.param.pwd}@${this.param.ip}:${this.param.port}/h264/ch${this.param.rlls}/main/av_stream` : '',
 | 
				
			||||||
              previewUri: this.previewUri,
 | 
					              previewUri: this.previewUri,
 | 
				
			||||||
              currentProgressRate: PlaybackSpeed.Speed_Forward_1_00_X,
 | 
					              currentProgressRate: PlaybackSpeed.Speed_Forward_1_00_X,
 | 
				
			||||||
              controller: this.controller,
 | 
					              controller: this.controller,
 | 
				
			||||||
@ -107,6 +88,7 @@ export default struct FaceCompare {
 | 
				
			|||||||
          .width('48%')
 | 
					          .width('48%')
 | 
				
			||||||
          .height('100%')
 | 
					          .height('100%')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          Row() {
 | 
					          Row() {
 | 
				
			||||||
            Image(this.firstImage)
 | 
					            Image(this.firstImage)
 | 
				
			||||||
              .width('100%')
 | 
					              .width('100%')
 | 
				
			||||||
@ -146,9 +128,7 @@ export default struct FaceCompare {
 | 
				
			|||||||
            .backgroundImageSize({ width: '100%', height: '100%' })
 | 
					            .backgroundImageSize({ width: '100%', height: '100%' })
 | 
				
			||||||
            .onClick(async () => {
 | 
					            .onClick(async () => {
 | 
				
			||||||
              this.times = 1;
 | 
					              this.times = 1;
 | 
				
			||||||
              // this.takePhoto('face_check.mp3');
 | 
					
 | 
				
			||||||
              // this.readyToTakePhoto(this.surfaceId);
 | 
					 | 
				
			||||||
              // await this.cameraObj.releaseSource()
 | 
					 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          .width('88.9%')
 | 
					          .width('88.9%')
 | 
				
			||||||
@ -174,29 +154,11 @@ export default struct FaceCompare {
 | 
				
			|||||||
      .backgroundImage($r('app.media.close'))
 | 
					      .backgroundImage($r('app.media.close'))
 | 
				
			||||||
      .backgroundImageSize({ width: '100%', height: '100%' })
 | 
					      .backgroundImageSize({ width: '100%', height: '100%' })
 | 
				
			||||||
      .onClick(() => {
 | 
					      .onClick(() => {
 | 
				
			||||||
        // prompt.showToast({
 | 
					 | 
				
			||||||
        //   message: '人脸比对程序正在执行,请等待程序执行完毕。',
 | 
					 | 
				
			||||||
        //   duration: 3000
 | 
					 | 
				
			||||||
        // });
 | 
					 | 
				
			||||||
        this.controller.stop()
 | 
					        this.controller.stop()
 | 
				
			||||||
        this.vocObj&&this.vocObj.releasePlayer()
 | 
					        this.vocObj && this.vocObj.releasePlayer()
 | 
				
			||||||
        this.showFaceCompare = false
 | 
					        this.showFaceCompare = !this.showFaceCompare
 | 
				
			||||||
        this.showFaceCompare2 = false
 | 
					        this.showFaceCompareFlag=!this.showFaceCompareFlag
 | 
				
			||||||
        this.faceCompareSucess = -1
 | 
					        this.faceCompareSucess = -1
 | 
				
			||||||
        return
 | 
					 | 
				
			||||||
        console.log('jiangsong close the faceCompare componet');
 | 
					 | 
				
			||||||
        if (!this.stopClose) {
 | 
					 | 
				
			||||||
          this.showFaceCompare = false
 | 
					 | 
				
			||||||
          this.showFaceCompare2 = false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          prompt.showToast({
 | 
					 | 
				
			||||||
            message: '人脸比对程序正在执行,请等待程序执行完毕。',
 | 
					 | 
				
			||||||
            duration: 3000
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
          this.showFaceCompare = false
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    .width('100%')
 | 
					    .width('100%')
 | 
				
			||||||
@ -206,351 +168,175 @@ export default struct FaceCompare {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onPageShow() {
 | 
					  onPageShow() {
 | 
				
			||||||
    // this.cameraModel.initCamera(this.surfaceId);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  changeFaceCompareSuccess(){
 | 
					 | 
				
			||||||
    this.callBackFlag=false
 | 
					 | 
				
			||||||
    clearInterval(this.interval)
 | 
					 | 
				
			||||||
    this.vocObj&&this.vocObj.releasePlayer()
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async aboutToAppear() {
 | 
					  async aboutToAppear() {
 | 
				
			||||||
    this.callBackFlag=false
 | 
					 | 
				
			||||||
    clearInterval(this.interval)
 | 
					 | 
				
			||||||
    // this.mediaModel = MediaModel.getMediaInstance();
 | 
					 | 
				
			||||||
    const fileUtil = new FileUtil(this.context)
 | 
					    const fileUtil = new FileUtil(this.context)
 | 
				
			||||||
    this.fileUtil = fileUtil
 | 
					    this.fileUtil = fileUtil
 | 
				
			||||||
    this.getVideoConfig()
 | 
					    this.getVideoConfig()
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // this.cameraModel.setTakePictureHandleCallback(this.takePictureHandle.bind(this));
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  getqkFn(){
 | 
					 | 
				
			||||||
    let tmpList = [];
 | 
					 | 
				
			||||||
    // const str =globalThis.signNum
 | 
					 | 
				
			||||||
    // for (let i = 0;i < str.length; i++) {
 | 
					 | 
				
			||||||
    //   tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
 | 
					 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
    // const arr = [globalThis.signNum||0, globalThis.statue||1]
 | 
					 | 
				
			||||||
    // let tmpList = [];
 | 
					 | 
				
			||||||
    tmpList.push(this.string2Bytes(globalThis.signNum, 1 * 8)[0])
 | 
					 | 
				
			||||||
    const param= {id: 41,list:tmpList,carNo: globalThis.carInfo.carNo,placeId: globalThis.carInfo.examinationRoomId}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  clearIntervalFn() {
 | 
				
			||||||
 | 
					    this.callBackFlag = false
 | 
				
			||||||
 | 
					    clearInterval(this.interval)
 | 
				
			||||||
 | 
					    this.vocObj && this.vocObj.releasePlayer()
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  getqkFn() {
 | 
				
			||||||
 | 
					    let tmpList = [];
 | 
				
			||||||
 | 
					    tmpList.push(string2Bytes(globalThis.signNum, 1 * 8)[0])
 | 
				
			||||||
 | 
					    const param = {
 | 
				
			||||||
 | 
					      id: 41,
 | 
				
			||||||
 | 
					      list: tmpList,
 | 
				
			||||||
 | 
					      carNo: globalThis.carInfo.carNo,
 | 
				
			||||||
 | 
					      placeId: globalThis.carInfo.examinationRoomId
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    globalThis.udpClient2.sendMsg(param, this.context)
 | 
					    globalThis.udpClient2.sendMsg(param, this.context)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async faceComparFn() {
 | 
					  async faceComparFn() {
 | 
				
			||||||
    var loginInfo1 = {
 | 
					    console.log('mmmmm0',1)
 | 
				
			||||||
      host: `http://${this.param.ip}:80`, user: "administrator", pass: this.param.pwd }
 | 
					 | 
				
			||||||
    // var file_dir = "/data/service/el1/public/netmanager/ethernet/";
 | 
					 | 
				
			||||||
    // var result3 = onvifclient.getVideoSnapshot(loginInfo1, video_uri, file_dir);
 | 
					 | 
				
			||||||
    // console.info(`baoyihu endRecordVideo  result:` + result3.result + `  pictureFile:` + result3.dataString);
 | 
					 | 
				
			||||||
    var mediaTest = mediaLibrary.getMediaLibrary(this.context);
 | 
					 | 
				
			||||||
    let mediaType = mediaLibrary.MediaType.IMAGE;
 | 
					 | 
				
			||||||
    let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_IMAGE;
 | 
					 | 
				
			||||||
    const path = await mediaTest.getPublicDirectory(DIR_DOCUMENTS);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const fileName = 'FaceCompar' + Math.floor(Math.random() * 1000) + '.jpg'
 | 
					    const result = await takePhoto(this.param, this.context, 1,'jt/')
 | 
				
			||||||
    mediaTest.createAsset(mediaType, fileName, path, (error, asset) => {
 | 
					    console.log('mmmmm8',9)
 | 
				
			||||||
      asset.open('rw', (error, fd) => {
 | 
					 | 
				
			||||||
        if (fd > 0) {
 | 
					 | 
				
			||||||
          var file_path = "/mnt/hmdfs/100/account/device_view/local/files/Pictures/" + fileName
 | 
					 | 
				
			||||||
          var result3 = onvifclient.getVideoSnapshot(`rtsp://${this.param.userName}:${this.param.pwd}@${this.param.ip}:${this.param.port}/h264/ch${this.param.rlls}/main/av_stream`, file_path, fd);
 | 
					 | 
				
			||||||
          fs.closeSync(fd);
 | 
					 | 
				
			||||||
          asset.close(fd);
 | 
					 | 
				
			||||||
          // let filePath = pathDir + "/test.txt";
 | 
					 | 
				
			||||||
          fs.lstat(file_path).then((stat) => {
 | 
					 | 
				
			||||||
            console.info("get link status succeed, the size of file is" + stat.size);
 | 
					 | 
				
			||||||
            let file = fs.openSync(file_path, fs.OpenMode.READ_WRITE);
 | 
					 | 
				
			||||||
            const size = Number(stat.size) + 100
 | 
					 | 
				
			||||||
            let buf = new ArrayBuffer(size);
 | 
					 | 
				
			||||||
            let num = fs.readSync(file.fd, buf);
 | 
					 | 
				
			||||||
            var that = new util.Base64();
 | 
					 | 
				
			||||||
            var array = new Uint8Array(buf);
 | 
					 | 
				
			||||||
            var result = that.encodeToStringSync(array); //base64圖片
 | 
					 | 
				
			||||||
            //
 | 
					 | 
				
			||||||
            mediaTest.deleteAsset(file_path).then(() => {
 | 
					 | 
				
			||||||
              console.log('delSuccess')
 | 
					 | 
				
			||||||
            }).catch(() => {
 | 
					 | 
				
			||||||
              console.log('delError')
 | 
					 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
            this.fileUtil.deleteF(file_path, 3)
 | 
					 | 
				
			||||||
            if(this.firstImage){
 | 
					 | 
				
			||||||
              this.faceCatchImg = result
 | 
					 | 
				
			||||||
            }else{
 | 
					 | 
				
			||||||
              this.faceCatchImg = ''
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					    faceCompare({
 | 
				
			||||||
 | 
					      sfzh: this.sfzh,
 | 
				
			||||||
 | 
					      firstImage: this.firstImage.substr(22),
 | 
				
			||||||
 | 
					      secondImage: result,
 | 
				
			||||||
 | 
					      type: 2,
 | 
				
			||||||
 | 
					      verifyType: 1
 | 
				
			||||||
 | 
					    }).then(res => {
 | 
				
			||||||
 | 
					      console.log('mmmmm8',res)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (res) {
 | 
				
			||||||
 | 
					        this.controller.stop()
 | 
				
			||||||
 | 
					        this.showFaceCompare = !this.showFaceCompare
 | 
				
			||||||
 | 
					        this.showFaceCompareFlag=!this.showFaceCompareFlag
 | 
				
			||||||
 | 
					        this.faceCompareSucess = 1;
 | 
				
			||||||
 | 
					        // this.faceCatchImg = result
 | 
				
			||||||
 | 
					        this.vocObj.playAudio({
 | 
				
			||||||
 | 
					          type: 1,
 | 
				
			||||||
 | 
					          name: 'yzcg.wav'
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        this.times++;
 | 
				
			||||||
 | 
					        //3s后开始语音提示
 | 
				
			||||||
 | 
					        this.vocObj.playAudio({
 | 
				
			||||||
 | 
					          type: 1,
 | 
				
			||||||
 | 
					          name: 'face_fail.mp3'
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            faceCompare({
 | 
					 | 
				
			||||||
              sfzh: this.sfzh,
 | 
					 | 
				
			||||||
              firstImage:this.firstImage.substr(22),
 | 
					 | 
				
			||||||
              // sfzh: '321281198605076819',
 | 
					 | 
				
			||||||
              // firstImage: this.firstImage,
 | 
					 | 
				
			||||||
              secondImage: result,
 | 
					 | 
				
			||||||
              type: 2,
 | 
					 | 
				
			||||||
              verifyType: 1
 | 
					 | 
				
			||||||
            }).then(res => {
 | 
					 | 
				
			||||||
              if (res) {
 | 
					 | 
				
			||||||
                this.controller.stop()
 | 
					 | 
				
			||||||
                console.log('jiangsong face compare success' + JSON.stringify(res))
 | 
					 | 
				
			||||||
                this.showFaceCompare = false
 | 
					 | 
				
			||||||
                this.showFaceCompare2 = false
 | 
					 | 
				
			||||||
                this.faceCompareSucess = 1;
 | 
					 | 
				
			||||||
                // this.faceCatchImg = result
 | 
					 | 
				
			||||||
                this.vocObj.playAudio({
 | 
					 | 
				
			||||||
                  type: 1,
 | 
					 | 
				
			||||||
                  name: 'yzcg.wav'
 | 
					 | 
				
			||||||
                })
 | 
					 | 
				
			||||||
              } else {
 | 
					 | 
				
			||||||
                console.log('jiangsong face compare faild')
 | 
					 | 
				
			||||||
                // this.showFaceCompare = false
 | 
					 | 
				
			||||||
                // this.faceCompareSucess = false;
 | 
					 | 
				
			||||||
                this.times++;
 | 
					 | 
				
			||||||
                //3s后开始语音提示
 | 
					 | 
				
			||||||
                this.vocObj.playAudio({
 | 
					 | 
				
			||||||
                  type: 1,
 | 
					 | 
				
			||||||
                  name: 'face_fail.mp3'
 | 
					 | 
				
			||||||
                })
 | 
					 | 
				
			||||||
                // this.timer = setTimeout(() => {
 | 
					 | 
				
			||||||
                //   this.takePhoto('face_fail.mp3');
 | 
					 | 
				
			||||||
                // }, 3000)
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
            // console.log(result)
 | 
					 | 
				
			||||||
            //result base64
 | 
					 | 
				
			||||||
            // this.fileUtil.deleteF(file_path,3)
 | 
					 | 
				
			||||||
          }).catch((err) => {
 | 
					 | 
				
			||||||
            console.info("get link status failed with error message: " + err.message + ", error code: " + err.code);
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          console.error('baoyihu getVideoSnapshot File Open failed with error: ' + error);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async heartMsg(context) {
 | 
					  async heartMsg(context) {
 | 
				
			||||||
    let tmpList=[]
 | 
					    let tmpList = []
 | 
				
			||||||
    const str =this.lsh
 | 
					    const str = this.lsh
 | 
				
			||||||
    for (let i = 0;i < str.length; i++) {
 | 
					    for (let i = 0;i < str.length; i++) {
 | 
				
			||||||
      tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
 | 
					      tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const param = { id: 46, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId,callback:()=>{
 | 
					    const param = {
 | 
				
			||||||
      console.log('46send')
 | 
					      id: 46,
 | 
				
			||||||
      this.callBackFlag=true
 | 
					      list: tmpList,
 | 
				
			||||||
    }}
 | 
					      carNo: globalThis.carInfo.carNo,
 | 
				
			||||||
    this.interval=setInterval(()=>{
 | 
					      placeId: globalThis.carInfo.examinationRoomId,
 | 
				
			||||||
      console.log('klklklk',this.callBackFlag)
 | 
					      sendCallback: () => {
 | 
				
			||||||
      if(this.callBackFlag){
 | 
					        this.callBackFlag = true
 | 
				
			||||||
        console.log('klklklk')
 | 
					 | 
				
			||||||
        const param2 = { id: 47, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId }
 | 
					 | 
				
			||||||
        globalThis.udpClient2&&globalThis.udpClient2.sendMsg(param2,this.context)
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },1000)
 | 
					 | 
				
			||||||
    // const param = { id: 31, list: tmpList, carNo: 489, placeId: 62 }
 | 
					 | 
				
			||||||
    globalThis.udpClient2&&globalThis.udpClient2.sendMsg(param, this.context)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // return {id: 31,list:tmpList,carNo:489,placeId:62}
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  async getVideoConfig() {
 | 
					 | 
				
			||||||
    const data = await this.fileUtil.readFile('/mnt/hmdfs/100/account/device_view/localfiles/files/config/config3.txt');
 | 
					 | 
				
			||||||
    console.log('data,data',data)
 | 
					 | 
				
			||||||
    if(!data){
 | 
					 | 
				
			||||||
      this.vocObj = new voiceService(async (status, val, next) => {
 | 
					 | 
				
			||||||
        if (status == 'idle') {
 | 
					 | 
				
			||||||
          if (val == 'face_check.mp3' || val == 'face_fail.mp3') {
 | 
					 | 
				
			||||||
            console.log('this.time',this.times)
 | 
					 | 
				
			||||||
            if (this.times >=3) {
 | 
					 | 
				
			||||||
              this.vocObj&&this.vocObj.playAudio({
 | 
					 | 
				
			||||||
                type: 1,
 | 
					 | 
				
			||||||
                name: 'face_checking.wav'
 | 
					 | 
				
			||||||
              })
 | 
					 | 
				
			||||||
              // this.showFaceCompare = false
 | 
					 | 
				
			||||||
              globalThis.statue=3
 | 
					 | 
				
			||||||
              this.faceCompareSucess = -1;
 | 
					 | 
				
			||||||
              this.heartMsg(this.context)
 | 
					 | 
				
			||||||
            }else{
 | 
					 | 
				
			||||||
              setTimeout(()=>{
 | 
					 | 
				
			||||||
                this.faceComparFn()
 | 
					 | 
				
			||||||
              },2000)
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          } else if (val == 'yzcg.wav') {
 | 
					 | 
				
			||||||
            // this.sfbdinterfaceFn()
 | 
					 | 
				
			||||||
            this.showFaceCompare = false
 | 
					 | 
				
			||||||
            this.showFaceCompare2 = false
 | 
					 | 
				
			||||||
            this.vocObj&&this.vocObj.releasePlayer()
 | 
					 | 
				
			||||||
            globalThis.statue=4
 | 
					 | 
				
			||||||
            this.faceCompareSucess = 1;
 | 
					 | 
				
			||||||
          }else if(val=='face_checking.wav'){
 | 
					 | 
				
			||||||
            // globalThis.statue=3
 | 
					 | 
				
			||||||
            this.faceCompareSucess = -1;
 | 
					 | 
				
			||||||
            this.callBackFlag=false
 | 
					 | 
				
			||||||
            this.vocObj&&this.vocObj.releasePlayer()
 | 
					 | 
				
			||||||
          }else if(val=='face_chekc_fail.wav'){
 | 
					 | 
				
			||||||
            this.vocObj&&this.vocObj.releasePlayer()
 | 
					 | 
				
			||||||
            this.faceCompareSucess=-1
 | 
					 | 
				
			||||||
            this.showFaceCompare = false
 | 
					 | 
				
			||||||
            this.showFaceCompare2 = false
 | 
					 | 
				
			||||||
            this.callBackFlag=false
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      return
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this.param = JSON.parse(data)
 | 
					    globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param, this.context)
 | 
				
			||||||
    // this.param.userName = JSON.parse(data).userName
 | 
					    this.interval = setInterval(() => {
 | 
				
			||||||
    // this.param.ip = JSON.parse(data).ip
 | 
					      if (this.callBackFlag) {
 | 
				
			||||||
    // this.param.pwd = JSON.parse(data).pwd
 | 
					        const param2 = {
 | 
				
			||||||
    // this.param.port = JSON.parse(data).port
 | 
					          id: 47,
 | 
				
			||||||
    // this.param.rlls = JSON.parse(data).rlls
 | 
					          list: tmpList,
 | 
				
			||||||
    console.log('this.parm', this.param.userName, this.param.pwd, this.param.ip, this.param.port, this.param.rlls)
 | 
					          carNo: globalThis.carInfo.carNo,
 | 
				
			||||||
    this.controller.start()
 | 
					          placeId: globalThis.carInfo.examinationRoomId,
 | 
				
			||||||
    // this.video_url = `rtsp://${this.param.userName}:${this.param.pwd}@${this.param.ip}:${this.param.port}/h264/ch${this.param.rlls}/main/av_stream`;
 | 
					 | 
				
			||||||
    this.vocObj = new voiceService(async (status, val, next) => {
 | 
					 | 
				
			||||||
      if (status == 'idle') {
 | 
					 | 
				
			||||||
        if (val == 'face_check.mp3' || val == 'face_fail.mp3') {
 | 
					 | 
				
			||||||
          if (this.times >= 3) {
 | 
					 | 
				
			||||||
            // this.showFaceCompare = false
 | 
					 | 
				
			||||||
            globalThis.statue=3
 | 
					 | 
				
			||||||
            this.faceCompareSucess = -1;
 | 
					 | 
				
			||||||
            this.vocObj&&this.vocObj.playAudio({
 | 
					 | 
				
			||||||
              type: 1,
 | 
					 | 
				
			||||||
              name: 'face_checking.wav'
 | 
					 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
            this.heartMsg(this.context)
 | 
					 | 
				
			||||||
          }else{
 | 
					 | 
				
			||||||
            setTimeout(()=>{
 | 
					 | 
				
			||||||
              this.faceComparFn()
 | 
					 | 
				
			||||||
            },2000)
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        } else if (val == 'yzcg.wav') {
 | 
					 | 
				
			||||||
          // this.sfbdinterfaceFn()
 | 
					 | 
				
			||||||
          this.showFaceCompare = false
 | 
					 | 
				
			||||||
          this.showFaceCompare2 = false
 | 
					 | 
				
			||||||
          globalThis.statue=4
 | 
					 | 
				
			||||||
          this.faceCompareSucess = 1;
 | 
					 | 
				
			||||||
          this.vocObj&&this.vocObj.releasePlayer()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        } else if(val=='face_chekc_fail.wav'){
 | 
					 | 
				
			||||||
          this.vocObj&&this.vocObj.releasePlayer()
 | 
					 | 
				
			||||||
          this.faceCompareSucess=-1
 | 
					 | 
				
			||||||
          this.showFaceCompare = false
 | 
					 | 
				
			||||||
          this.showFaceCompare2 = false
 | 
					 | 
				
			||||||
          this.callBackFlag=false
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // else if(val=='face_checking.wav'){
 | 
					        globalThis.udpClient2 && globalThis.udpClient2.sendMsg(param2, this.context)
 | 
				
			||||||
        //   // console.log('kkkk')
 | 
					 | 
				
			||||||
        //   this.vocObj&&this.vocObj.releasePlayer()
 | 
					 | 
				
			||||||
        //   // globalThis.statue=3
 | 
					 | 
				
			||||||
        //   // this.faceCompareSucess = -1;
 | 
					 | 
				
			||||||
        // }
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
    setTimeout(() => {
 | 
					 | 
				
			||||||
      this.vocObj&&this.vocObj.playAudio({
 | 
					 | 
				
			||||||
        type: 1,
 | 
					 | 
				
			||||||
        name: 'face_check.mp3'
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    }, 1000)
 | 
					    }, 1000)
 | 
				
			||||||
    this.setUdp()
 | 
					    globalThis.udpClient2.setMsgCallBack((val) => {
 | 
				
			||||||
    // this.cameraModel.initCamera(this.surfaceId);
 | 
					      if (val.id == '48') {
 | 
				
			||||||
 | 
					        if (val.body[13] == '1') {
 | 
				
			||||||
  }
 | 
					          this.showFaceCompareFlag=!this.showFaceCompareFlag
 | 
				
			||||||
  setUdp(){
 | 
					          this.showFaceCompare = !this.showFaceCompare
 | 
				
			||||||
    const that=this
 | 
					          this.vocObj && this.vocObj.releasePlayer()
 | 
				
			||||||
    globalThis.udpClient2&&globalThis.udpClient2.onMessage((val)=>{
 | 
					          this.faceCompareSucess = 1
 | 
				
			||||||
      console.log('qkqkqk',val.id,val.body)
 | 
					          clearInterval(this.interval)
 | 
				
			||||||
      if(val.id=='32'){
 | 
					        } else if (val.body[13] == '0' && this.callBackFlag) {
 | 
				
			||||||
        globalThis.signNum=val.body[1]
 | 
					          globalThis.statue = 2
 | 
				
			||||||
        if(val.body[0]=='7'){
 | 
					          this.vocObj && this.vocObj.playAudio({
 | 
				
			||||||
          this.getqkFn()
 | 
					 | 
				
			||||||
          this.signNum=val.body[1]
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }else if(val.id=='48'){
 | 
					 | 
				
			||||||
        if(val.body[13]=='1'){
 | 
					 | 
				
			||||||
          that.showFaceCompare = false
 | 
					 | 
				
			||||||
          that.showFaceCompare2 = false
 | 
					 | 
				
			||||||
          that.vocObj&&that.vocObj.releasePlayer()
 | 
					 | 
				
			||||||
          that.faceCompareSucess=1
 | 
					 | 
				
			||||||
          this.callBackFlag=false
 | 
					 | 
				
			||||||
          clearInterval(that.interval)
 | 
					 | 
				
			||||||
        }else if(val.body[13]=='0'&&this.callBackFlag){
 | 
					 | 
				
			||||||
          this.callBackFlag=false
 | 
					 | 
				
			||||||
          globalThis.statue=2
 | 
					 | 
				
			||||||
          console.log('callBackFlag',this.callBackFlag)
 | 
					 | 
				
			||||||
          that.vocObj&&that.vocObj.playAudio({
 | 
					 | 
				
			||||||
            type: 1,
 | 
					            type: 1,
 | 
				
			||||||
            name: 'face_chekc_fail.wav'
 | 
					            name: 'face_chekc_fail.wav'
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }else if(val.id=='42'){
 | 
					 | 
				
			||||||
        console.log('qkqkqk')
 | 
					 | 
				
			||||||
        this.getqkFlag=!this.getqkFlag
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  fillZero(str, len) {
 | 
					 | 
				
			||||||
    str = str + '';
 | 
					 | 
				
			||||||
    if (str.length > len || !len) {
 | 
					 | 
				
			||||||
      return str
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let num = len - str.length;
 | 
					 | 
				
			||||||
    let zeroStr = '';
 | 
					 | 
				
			||||||
    for (var i = 0; i < num; i++) {
 | 
					 | 
				
			||||||
      zeroStr = zeroStr + '0'
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return zeroStr + str;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // takePictureHandle = (thumbnail: string) => {
 | 
					  async getVideoConfig() {
 | 
				
			||||||
  //   this.imageThumbnail = thumbnail;
 | 
					    console.log('faceEnterIn')
 | 
				
			||||||
  // };
 | 
					    this.vocObj = new voiceService(async (status, val, next) => {
 | 
				
			||||||
  string2Bytes(number, len) {
 | 
					      if (status == 'idle') {
 | 
				
			||||||
    // console.log('string2Bytes == ', number)
 | 
					        if (val == 'face_check.mp3' || val == 'face_fail.mp3') {
 | 
				
			||||||
    let  str = (+number).toString(2);
 | 
					          if (this.times >= 3) {
 | 
				
			||||||
    if(str.length > len) {
 | 
					            globalThis.statue = 3
 | 
				
			||||||
      console.log('数据长度不对~~');
 | 
					            this.faceCompareSucess = -1;
 | 
				
			||||||
      return
 | 
					            this.vocObj && this.vocObj.playAudio({
 | 
				
			||||||
    }
 | 
					              type: 1,
 | 
				
			||||||
    var byteString = this.fillZero(str, len);
 | 
					              name: 'face_checking.wav'
 | 
				
			||||||
 | 
					            })
 | 
				
			||||||
 | 
					            this.heartMsg(this.context)
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            setTimeout(() => {
 | 
				
			||||||
 | 
					              this.faceComparFn()
 | 
				
			||||||
 | 
					            }, 2000)
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        } else if (val == 'yzcg.wav') {
 | 
				
			||||||
 | 
					          this.showFaceCompare = !this.showFaceCompare
 | 
				
			||||||
 | 
					          this.showFaceCompareFlag=!this.showFaceCompareFlag
 | 
				
			||||||
 | 
					          globalThis.statue = 4
 | 
				
			||||||
 | 
					          this.faceCompareSucess = 1;
 | 
				
			||||||
 | 
					          this.vocObj && this.vocObj.releasePlayer()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var arrBytes = new Array();
 | 
					        } else if (val == 'face_chekc_fail.wav') {
 | 
				
			||||||
    for (var i = byteString.length; i > 0;) {
 | 
					          this.vocObj && this.vocObj.releasePlayer()
 | 
				
			||||||
      let j = i - 8;
 | 
					          this.faceCompareSucess = -1
 | 
				
			||||||
      if (j < 0) {
 | 
					          this.showFaceCompare = !this.showFaceCompare
 | 
				
			||||||
        j = 0
 | 
					          this.showFaceCompareFlag=!this.showFaceCompareFlag
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      var s = byteString.slice(j, i);
 | 
					    });
 | 
				
			||||||
      var v = parseInt(s, 2);
 | 
					 | 
				
			||||||
      arrBytes.push(v);
 | 
					 | 
				
			||||||
      i = i - 8
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    const data = await this.fileUtil.readFile(configAddress.comoonfileWriteAddress + '/config/config3.txt');
 | 
				
			||||||
    return arrBytes;
 | 
					    console.log('faceEnterIn,data',data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    setTimeout(() => {
 | 
				
			||||||
 | 
					      this.vocObj && this.vocObj.playAudio({
 | 
				
			||||||
 | 
					        type: 1,
 | 
				
			||||||
 | 
					        name: 'face_check.mp3'
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    }, 1000)
 | 
				
			||||||
 | 
					    this.param = JSON.parse(data)
 | 
				
			||||||
 | 
					    this.param.userName = JSON.parse(data).userName
 | 
				
			||||||
 | 
					    this.param.ip = this.param.ip
 | 
				
			||||||
 | 
					    this.param.pwd = this.param.pwd
 | 
				
			||||||
 | 
					    this.param.port = this.param.port
 | 
				
			||||||
 | 
					    this.param.rlls = this.param.rlls
 | 
				
			||||||
 | 
					    this.controller.start()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async aboutToDisappear() {
 | 
					  async aboutToDisappear() {
 | 
				
			||||||
    // this.mediaModel = MediaModel.getMediaInstance();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  takePhoto(name) {
 | 
					 | 
				
			||||||
    this.stopClose = true;
 | 
					 | 
				
			||||||
    if (this.times > 3) {
 | 
					 | 
				
			||||||
      this.stopClose = false;
 | 
					 | 
				
			||||||
      return;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    this.times++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // this.vocObj.playAudio({
 | 
					 | 
				
			||||||
    //   type: 1,
 | 
					 | 
				
			||||||
    //   name: name
 | 
					 | 
				
			||||||
    // })
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default FaceCompare
 | 
				
			||||||
@ -1,6 +1,8 @@
 | 
				
			|||||||
// @ts-nocheck
 | 
					// @ts-nocheck
 | 
				
			||||||
import hilog from '@ohos.hilog';
 | 
					import hilog from '@ohos.hilog';
 | 
				
			||||||
import apiJudgeSdk from 'libJudgeSdk.so';
 | 
					import apiJudgeSdk from 'libJudgeSdk.so';
 | 
				
			||||||
 | 
					// import apiJudgeSdk from '@ohos.judgesdk';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Judge from '../../judgeSDK/utils/judge-real'
 | 
					import Judge from '../../judgeSDK/utils/judge-real'
 | 
				
			||||||
import {Project,ProjectObj,MarkRule} from '../../judgeSDK/api/judgeSDK.d'
 | 
					import {Project,ProjectObj,MarkRule} from '../../judgeSDK/api/judgeSDK.d'
 | 
				
			||||||
import common from '@ohos.app.ability.common';
 | 
					import common from '@ohos.app.ability.common';
 | 
				
			||||||
@ -37,6 +39,7 @@ struct RealTime {
 | 
				
			|||||||
            id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变
 | 
					            id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变
 | 
				
			||||||
            type: 'surface',
 | 
					            type: 'surface',
 | 
				
			||||||
            libraryname: 'JudgeSdk'
 | 
					            libraryname: 'JudgeSdk'
 | 
				
			||||||
 | 
					            // libraryname: 'judgesdk'
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
            .width(this.width)
 | 
					            .width(this.width)
 | 
				
			||||||
            .height(this.height)
 | 
					            .height(this.height)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
import libJudgeSdk from 'libJudgeSdk.so'
 | 
					import libJudgeSdk from 'libJudgeSdk.so'
 | 
				
			||||||
 | 
					// import libJudgeSdk from '@ohos.judgesdk'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 苏仁君
 | 
					 * 苏仁君
 | 
				
			||||||
 | 
				
			|||||||
@ -530,6 +530,7 @@ export const  testRealExam = {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "extend": {}
 | 
					    "extend": {}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const testAllitems = [
 | 
					export const testAllitems = [
 | 
				
			||||||
    {name:'倒车入库',abbreviation:'倒车入库',projectCode:'0',projectCodeCenter:'20100',type:'1'},
 | 
					    {name:'倒车入库',abbreviation:'倒车入库',projectCode:'0',projectCodeCenter:'20100',type:'1'},
 | 
				
			||||||
    {name:'倒车入库',abbreviation:'倒车入库',projectCode:'0',projectCodeCenter:'20100',type:'2'},
 | 
					    {name:'倒车入库',abbreviation:'倒车入库',projectCode:'0',projectCodeCenter:'20100',type:'2'},
 | 
				
			||||||
 | 
				
			|||||||
@ -109,6 +109,7 @@ export default class Judge{
 | 
				
			|||||||
    if(isTrajectoryOpen){
 | 
					    if(isTrajectoryOpen){
 | 
				
			||||||
      beginExamInfo = JSON.parse(strArr[1])
 | 
					      beginExamInfo = JSON.parse(strArr[1])
 | 
				
			||||||
    }else{
 | 
					    }else{
 | 
				
			||||||
 | 
					      //获取开始考试数据
 | 
				
			||||||
      beginExamInfo = await getJudgeBeginData()
 | 
					      beginExamInfo = await getJudgeBeginData()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    await fileLog.setExamJudgeData(beginExamInfo)
 | 
					    await fileLog.setExamJudgeData(beginExamInfo)
 | 
				
			||||||
@ -153,6 +154,7 @@ export default class Judge{
 | 
				
			|||||||
      const udpIndex = globalThis.udpIndex;
 | 
					      const udpIndex = globalThis.udpIndex;
 | 
				
			||||||
      if(udpIndex % 5 === 0){
 | 
					      if(udpIndex % 5 === 0){
 | 
				
			||||||
        const judgeUdp = globalThis.judgeUdp
 | 
					        const judgeUdp = globalThis.judgeUdp
 | 
				
			||||||
 | 
					        //平台实时轨迹心跳
 | 
				
			||||||
        const bytes= await this.getMessageHeartbeat();
 | 
					        const bytes= await this.getMessageHeartbeat();
 | 
				
			||||||
        judgeUdp.send(bytes)
 | 
					        judgeUdp.send(bytes)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -295,14 +297,14 @@ export default class Judge{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  //处理考试结束
 | 
					  //处理考试结束
 | 
				
			||||||
  public handEndExam = async ()=>{
 | 
					  public handEndExam = async ()=>{
 | 
				
			||||||
    const {isExam,judgeUI,endExam,avPlayer} = this;
 | 
					    const {endExam,avPlayer} = this;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    avPlayer.playAudio(['km2/exam_waiting.mp3'],true)
 | 
					    avPlayer.playAudio(['km2/exam_waiting.mp3'],true)
 | 
				
			||||||
    this.isEnd = true
 | 
					    this.isEnd = true
 | 
				
			||||||
 | 
					    // 获取最后一次心跳
 | 
				
			||||||
    const bytes = await this.getMessageHeartbeat(true);
 | 
					    const bytes = await this.getMessageHeartbeat(true);
 | 
				
			||||||
    const singlePlay = globalThis.singlePlay
 | 
					    const singlePlay = globalThis.singlePlay
 | 
				
			||||||
    singlePlay || globalThis.judgeUdp.send(bytes)
 | 
					    singlePlay || globalThis.judgeUdp.send(bytes)
 | 
				
			||||||
    //结束评判函数
 | 
					    // c++调用考试结束
 | 
				
			||||||
    await examJudgeEndExam();
 | 
					    await examJudgeEndExam();
 | 
				
			||||||
    globalThis.isJudge = false
 | 
					    globalThis.isJudge = false
 | 
				
			||||||
    await endExam()
 | 
					    await endExam()
 | 
				
			||||||
@ -333,10 +335,14 @@ export default class Judge{
 | 
				
			|||||||
    const markRuleListObj = this.judgeUI.markRuleListObj;
 | 
					    const markRuleListObj = this.judgeUI.markRuleListObj;
 | 
				
			||||||
    const thisMark =  markRuleListObj[code]
 | 
					    const thisMark =  markRuleListObj[code]
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
 | 
					      //扣分描述
 | 
				
			||||||
      desc: thisMark.markshow,
 | 
					      desc: thisMark.markshow,
 | 
				
			||||||
 | 
					      //扣分分数
 | 
				
			||||||
      score: thisMark.markreal,
 | 
					      score: thisMark.markreal,
 | 
				
			||||||
      markcatalog: thisMark.markcatalog,
 | 
					      markcatalog: thisMark.markcatalog,
 | 
				
			||||||
 | 
					      // 扣分编码
 | 
				
			||||||
      markserial:thisMark.markserial,
 | 
					      markserial:thisMark.markserial,
 | 
				
			||||||
 | 
					      // 扣分序号
 | 
				
			||||||
      kfxh:thisMark.kfxh
 | 
					      kfxh:thisMark.kfxh
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -412,7 +418,7 @@ export default class Judge{
 | 
				
			|||||||
      xtlb:'17',jkxlh:serialNumber,jkid:'17C53',
 | 
					      xtlb:'17',jkxlh:serialNumber,jkid:'17C53',
 | 
				
			||||||
      drvexam:{
 | 
					      drvexam:{
 | 
				
			||||||
        lsh,kskm:examSubject,
 | 
					        lsh,kskm:examSubject,
 | 
				
			||||||
        // 通用评判科二10000,科三30000
 | 
					        //TODO 通用评判科二10000,科三30000
 | 
				
			||||||
        ksxm:project?project.projectCodeCenter:10000,
 | 
					        ksxm:project?project.projectCodeCenter:10000,
 | 
				
			||||||
        kfxm:kf.markcatalog,
 | 
					        kfxm:kf.markcatalog,
 | 
				
			||||||
        kfxmmx:`${ksxm},${kf.markserial}`,
 | 
					        kfxmmx:`${ksxm},${kf.markserial}`,
 | 
				
			||||||
@ -486,6 +492,7 @@ export default class Judge{
 | 
				
			|||||||
    if(!isManual){
 | 
					    if(!isManual){
 | 
				
			||||||
      if(totalScore < 80){
 | 
					      if(totalScore < 80){
 | 
				
			||||||
        judgeUI.loadingPopupVisible = true
 | 
					        judgeUI.loadingPopupVisible = true
 | 
				
			||||||
 | 
					        //考试次数为1次
 | 
				
			||||||
        if(kssycs == 1){
 | 
					        if(kssycs == 1){
 | 
				
			||||||
          avPlayer.playAudio(['km2/unqualified_one.wav'],true)
 | 
					          avPlayer.playAudio(['km2/unqualified_one.wav'],true)
 | 
				
			||||||
        }else{
 | 
					        }else{
 | 
				
			||||||
@ -648,7 +655,6 @@ export default class Judge{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    let tempArr = [];
 | 
					    let tempArr = [];
 | 
				
			||||||
    arr.forEach(itemArr =>{ tempArr = tempArr.concat(itemArr)})
 | 
					    arr.forEach(itemArr =>{ tempArr = tempArr.concat(itemArr)})
 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.serialIndex += 1;
 | 
					    this.serialIndex += 1;
 | 
				
			||||||
    return Array2Byte(tempArr)
 | 
					    return Array2Byte(tempArr)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -733,6 +739,7 @@ export default class Judge{
 | 
				
			|||||||
    return sbxh
 | 
					    return sbxh
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //获取场地设备编码
 | 
				
			||||||
  getSbbm = (ksxm,xmxh) => {
 | 
					  getSbbm = (ksxm,xmxh) => {
 | 
				
			||||||
    const {judgeUI} = this;
 | 
					    const {judgeUI} = this;
 | 
				
			||||||
    const {cdsbInfoObj,projectsObj} = judgeUI;
 | 
					    const {cdsbInfoObj,projectsObj} = judgeUI;
 | 
				
			||||||
@ -783,7 +790,6 @@ export default class Judge{
 | 
				
			|||||||
    return modelData
 | 
					    return modelData
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private judgeUI
 | 
					  private judgeUI
 | 
				
			||||||
  private fileLog
 | 
					  private fileLog
 | 
				
			||||||
  private totalScore:number
 | 
					  private totalScore:number
 | 
				
			||||||
 | 
				
			|||||||
@ -1,18 +1,10 @@
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
  examJudgeSetLogCallback,
 | 
					 | 
				
			||||||
  examJudgeBeginExam,
 | 
					 | 
				
			||||||
  examJudgeInit,
 | 
					 | 
				
			||||||
  examJudgeRealExam,
 | 
					 | 
				
			||||||
  examJudgeSetRealExamCallback,
 | 
					 | 
				
			||||||
  examJudgeMapSetParam,
 | 
					  examJudgeMapSetParam,
 | 
				
			||||||
  examJudgeMapSetDrawing,
 | 
					 | 
				
			||||||
  examJudgeMapSetScaling
 | 
					  examJudgeMapSetScaling
 | 
				
			||||||
} from '../api/index'
 | 
					} from '../api/index'
 | 
				
			||||||
import systemTime from '@ohos.systemDateTime';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import FileUtil from '../../../common/utils/File'
 | 
					import FileUtil from '../../../common/utils/File'
 | 
				
			||||||
import FileModel from './../utils/file-model'
 | 
					import FileModel from './../utils/file-model'
 | 
				
			||||||
import {testRealExam} from '../dataTest/index'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const judgeTag = 'SURENJUN_JUDGE'
 | 
					const judgeTag = 'SURENJUN_JUDGE'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ import {  getDeviceInfo} from '../common/service/terminalService'
 | 
				
			|||||||
import { registrationDeviceNo } from '../api/checkCar'
 | 
					import { registrationDeviceNo } from '../api/checkCar'
 | 
				
			||||||
import { dateFormat} from '../common/utils/tools'
 | 
					import { dateFormat} from '../common/utils/tools'
 | 
				
			||||||
import deviceManager from '@ohos.distributedHardware.deviceManager'
 | 
					import deviceManager from '@ohos.distributedHardware.deviceManager'
 | 
				
			||||||
import { upDateTableConfig } from '../common/service/initable'
 | 
					import { upDateTableByArray } from '../common/service/initable'
 | 
				
			||||||
import { voiceService } from '../common/service/voiceService'
 | 
					import { voiceService } from '../common/service/voiceService'
 | 
				
			||||||
import promptAction from '@ohos.promptAction'
 | 
					import promptAction from '@ohos.promptAction'
 | 
				
			||||||
@Entry
 | 
					@Entry
 | 
				
			||||||
@ -107,7 +107,7 @@ struct Index {
 | 
				
			|||||||
      type:'1'
 | 
					      type:'1'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    globalThis.deviceNo=this.ip
 | 
					    globalThis.deviceNo=this.ip
 | 
				
			||||||
    upDateTableConfig('DeviceInfoTable',[{deviceId:this.ip}])
 | 
					    upDateTableByArray('DeviceInfoTable',[{deviceId:this.ip}])
 | 
				
			||||||
    registrationDeviceNo(param).then(res=>{
 | 
					    registrationDeviceNo(param).then(res=>{
 | 
				
			||||||
      if(res.registrationDeviceNoRsp.head.resultCode=='0'){
 | 
					      if(res.registrationDeviceNoRsp.head.resultCode=='0'){
 | 
				
			||||||
        promptAction.showToast({
 | 
					        promptAction.showToast({
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user