fix: 日志打印替换

This commit is contained in:
wangzhongjie 2025-06-23 17:24:47 +08:00
parent 0608d66933
commit 768b542ba0
16 changed files with 171 additions and 164 deletions

View File

@ -8,6 +8,7 @@ import { BusinessError } from '@ohos.base';
import { examinerLogin } from '../api/login'; import { examinerLogin } from '../api/login';
import { ApiResponseType, CarInfoType, ExaminerLoginInfo } from '../model/index'; import { ApiResponseType, CarInfoType, ExaminerLoginInfo } from '../model/index';
import { CryptoJS } from '@ohos/crypto-js'; import { CryptoJS } from '@ohos/crypto-js';
import { dConsole } from '../utils/LogWorker';
@Entry @Entry
@ -110,7 +111,7 @@ struct Index {
// TODO // TODO
examinerLogin(param).then((res: ApiResponseType) => { examinerLogin(param).then((res: ApiResponseType) => {
// AppStorage.setOrCreate('examinerInfo', res?.examinerLoginRsp?.body) // AppStorage.setOrCreate('examinerInfo', res?.examinerLoginRsp?.body)
console.log('res?.examinerLoginRsp?.head?.resultCode', res?.examinerLoginRsp?.head?.resultCode, dConsole.log('res?.examinerLoginRsp?.head?.resultCode', res?.examinerLoginRsp?.head?.resultCode,
JSON.stringify(res)) JSON.stringify(res))
this.errorDialog.close() this.errorDialog.close()
@ -118,7 +119,7 @@ struct Index {
if (res?.examinerLoginRsp?.head?.resultCode == '1') { if (res?.examinerLoginRsp?.head?.resultCode == '1') {
// this.type='1' // this.type='1'
// this.title=decodeURIComponent(res.examinerLoginRsp.head.resultMessage) // this.title=decodeURIComponent(res.examinerLoginRsp.head.resultMessage)
// console.log('this.titlt',this.title) // dConsole.log('this.titlt',this.title)
// this.errorDialog.open() // this.errorDialog.open()
return return
} }
@ -129,10 +130,10 @@ struct Index {
} }
}, router.RouterMode.Single); }, router.RouterMode.Single);
console.log('res11', JSON.stringify(res)) dConsole.log('res11', JSON.stringify(res))
const examinerLoginInfo: ExaminerLoginInfo | undefined = res.examinerLoginRsp?.body; const examinerLoginInfo: ExaminerLoginInfo | undefined = res.examinerLoginRsp?.body;
if (!examinerLoginInfo) { if (!examinerLoginInfo) {
console.error('examinerLoginRsp.body is undefined'); dConsole.error('examinerLoginRsp.body is undefined');
return; return;
} }
examinerLoginInfo.username = this.inputTextArr[0] examinerLoginInfo.username = this.inputTextArr[0]
@ -167,7 +168,7 @@ struct Index {
this.inputTextArr[this.currentInputIndex].slice(0, -1) this.inputTextArr[this.currentInputIndex].slice(0, -1)
} }
} }
console.log(this.inputTextArr[this.currentInputIndex]) dConsole.log(this.inputTextArr[this.currentInputIndex])
}) })
} }
}) })

View File

@ -50,6 +50,7 @@ import { CutArray, FormatTimeFlexible, GetCurrentTime } from '../utils/Common';
import FileUtils from '../utils/FileUtils'; import FileUtils from '../utils/FileUtils';
import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog'; import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog';
import { DefaultJudgeConfigData } from '../mock'; import { DefaultJudgeConfigData } from '../mock';
import { dConsole } from '../utils/LogWorker';
@Entry @Entry
@ -221,7 +222,7 @@ struct JudgePage {
const result = await GetSyncData<ES_CARINFOType>("ES_CARINFO") const result = await GetSyncData<ES_CARINFOType>("ES_CARINFO")
const carInfo = result[0] || {}; const carInfo = result[0] || {};
this.carName = decodeURI(carInfo.carclass!) this.carName = decodeURI(carInfo.carclass!)
console.log(JudgeTag, "查看carType", carInfo.cartype) dConsole.log(JudgeTag, "查看carType", carInfo.cartype)
this.carType = carInfo.kscx! this.carType = carInfo.kscx!
this.carinfoArr.push({ this.carinfoArr.push({
CARID: carInfo.carid!, CARID: carInfo.carid!,
@ -234,7 +235,7 @@ struct JudgePage {
BK1: carInfo.bk1!, BK1: carInfo.bk1!,
BK2: carInfo.bk2!, BK2: carInfo.bk2!,
}) })
console.info(JudgeTag, 'surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr)) dConsole.info(JudgeTag, 'surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr))
} }
// 获取考生信息 // 获取考生信息
@ -285,7 +286,7 @@ struct JudgePage {
async initSysset(sysset?: SYSSET[]) { async initSysset(sysset?: SYSSET[]) {
const syssetParams: SYSSET[] | MASYSSETTableType[] = sysset || await GetSyncData<MASYSSETTableType>('MA_SYSSET') const syssetParams: SYSSET[] | MASYSSETTableType[] = sysset || await GetSyncData<MASYSSETTableType>('MA_SYSSET')
const serialNumberArr = (syssetParams as SYSSET[]).filter(sys => sys.v_no === '901'); const serialNumberArr = (syssetParams as SYSSET[]).filter(sys => sys.v_no === '901');
console.info(JudgeTag, 'surenjun serialNumberArr' + JSON.stringify(serialNumberArr)) dConsole.info(JudgeTag, 'surenjun serialNumberArr' + JSON.stringify(serialNumberArr))
this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || ''; this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || '';
// const { isTrajectoryOpen } = judgeConfig // const { isTrajectoryOpen } = judgeConfig
const syssetJudgeConfigArr: SyssetConfig[] = [] const syssetJudgeConfigArr: SyssetConfig[] = []
@ -369,7 +370,7 @@ struct JudgePage {
} }
//真实监管下发的项目 //真实监管下发的项目
let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item); let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item);
console.info(JudgeTag, 'surenjun kStringArr', JSON.stringify(kStringArr)) dConsole.info(JudgeTag, 'surenjun kStringArr', JSON.stringify(kStringArr))
let isInExam = kStringArr.length > 0; let isInExam = kStringArr.length > 0;
// const { isTrajectoryOpen } = judgeConfig // const { isTrajectoryOpen } = judgeConfig
let carNo = '', allItems: string[] = []; let carNo = '', allItems: string[] = [];
@ -409,7 +410,7 @@ struct JudgePage {
//获取当前考车的考试项目 //获取当前考车的考试项目
if (carNo !== '' && systemParm.no1 == "3" && systemParm.no2 == carNo && systemParm.no3 == "10") { if (carNo !== '' && systemParm.no1 == "3" && systemParm.no2 == carNo && systemParm.no3 == "10") {
allItems = decodeURIComponent(systemParm.txt1 || "").split(',').filter(txt => txt !== '') allItems = decodeURIComponent(systemParm.txt1 || "").split(',').filter(txt => txt !== '')
console.info(JudgeTag, 'surenjun', JSON.stringify(allItems)) dConsole.info(JudgeTag, 'surenjun', JSON.stringify(allItems))
} }
if ( if (
//科目二获取项目 //科目二获取项目
@ -438,8 +439,8 @@ struct JudgePage {
const no2Num = Number(systemParm.no2) const no2Num = Number(systemParm.no2)
//真实监管下发考试项目 //真实监管下发考试项目
if (isInExam && !(kStringArr.includes(txt2) || kStringArr.includes(no2 + ''))) { if (isInExam && !(kStringArr.includes(txt2) || kStringArr.includes(no2 + ''))) {
console.info(JudgeTag, 'surenjun =>', txt2) dConsole.info(JudgeTag, 'surenjun =>', txt2)
console.info(JudgeTag, 'surenjun => no2', systemParm.no2) dConsole.info(JudgeTag, 'surenjun => no2', systemParm.no2)
currentProject.type = '3' currentProject.type = '3'
currentProject.isUpload = true currentProject.isUpload = true
currentProject.isEnd = true currentProject.isEnd = true
@ -460,7 +461,7 @@ struct JudgePage {
}) })
}) })
const projects = this.projects; const projects = this.projects;
console.info(JudgeTag, 'surenjun', JSON.stringify(this.ddxkKsxmArr)) dConsole.info(JudgeTag, 'surenjun', JSON.stringify(this.ddxkKsxmArr))
if (!projects.length) { if (!projects.length) {
Prompt.showToast({ Prompt.showToast({
@ -538,7 +539,7 @@ struct JudgePage {
const examItems: string | undefined = currentParams?.examItems; const examItems: string | undefined = currentParams?.examItems;
// 2024-01-03 16:29:26;0;20300,;2,4^2,4;null; // 2024-01-03 16:29:26;0;20300,;2,4^2,4;null;
if (examItems !== '' && examItems !== undefined) { if (examItems !== '' && examItems !== undefined) {
console.info(JudgeTag, 'surenjun examItems=>', JSON.stringify(examItems)) dConsole.info(JudgeTag, 'surenjun examItems=>', JSON.stringify(examItems))
const examItemsArrs = examItems.split(';'); const examItemsArrs = examItems.split(';');
const startTime = examItemsArrs[0] const startTime = examItemsArrs[0]
const ddxkKsxmArr = examItemsArrs[2]?.split(',').filter(item => item) || [] const ddxkKsxmArr = examItemsArrs[2]?.split(',').filter(item => item) || []
@ -1199,7 +1200,7 @@ struct JudgePage {
const projectCode = artSubject3ProjectsCodesArr[index] const projectCode = artSubject3ProjectsCodesArr[index]
if (index === 5) { if (index === 5) {
console.info(JudgeTag, 'surenjun 靠边停车状态=> ', getIsExitManualProject(index)) dConsole.info(JudgeTag, 'surenjun 靠边停车状态=> ', getIsExitManualProject(index))
} }
const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode) const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode)
if (getIsExitManualProject(index)) { if (getIsExitManualProject(index)) {
@ -1222,7 +1223,7 @@ struct JudgePage {
if (xmmcStr == '无' || xmmcStr == '') { if (xmmcStr == '无' || xmmcStr == '') {
//512[6] 人工项目按钮放大确认 //512[6] 人工项目按钮放大确认
const param512: string[] = (Reflect.get(this.judgeConfigObj, '512') || '').split(','); const param512: string[] = (Reflect.get(this.judgeConfigObj, '512') || '').split(',');
console.info(JudgeTag, 'surenjun', param512) dConsole.info(JudgeTag, 'surenjun', param512)
if (param512[6] !== '0') { if (param512[6] !== '0') {
this.amplifiedImgIndex = index; this.amplifiedImgIndex = index;
this.isAmplifyPopShow = true this.isAmplifyPopShow = true

View File

@ -1,5 +1,6 @@
import libJudgeSdk from 'libjudgesdk.so'; import libJudgeSdk from 'libjudgesdk.so';
import { JudgeBeginObj, JudgeInitObj, PLCType } from '../../model'; import { JudgeBeginObj, JudgeInitObj, PLCType } from '../../model';
import { dConsole } from '../../utils/LogWorker';
/** /**
* 苏仁君 * 苏仁君
@ -222,7 +223,7 @@ async function handle(temp: number, fnName: string): Promise<number> {
if (temp == 0) { if (temp == 0) {
resolve(temp); resolve(temp);
} else { } else {
console.log('surenjun error:' + `调用c++函数 ${fnName} 异常:` + libJudgeSdk.examJudgeErrorInfo(temp * 1)) dConsole.error('surenjun error:' + `调用c++函数 ${fnName} 异常:` + libJudgeSdk.examJudgeErrorInfo(temp * 1))
reject(temp) reject(temp)
} }
}) })

View File

@ -18,7 +18,7 @@ struct TerminalInfoPage {
async aboutToAppear() { async aboutToAppear() {
this.fileUtil = new FileUtils(this.context) this.fileUtil = new FileUtils(this.context)
const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'); const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt');
console.log(TerminalInfoTag, "data", data) dConsole.log(TerminalInfoTag, "data", data)
if (data) { if (data) {
this.config = JSON.parse(data) this.config = JSON.parse(data)
AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config) AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config)
@ -195,7 +195,7 @@ struct TerminalInfoPage {
Row() { Row() {
Image($r('app.media.bc')).height(80).objectFit(ImageFit.Contain).onClick(() => { Image($r('app.media.bc')).height(80).objectFit(ImageFit.Contain).onClick(() => {
console.log(TerminalInfoTag, "保存配置", JSON.stringify(this.config)) dConsole.log(TerminalInfoTag, "保存配置", JSON.stringify(this.config))
AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config) AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config)
this.fileUtil.addFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt', JSON.stringify(this.config)) this.fileUtil.addFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt', JSON.stringify(this.config))
dConsole.init(this.config.isOpenLog) dConsole.init(this.config.isOpenLog)

View File

@ -46,6 +46,7 @@ import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness';
import { JudgeEmitterInstance } from '../utils/business/UdpEvent'; import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
import errorMsgDialog from './compontents/errorMsgDialog'; import errorMsgDialog from './compontents/errorMsgDialog';
import { JudgeConfig } from '../config'; import { JudgeConfig } from '../config';
import { dConsole } from '../utils/LogWorker';
@Entry @Entry
@Component @Component
@ -176,9 +177,9 @@ struct UserInfo {
this.ksksLimit = true this.ksksLimit = true
if (this.singlePlay) { if (this.singlePlay) {
this.currentUser.id = '0' this.currentUser.id = '0'
console.log('开始考试') dConsole.log('开始考试')
SqlInsertTable('USER', [this.currentUser]).catch((e: BusinessError) => { SqlInsertTable('USER', [this.currentUser]).catch((e: BusinessError) => {
console.log("error", JSON.stringify(e)) dConsole.log("error", JSON.stringify(e))
}) })
router.pushUrl({ router.pushUrl({
url: this.carInfo.examSubject == '3' ? 'pages/Roads' : 'pages/Judge', url: this.carInfo.examSubject == '3' ? 'pages/Roads' : 'pages/Judge',
@ -191,7 +192,7 @@ struct UserInfo {
this.stopDeviceById() this.stopDeviceById()
return return
} }
console.log('this.FaceOpenStatuethis.FaceOpenStatue', this.FaceOpenStatue) dConsole.log('this.FaceOpenStatuethis.FaceOpenStatue', this.FaceOpenStatue)
if (this.FaceOpenStatue != '0') { if (this.FaceOpenStatue != '0') {
// 同一学员连续第二次考试时不再验证身份 // 同一学员连续第二次考试时不再验证身份
if (this.currentUser.kssycs == '1' && this.systemParam.Param830Str == '1') { if (this.currentUser.kssycs == '1' && this.systemParam.Param830Str == '1') {
@ -203,7 +204,7 @@ struct UserInfo {
this.sfbdinterfaceFn() this.sfbdinterfaceFn()
} }
} catch (e) { } catch (e) {
console.info('Throw Error', JSON.stringify(e)) dConsole.info('Throw Error', JSON.stringify(e))
} }
} }
@ -220,7 +221,7 @@ struct UserInfo {
this.currentUser = EmptyCandidateObject this.currentUser = EmptyCandidateObject
this.filePhoto = new FilePhoto(this.context); this.filePhoto = new FilePhoto(this.context);
this.singlePlay = AppStorage.get<boolean>('singlePlay') || false this.singlePlay = AppStorage.get<boolean>('singlePlay') || false
console.log("this.singlePlay", this.singlePlay) dConsole.log("this.singlePlay", this.singlePlay)
this.examinerLoginInfo = AppStorage.get<ExaminerLoginInfo>('examinerInfo')! this.examinerLoginInfo = AppStorage.get<ExaminerLoginInfo>('examinerInfo')!
this.carInfo = AppStorage.get<CarInfoType>('carInfo')! this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
//语音功能on //语音功能on
@ -230,14 +231,14 @@ struct UserInfo {
//身份证读卡器初始化 //身份证读卡器初始化
// this.openDeviceByIDCard() // this.openDeviceByIDCard()
const routerParam: RouteParamsType = router.getParams() as RouteParamsType const routerParam: RouteParamsType = router.getParams() as RouteParamsType
console.log('routerParam', JSON.stringify(routerParam)) dConsole.log('routerParam', JSON.stringify(routerParam))
if (!this.singlePlay) { if (!this.singlePlay) {
if (routerParam.type != "1") { if (routerParam.type != "1") {
this.list = await GetSyncData<User>("USERLIST") this.list = await GetSyncData<User>("USERLIST")
const data = await GetSyncData<User>("USER") const data = await GetSyncData<User>("USER")
console.log('useruser,', JSON.stringify(this.list)) dConsole.log('useruser,', JSON.stringify(this.list))
console.log('useruser1,', JSON.stringify(data)) dConsole.log('useruser1,', JSON.stringify(data))
const user = data[0] const user = data[0]
if (user && Number(user.kssycs)) { if (user && Number(user.kssycs)) {
@ -253,7 +254,7 @@ struct UserInfo {
this.currentUser = (this.list.length ? this.list[0] : EmptyCandidateObject) this.currentUser = (this.list.length ? this.list[0] : EmptyCandidateObject)
} }
} else if (user && (user.kssycs == '0' || user.kssycs == '')) { } else if (user && (user.kssycs == '0' || user.kssycs == '')) {
console.log('datadatadatadata') dConsole.log('datadatadatadata')
this.list = this.list.filter(res => { this.list = this.list.filter(res => {
return res.sfzmhm != user.sfzmhm return res.sfzmhm != user.sfzmhm
}) })
@ -295,7 +296,7 @@ struct UserInfo {
// TODO UDP更改 // TODO UDP更改
//监听远程开始考试 //监听远程开始考试
JudgeEmitterInstance.onBeginExam(async () => { JudgeEmitterInstance.onBeginExam(async () => {
console.info('surenjun', 'userInfo收到UdpEvent事件') dConsole.info('surenjun', 'userInfo收到UdpEvent事件')
if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) { if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
await this.prePareSCZB() await this.prePareSCZB()
} else { } else {
@ -317,7 +318,7 @@ struct UserInfo {
if (ret == 0) { if (ret == 0) {
testNapi.StartReadCard(this.onReadCard); testNapi.StartReadCard(this.onReadCard);
} else { } else {
console.error("zzctest Failed to Open Device"); dConsole.error("zzctest Failed to Open Device");
} }
} }
@ -331,9 +332,9 @@ struct UserInfo {
async getCurrentStudent(id: string) { async getCurrentStudent(id: string) {
let flag = false let flag = false
// this.pageIndex // this.pageIndex
console.log('currentidid', id) dConsole.log('currentidid', id)
this.list.map((res, index) => { this.list.map((res, index) => {
console.log('tttt', res.sfzmhm, res.xm) dConsole.log('tttt', res.sfzmhm, res.xm)
if (res.sfzmhm == id) { if (res.sfzmhm == id) {
flag = true flag = true
this.currentUser = EmptyCandidateObject this.currentUser = EmptyCandidateObject
@ -381,7 +382,7 @@ struct UserInfo {
} }
onReadCard(ret: IDCardSDK.IDCardInfo) { onReadCard(ret: IDCardSDK.IDCardInfo) {
console.info(`zzctest xx Read Card ret =${ret.status}`) dConsole.info(`zzctest xx Read Card ret =${ret.status}`)
let thisVar: IdCard = AppStorage.get('indexComponent')!; let thisVar: IdCard = AppStorage.get('indexComponent')!;
if (ret.status == 0) { // status = 1 为读到身份证信息; status = 1 为身份证离开读卡器 if (ret.status == 0) { // status = 1 为读到身份证信息; status = 1 为身份证离开读卡器
@ -400,10 +401,10 @@ struct UserInfo {
if (ret.baseInfo.length > 2) { if (ret.baseInfo.length > 2) {
// 收到身份证信息,填充页面 // 收到身份证信息,填充页面
console.info(`zzctest Read Card 1`); dConsole.info(`zzctest Read Card 1`);
let subIndex = ret.baseInfo.indexOf(":") let subIndex = ret.baseInfo.indexOf(":")
let baseInfo: string = ret.baseInfo.substring(subIndex + 1, ret.baseInfo.length - 1); let baseInfo: string = ret.baseInfo.substring(subIndex + 1, ret.baseInfo.length - 1);
console.info(`zzctest Read Card 2 baseInfo=${baseInfo}`); dConsole.info(`zzctest Read Card 2 baseInfo=${baseInfo}`);
let baseInfos: string[] = baseInfo.split("|"); let baseInfos: string[] = baseInfo.split("|");
thisVar.name = baseInfos[0]; thisVar.name = baseInfos[0];
thisVar.sex = baseInfos[1]; thisVar.sex = baseInfos[1];
@ -419,7 +420,7 @@ struct UserInfo {
// 身份证照片数据处理 // 身份证照片数据处理
if (ret.photo instanceof ArrayBuffer) { if (ret.photo instanceof ArrayBuffer) {
let dataView = new DataView(ret.photo) let dataView = new DataView(ret.photo)
console.info(`Read Card ret = length = ${dataView.byteLength}`) dConsole.info(`Read Card ret = length = ${dataView.byteLength}`)
let str = "" let str = ""
for (let i = 0; i < dataView.byteLength; ++i) { for (let i = 0; i < dataView.byteLength; ++i) {
let c = String.fromCharCode(dataView.getUint8(i)) let c = String.fromCharCode(dataView.getUint8(i))
@ -429,7 +430,7 @@ struct UserInfo {
} }
thisVar.photo += str; thisVar.photo += str;
} }
console.info(`zzctest Read Card end`); dConsole.info(`zzctest Read Card end`);
return true; return true;
} }
@ -503,7 +504,7 @@ struct UserInfo {
const openCheckFlag = openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0' const openCheckFlag = openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0'
const faceParam = syssetParams.filter(sys => sys.v_no == '2413') //3 const faceParam = syssetParams.filter(sys => sys.v_no == '2413') //3
console.log('FaceOpenStatue', openCheckFlag, this.FaceOpenStatue) dConsole.log('FaceOpenStatue', openCheckFlag, this.FaceOpenStatue)
// 1身份证读卡器 2指纹 3人脸 // 1身份证读卡器 2指纹 3人脸
if (openCheckFlag == '1') { if (openCheckFlag == '1') {
that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0' that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0'
@ -607,7 +608,7 @@ struct UserInfo {
//人脸比对窗口关闭 //人脸比对窗口关闭
changeFaceCompareSuccess() { changeFaceCompareSuccess() {
this.ksksLimit = false this.ksksLimit = false
console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser)) dConsole.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser))
if (this.faceCompareSucess > 0) { if (this.faceCompareSucess > 0) {
//人脸比对通过 //人脸比对通过
AppStorage.setOrCreate('statue', 4) AppStorage.setOrCreate('statue', 4)
@ -643,7 +644,7 @@ struct UserInfo {
this.ksksLimit = false this.ksksLimit = false
// this.isBoardPrePareSetPopupOpen=true // this.isBoardPrePareSetPopupOpen=true
this.isFirstBoardPrePareSetPopupBtnShow = false this.isFirstBoardPrePareSetPopupBtnShow = false
console.log('isFirstBoardPrePareSetPopupBtnShow', this.isFirstBoardPrePareSetPopupBtnShow, dConsole.log('isFirstBoardPrePareSetPopupBtnShow', this.isFirstBoardPrePareSetPopupBtnShow,
this.isBoardPrePareSetPopupOpen) this.isBoardPrePareSetPopupOpen)
this.startExam = false this.startExam = false
// await upDateTableByArray('USER', []) // await upDateTableByArray('USER', [])
@ -660,7 +661,7 @@ struct UserInfo {
`<getExaminationStudentInfoReq><head><checkCode>${md5Message}</checkCode></head><body><carId>${this.carInfo.carId}</carId><examinationRoomId>${this.carInfo.examinationRoomId}</examinationRoomId><examinerName>${this.examinerLoginInfo.username}</examinerName><sfzmhm></sfzmhm></body></getExaminationStudentInfoReq>` `<getExaminationStudentInfoReq><head><checkCode>${md5Message}</checkCode></head><body><carId>${this.carInfo.carId}</carId><examinationRoomId>${this.carInfo.examinationRoomId}</examinationRoomId><examinerName>${this.examinerLoginInfo.username}</examinerName><sfzmhm></sfzmhm></body></getExaminationStudentInfoReq>`
try { try {
getExaminationStudentInfo(param).then(async (res) => { getExaminationStudentInfo(param).then(async (res) => {
console.log("temp log ", JSON.stringify(res)) dConsole.log("temp log ", JSON.stringify(res))
this.errorDialog.close() this.errorDialog.close()
setTimeout(() => { setTimeout(() => {
this.updateTimeLimit = false this.updateTimeLimit = false
@ -695,7 +696,7 @@ struct UserInfo {
this.list = JSON.parse(JSON.stringify(dataList)) this.list = JSON.parse(JSON.stringify(dataList))
console.log("temp list", JSON.stringify(this.list)) dConsole.log("temp list", JSON.stringify(this.list))
this.list.forEach((listData, index) => { this.list.forEach((listData, index) => {
//考过一次不允许切换学员 //考过一次不允许切换学员
if (listData.kssycs == '1') { if (listData.kssycs == '1') {
@ -721,14 +722,14 @@ struct UserInfo {
}) })
// await upDateTableByArray('USERLIST', this.list || []) // await upDateTableByArray('USERLIST', this.list || [])
console.log("temp list", JSON.stringify(this.list)) dConsole.log("temp list", JSON.stringify(this.list))
// await sqlInsertCommonFn("USERLIST", this.list || []) // await sqlInsertCommonFn("USERLIST", this.list || [])
await SqlInsertTable('USERLIST', this.list || []) await SqlInsertTable('USERLIST', this.list || [])
dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list; dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list;
this.dataList = dataList this.dataList = dataList
console.log("temp list", JSON.stringify(this.dataList)) dConsole.log("temp list", JSON.stringify(this.dataList))
const user = this.dataList.filter(res => { const user = this.dataList.filter(res => {
return res.kssycs == '1' return res.kssycs == '1'
@ -765,12 +766,12 @@ struct UserInfo {
}).catch((error: BusinessError) => { }).catch((error: BusinessError) => {
this.updateTimeLimit = false this.updateTimeLimit = false
this.errorDialog.close() this.errorDialog.close()
console.log('error12error' + error) dConsole.log('error12error' + error)
}) })
} catch (error) { } catch (error) {
this.updateTimeLimit = false this.updateTimeLimit = false
this.errorDialog.close() this.errorDialog.close()
console.log('error14error' + error) dConsole.log('error14error' + error)
} }
} }
@ -784,7 +785,7 @@ struct UserInfo {
this.qkFlag = false this.qkFlag = false
return return
} }
console.log('JsonJson', JSON.stringify(this.currentUser)) dConsole.log('JsonJson', JSON.stringify(this.currentUser))
const param: ExaminationStuAbsentParams = { const param: ExaminationStuAbsentParams = {
carId: this.carInfo.carId || "", carId: this.carInfo.carId || "",
sfzmhm: this.currentUser.sfzmhm, sfzmhm: this.currentUser.sfzmhm,
@ -792,7 +793,7 @@ struct UserInfo {
username: this.examinerLoginInfo.username || "", username: this.examinerLoginInfo.username || "",
lsh: this.lsh lsh: this.lsh
} }
console.log('carNo1111', param) dConsole.log('carNo1111', param)
examinationStuAbsent(param).then(res => { examinationStuAbsent(param).then(res => {
const arr = [this.signNum || 0, 1] const arr = [this.signNum || 0, 1]
@ -817,7 +818,7 @@ struct UserInfo {
return return
} }
}).catch((error: BusinessError) => { }).catch((error: BusinessError) => {
console.log('error12error' + error) dConsole.log('error12error' + error)
}) })
} }
@ -866,10 +867,10 @@ struct UserInfo {
this.isLoadingPopupVisible = true this.isLoadingPopupVisible = true
avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => {
console.info('surenjun', '播放结束开始考试接口调用') dConsole.info('surenjun', '播放结束开始考试接口调用')
// const { code, keystr, message } = await this.beginExam() || {}; // const { code, keystr, message } = await this.beginExam() || {};
const res = await this.beginExam() const res = await this.beginExam()
console.info('surenjun', '开始考试接口调用结束') dConsole.info('surenjun', '开始考试接口调用结束')
//TODO code转换 //TODO code转换
if (res.code != 1) { if (res.code != 1) {
@ -1041,7 +1042,7 @@ struct UserInfo {
//接口标识 //接口标识
jkid: '17C51', jkid: '17C51',
} }
console.info('surenjunjianguan', JSON.stringify(param)) dConsole.info('surenjunjianguan', JSON.stringify(param))
const temp = await writeObjectOut(param, "", this.context); const temp = await writeObjectOut(param, "", this.context);
AppStorage.setOrCreate('lsh', this.currentUser.lsh) AppStorage.setOrCreate('lsh', this.currentUser.lsh)
this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm
@ -1056,12 +1057,12 @@ struct UserInfo {
this.isExamStart = true this.isExamStart = true
this.currentUser.id = '0' this.currentUser.id = '0'
DB.insertData("USER", this.currentUser).then(() => { DB.insertData("USER", this.currentUser).then(() => {
console.log("USER insert success",) dConsole.log("USER insert success",)
}).catch((err: BusinessError) => { }).catch((err: BusinessError) => {
console.log("USER insert fail", JSON.stringify(err)) dConsole.log("USER insert fail", JSON.stringify(err))
}) })
// await upDateTableByArray('USER', [this.currentUser]) // await upDateTableByArray('USER', [this.currentUser])
console.log("User", JSON.stringify(this.currentUser)) dConsole.log("User", JSON.stringify(this.currentUser))
// await sqlInsertCommonFn("USER", [this.currentUser]) // await sqlInsertCommonFn("USER", [this.currentUser])
AppStorage.setOrCreate('statue', 4) AppStorage.setOrCreate('statue', 4)
this.isBoardPrePareSetPopupShow = true; this.isBoardPrePareSetPopupShow = true;
@ -1119,7 +1120,7 @@ struct UserInfo {
$r('app.media.userboxbg')) $r('app.media.userboxbg'))
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => { .onClick(() => {
console.log('this.startExam', this.startExam, this.systemParam.Param364, this.isExamStart) dConsole.log('this.startExam', this.startExam, this.systemParam.Param364, this.isExamStart)
if ((this.isExamStart && !this.singlePlay && this.systemParam.Param341) || if ((this.isExamStart && !this.singlePlay && this.systemParam.Param341) ||
(this.startExam && this.systemParam.Param364 == '2')) { (this.startExam && this.systemParam.Param364 == '2')) {
return return

View File

@ -7,6 +7,7 @@ import common from '@ohos.app.ability.common'
import { GlobalConfig } from '../config' import { GlobalConfig } from '../config'
import Prompt from '@system.prompt' import Prompt from '@system.prompt'
import { endRecordVideo, startRecordVideo, takePhoto } from '../utils/Video' import { endRecordVideo, startRecordVideo, takePhoto } from '../utils/Video'
import { dConsole } from '../utils/LogWorker'
@Entry @Entry
@Component @Component
@ -23,11 +24,11 @@ struct VideoConfigPage {
builder: VideoConfigComponent({ builder: VideoConfigComponent({
videoConfig: this.videoConfig, videoConfig: this.videoConfig,
back: () => { back: () => {
console.log("返回") dConsole.log("返回")
this.videoConfig = this.oldVideoConfig this.videoConfig = this.oldVideoConfig
}, },
save: (config: VideoConfig) => { save: (config: VideoConfig) => {
console.log("保存", config) dConsole.log("保存", config)
this.videoConfig = config this.videoConfig = config
this.saveVideoConfig() this.saveVideoConfig()
}, },
@ -72,7 +73,7 @@ struct VideoConfigPage {
// 保存视频配置 // 保存视频配置
async saveVideoConfig() { async saveVideoConfig() {
const folderPath = await this.fileUtil.initFolder(`/config`); const folderPath = await this.fileUtil.initFolder(`/config`);
console.log(this.oldVideoConfig.videoNum, this.videoConfig.videoNum, "查看") dConsole.log(this.oldVideoConfig.videoNum, this.videoConfig.videoNum, "查看")
this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.videoConfig)) this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.videoConfig))
} }
@ -193,7 +194,7 @@ struct VideoConfigPage {
duration: 3000 duration: 3000
}) })
} catch (error) { } catch (error) {
console.log("抓图失败", error) dConsole.log("抓图失败", error)
} }
} }
}) })

View File

@ -9,7 +9,6 @@ export default struct CheckboxComponent {
.height(40) .height(40)
.select(this.value) .select(this.value)
.onChange((value: boolean) => { .onChange((value: boolean) => {
console.info('Checkbox1 change is' + value)
this.value = value; this.value = value;
this.change?.(value); this.change?.(value);
}) })

View File

@ -10,6 +10,7 @@ import FileUtils from '../../utils/FileUtils';
import { CenterUDPBusinessInstance } from '../../utils/business/CenterUdpBusiness'; import { CenterUDPBusinessInstance } from '../../utils/business/CenterUdpBusiness';
import { takePhoto, takePhotoParam } from '../../utils/Video'; import { takePhoto, takePhotoParam } from '../../utils/Video';
import { voiceService } from '../../utils/Voice'; import { voiceService } from '../../utils/Voice';
import { dConsole } from '../../utils/LogWorker';
interface ParamType { interface ParamType {
id?: number; id?: number;
@ -38,9 +39,7 @@ export default struct FaceCompare {
@State showControls: boolean = false @State showControls: boolean = false
@State isAutoPlay: boolean = true @State isAutoPlay: boolean = true
@State signNum: number = 0; @State signNum: number = 0;
@State carInfo: CarInfoType = { @State carInfo: CarInfoType = {};
};
@State param: VideoConfig = VideoConfigData @State param: VideoConfig = VideoConfigData
private times = 1; //人脸比对失败次数, 超过3次将不会自动比对需要点击重新打开重新触发 private times = 1; //人脸比对失败次数, 超过3次将不会自动比对需要点击重新打开重新触发
private vocObj!: voiceService; private vocObj!: voiceService;
@ -189,11 +188,11 @@ export default struct FaceCompare {
} }
async faceComparFn() { async faceComparFn() {
console.log('mmmmm0', 2) dConsole.log('mmmmm0', 2)
this.param.pztd = this.param.rlls this.param.pztd = this.param.rlls
const data: takePhotoParam = await takePhoto(this.param, this.context, 'jt/', 1,) const data: takePhotoParam = await takePhoto(this.param, this.context, 'jt/', 1,)
this.base64 = this.imageBase64 + (data?.base64 || "") this.base64 = this.imageBase64 + (data?.base64 || "")
console.log('mmmmt', this.base64) dConsole.log('mmmmt', this.base64)
faceCompare({ faceCompare({
sfzh: this.sfzh.toString(), sfzh: this.sfzh.toString(),
firstImage: this.firstImage.substr(22), firstImage: this.firstImage.substr(22),
@ -202,7 +201,7 @@ export default struct FaceCompare {
verifyType: "1" verifyType: "1"
}) })
.then(res => { .then(res => {
console.log('mmmmm8', JSON.stringify(res)) dConsole.log('mmmmm8', JSON.stringify(res))
if (res.imageCompareRsp?.head?.resultCode == '0') { if (res.imageCompareRsp?.head?.resultCode == '0') {
this.controller.stop() this.controller.stop()
this.showFaceCompare = !this.showFaceCompare this.showFaceCompare = !this.showFaceCompare
@ -223,7 +222,7 @@ export default struct FaceCompare {
} }
}) })
console.log('mmmmm8', 9) dConsole.log('mmmmm8', 9)
} }
@ -231,7 +230,7 @@ export default struct FaceCompare {
async heartMsg() { async heartMsg() {
let tmpList: number[] = [] let tmpList: number[] = []
const str = this.lsh const str = this.lsh
console.log('this.lshbitbit', this.lsh, this.carInfo.carNo, this.carInfo.examinationRoomId) dConsole.log('this.lshbitbit', this.lsh, this.carInfo.carNo, this.carInfo.examinationRoomId)
for (let i = 0; i < str.length; i++) { for (let i = 0; i < str.length; i++) {
if (str && str.charCodeAt(i) !== undefined) { if (str && str.charCodeAt(i) !== undefined) {
tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0]); tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0]);
@ -285,7 +284,7 @@ export default struct FaceCompare {
} }
async getVideoConfig() { async getVideoConfig() {
console.log('faceEnterIn') dConsole.log('faceEnterIn')
this.vocObj = new voiceService(async (status: string, val?: string) => { this.vocObj = new voiceService(async (status: string, val?: string) => {
if (status == 'idle') { if (status == 'idle') {
if (val === 'face_check.mp3' || val === 'face_fail.mp3') { if (val === 'face_check.mp3' || val === 'face_fail.mp3') {
@ -318,7 +317,7 @@ export default struct FaceCompare {
}, this.context); }, this.context);
const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt'); const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt');
console.log('faceEnterIn,data', data) dConsole.log('faceEnterIn,data', data)
setTimeout(() => { setTimeout(() => {
this.vocObj && this.vocObj.playAudio({ this.vocObj && this.vocObj.playAudio({

View File

@ -81,7 +81,6 @@ export default struct HeaderComponent {
} else { } else {
Row() { Row() {
Image($r('app.media.btn_setting')).height(100).onClick(() => { Image($r('app.media.btn_setting')).height(100).onClick(() => {
console.log("点击设置")
router.pushUrl({ router.pushUrl({
url: 'pages/Settings', url: 'pages/Settings',
}, router.RouterMode.Single); }, router.RouterMode.Single);

View File

@ -4,6 +4,7 @@ import apiJudgeSdk from 'libJudgeSdk.so'
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker' import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker'
import { examJudgeMapSetScaling } from '../Judge/JudgeUtils' import { examJudgeMapSetScaling } from '../Judge/JudgeUtils'
import { dConsole } from '../../utils/LogWorker'
@Component @Component
@ -24,7 +25,7 @@ export default struct SignalDisplayComponent {
aboutToAppear(): void { aboutToAppear(): void {
DifferentialAndSignal.onMsg((data: string) => { DifferentialAndSignal.onMsg((data: string) => {
const result: WorkerBackMessage = JSON.parse(data) const result: WorkerBackMessage = JSON.parse(data)
console.log("wzj", data) dConsole.log("wzj", data)
if (result.type === "obtainUdpData") { if (result.type === "obtainUdpData") {
this.getSignal(result.data as string) this.getSignal(result.data as string)
this.rawData = result.data as string this.rawData = result.data as string

View File

@ -25,7 +25,6 @@ export default struct TabComponent {
label: "轨迹查看", label: "轨迹查看",
active: this.activeIndex === 2, active: this.activeIndex === 2,
}).onClick(() => { }).onClick(() => {
console.log("轨迹查看")
this.activeIndex = 2 this.activeIndex = 2
this.onchange(2) this.onchange(2)
}) })

View File

@ -1,4 +1,4 @@
import { JudgeConfig } from "../../../config"; import { JudgeConfig } from '../../../config';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements'; import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
@ -9,6 +9,7 @@ import { CarInfoType, MarkRule, MASYSSETTableType, RegulatoryInterfaceParams, Us
import { GetCurrentTime } from '../../../utils/Common'; import { GetCurrentTime } from '../../../utils/Common';
import FileUtils from '../../../utils/FileUtils'; import FileUtils from '../../../utils/FileUtils';
import { GetSyncData } from '../../../utils/table/Operation'; import { GetSyncData } from '../../../utils/table/Operation';
import { dConsole } from '../../../utils/LogWorker';
interface SEL { interface SEL {
fontColor: string fontColor: string
@ -203,7 +204,7 @@ export default struct DeductedPopup {
// const carInfo = this.carInfo; // const carInfo = this.carInfo;
// const { examSubject, plateNo, carNo } = carInfo; // const { examSubject, plateNo, carNo } = carInfo;
const time = GetCurrentTime(); const time = GetCurrentTime();
console.info('surenjun uploadProgressPhoto',) dConsole.info('surenjun uploadProgressPhoto',)
const photoBase64 = await this.getPhoto() const photoBase64 = await this.getPhoto()
const photoData: RegulatoryInterfaceParams = { const photoData: RegulatoryInterfaceParams = {
xtlb: '17', xtlb: '17',
@ -223,7 +224,7 @@ export default struct DeductedPopup {
} }
}; };
const code = await writeObjectOut(photoData, "", this.context); const code = await writeObjectOut(photoData, "", this.context);
console.info('surenjun uploadProgressPhoto end',) dConsole.info('surenjun uploadProgressPhoto end',)
} }
// 扣分 // 扣分
@ -302,7 +303,7 @@ export default struct DeductedPopup {
//获取sysset表数据 //获取sysset表数据
async initSysset(sysset?: MASYSSETTableType[]) { async initSysset(sysset?: MASYSSETTableType[]) {
const syssetParams = sysset || await GetSyncData<MASYSSETTableType>('MA_SYSSET'); const syssetParams = sysset || await GetSyncData<MASYSSETTableType>('MA_SYSSET');
console.info('surenjun syssetParams', JSON.stringify(syssetParams)); dConsole.info('surenjun syssetParams', JSON.stringify(syssetParams));
syssetParams.forEach(sys => { syssetParams.forEach(sys => {
//监管序列号 //监管序列号
if (sys.v_no == '901') { if (sys.v_no == '901') {

View File

@ -75,6 +75,7 @@ import {
UploadRegulatoryCodeConversion UploadRegulatoryCodeConversion
} from '../Judge/utils'; } from '../Judge/utils';
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker'; import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker';
import { dConsole } from '../../utils/LogWorker';
type GetKm3JudgeInitConfig = () => Promise<Km3JudgeInitConfig> type GetKm3JudgeInitConfig = () => Promise<Km3JudgeInitConfig>
@ -103,7 +104,7 @@ export default class Judge {
//人工扣分 //人工扣分
public setJudgeMark = async (itemno: string, serial: string, type = 1) => { public setJudgeMark = async (itemno: string, serial: string, type = 1) => {
await examJudgeArtificialMark(Number(itemno), serial, type); await examJudgeArtificialMark(Number(itemno), serial, type);
console.info(JudgeTag, `进入人工扣分-${itemno}-${serial}`) dConsole.info(JudgeTag, `进入人工扣分-${itemno}-${serial}`)
const str = JSON.stringify({ const str = JSON.stringify({
method: 'examJudgeArtificialMark', method: 'examJudgeArtificialMark',
itemno: Number(itemno), itemno: Number(itemno),
@ -111,7 +112,7 @@ export default class Judge {
type type
}) })
await this.fileLog?.setExamJudgeData(str) await this.fileLog?.setExamJudgeData(str)
console.info(JudgeTag, `人工扣分-${itemno}-${serial}`) dConsole.info(JudgeTag, `人工扣分-${itemno}-${serial}`)
} }
//人工操作项目 //人工操作项目
public setJudgeItem = async (itemno: string, type: 1 | 2) => { public setJudgeItem = async (itemno: string, type: 1 | 2) => {
@ -123,7 +124,7 @@ export default class Judge {
type type
}) })
await this.fileLog?.setExamJudgeData(str) await this.fileLog?.setExamJudgeData(str)
console.info(JudgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`) dConsole.info(JudgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`)
} }
private filePath: string = "" private filePath: string = ""
private totalScore: number = -1 private totalScore: number = -1
@ -170,7 +171,7 @@ export default class Judge {
return '' return ''
} else { } else {
const photoBase64 = await this.filePhoto?.getPhoto(); const photoBase64 = await this.filePhoto?.getPhoto();
console.info(JudgeTag, '拍照完成') dConsole.info(JudgeTag, '拍照完成')
return photoBase64 return photoBase64
} }
} }
@ -206,9 +207,9 @@ export default class Judge {
let examData: Uint8Array = new Uint8Array(tempBuff.buffer) let examData: Uint8Array = new Uint8Array(tempBuff.buffer)
examDataBase64 = base64.encodeToStringSync(examData) examDataBase64 = base64.encodeToStringSync(examData)
} catch (e) { } catch (e) {
console.info(JudgeTag, JSON.stringify(e)) dConsole.info(JudgeTag, JSON.stringify(e))
} }
console.info(JudgeTag, '过程数据文件上传 start') dConsole.info(JudgeTag, '过程数据文件上传 start')
try { try {
await uploadExamProgressData({ await uploadExamProgressData({
@ -222,9 +223,9 @@ export default class Judge {
examEndTime: endTime, examEndTime: endTime,
}) })
} catch (e) { } catch (e) {
console.info(JudgeTag, '过程数据文件上传失败:' + JSON.stringify(e)) dConsole.info(JudgeTag, '过程数据文件上传失败:' + JSON.stringify(e))
} }
console.info(JudgeTag, '过程数据文件上传 end') dConsole.info(JudgeTag, '过程数据文件上传 end')
} }
private judgeTask: JudgeTask private judgeTask: JudgeTask
// 检测扣分、结束项目时该项目是否开始 // 检测扣分、结束项目时该项目是否开始
@ -239,9 +240,9 @@ export default class Judge {
const isUpload = currentProject.isUpload const isUpload = currentProject.isUpload
//如果项目没有开始 //如果项目没有开始
console.info(JudgeTag, 'surenjun isUpload=>', isUpload) dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
if (!isUpload) { if (!isUpload) {
console.info(JudgeTag, '项目补传开始') dConsole.info(JudgeTag, '项目补传开始')
//项目开始补传 //项目开始补传
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
await this.beginProject(xmdm) await this.beginProject(xmdm)
@ -339,7 +340,7 @@ export default class Judge {
//单机模式 //单机模式
if (singlePlay) { if (singlePlay) {
console.info(JudgeTag + ' isAllProjectsEnd => ', isAllProjectsEnd) dConsole.info(JudgeTag + ' isAllProjectsEnd => ', isAllProjectsEnd)
if (isAllProjectsEnd && jl >= examMileage) { if (isAllProjectsEnd && jl >= examMileage) {
//成绩合格 //成绩合格
if (totalScore >= passingGrade && !isEndTip) { if (totalScore >= passingGrade && !isEndTip) {
@ -446,7 +447,7 @@ export default class Judge {
} }
// 处理udp plc信号 // 处理udp plc信号
handleUdp = async (msg: string) => { handleUdp = async (msg: string) => {
console.info(JudgeTag, 'plc信号', msg) dConsole.info(JudgeTag, 'plc信号', msg)
const stachArr = msg.split(',') const stachArr = msg.split(',')
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) { if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
return return
@ -483,7 +484,7 @@ export default class Judge {
const judgeTimer = setInterval(async () => { const judgeTimer = setInterval(async () => {
const msgStr = strArr[num]; const msgStr = strArr[num];
if (msgStr == '') { if (msgStr == '') {
console.info(JudgeTag, '模拟数据考试结束') dConsole.info(JudgeTag, '模拟数据考试结束')
clearInterval(judgeTimer) clearInterval(judgeTimer)
this.checkExamIsEnd(true) this.checkExamIsEnd(true)
return return
@ -559,7 +560,7 @@ export default class Judge {
drvexam drvexam
} }
const temp: WR = await this.sendWriteObjectOut(data, this.filePath) const temp: WR = await this.sendWriteObjectOut(data, this.filePath)
console.info(JudgeTag, '项目开始 end') dConsole.info(JudgeTag, '项目开始 end')
if (temp.code === 2300007) { if (temp.code === 2300007) {
this.isJudgeDisConnect = true; this.isJudgeDisConnect = true;
} }
@ -597,7 +598,7 @@ export default class Judge {
if (temp.code === 2300007) { if (temp.code === 2300007) {
this.isJudgeDisConnect = true; this.isJudgeDisConnect = true;
} }
console.info(JudgeTag, '项目结束 end') dConsole.info(JudgeTag, '项目结束 end')
UploadRegulatoryCodeConversion('17C55', temp.code || 0) UploadRegulatoryCodeConversion('17C55', temp.code || 0)
} }
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
@ -609,7 +610,7 @@ export default class Judge {
//调用监管接口 //调用监管接口
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => { sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
const temp = await writeObjectOut(data, filePath, this.context); const temp = await writeObjectOut(data, filePath, this.context);
console.log(JudgeTag, "wzj", JSON.stringify(temp)) dConsole.log(JudgeTag, "wzj", JSON.stringify(temp))
//断网&网络超时次数计算 //断网&网络超时次数计算
if (temp.code == 2300007 || temp.code == 2300028) { if (temp.code == 2300007 || temp.code == 2300028) {
this.disConnectNum += 1; this.disConnectNum += 1;
@ -619,7 +620,7 @@ export default class Judge {
} }
if (this.disConnectNum >= 5) { if (this.disConnectNum >= 5) {
console.info('surenjun', '123') dConsole.info('surenjun', '123')
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
this.judgeUI.disConnectErrorOpen = true this.judgeUI.disConnectErrorOpen = true
} }
@ -659,7 +660,7 @@ export default class Judge {
this.isJudgeDisConnect = true this.isJudgeDisConnect = true
} }
UploadRegulatoryCodeConversion('17C54', temp.code || 0) UploadRegulatoryCodeConversion('17C54', temp.code || 0)
console.info(JudgeTag, '上传照片 end') dConsole.info(JudgeTag, '上传照片 end')
} }
constructor(judgeUI: JudgeUI) { constructor(judgeUI: JudgeUI) {
@ -695,7 +696,7 @@ export default class Judge {
}) })
}) })
console.info(JudgeTag + 'testKmItems', JSON.stringify(this.kmItems)) dConsole.info(JudgeTag + 'testKmItems', JSON.stringify(this.kmItems))
this.isExamEnd = false; this.isExamEnd = false;
} }
@ -765,7 +766,7 @@ export default class Judge {
initInfo.sharps = km3Config.sharps initInfo.sharps = km3Config.sharps
} }
// 获取科目三的评判配置 // 获取科目三的评判配置
console.info(JudgeTag, '3.获取评判初始化数据完成') dConsole.info(JudgeTag, '3.获取评判初始化数据完成')
return initInfo return initInfo
} }
@ -845,7 +846,7 @@ export default class Judge {
mfxx: false, mfxx: false,
mfxxn: false mfxxn: false
} }
console.info(JudgeTag, '5.获取开始考试数据完成') dConsole.info(JudgeTag, '5.获取开始考试数据完成')
return beginInfo return beginInfo
} }
//处理评判过程回调 //处理评判过程回调
@ -981,7 +982,7 @@ export default class Judge {
//项目取消 //项目取消
case 6: { case 6: {
console.info(JudgeTag, '项目取消'); dConsole.info(JudgeTag, '项目取消');
const xmdm = xmqx.xmdm; const xmdm = xmqx.xmdm;
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
// const examSubject = this.judgeUI.examSubject // const examSubject = this.judgeUI.examSubject
@ -1107,13 +1108,13 @@ export default class Judge {
//项目已考不上传监管信息 //项目已考不上传监管信息
if (!isEnd) { if (!isEnd) {
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(JudgeTag, `项目开始-${xmdm}-${project.name}`) dConsole.info(JudgeTag, `项目开始-${xmdm}-${project.name}`)
await beginProject(xmdm) await beginProject(xmdm)
}, { }, {
isDelay: true isDelay: true
}) })
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(JudgeTag, `项目-${xmdm}-上传照片 start`) dConsole.info(JudgeTag, `项目-${xmdm}-上传照片 start`)
await uploadProgressPhoto(xmdm) await uploadProgressPhoto(xmdm)
}, { }, {
isDelay: true isDelay: true
@ -1135,10 +1136,10 @@ export default class Judge {
const isStart = await this.checkProjectIsStart(xmdm, 1); const isStart = await this.checkProjectIsStart(xmdm, 1);
if (isStart) { if (isStart) {
//项目结束了就不再生成数据 //项目结束了就不再生成数据
console.info(JudgeTag + ' projectIsEnd =>', projectIsEnd) dConsole.info(JudgeTag + ' projectIsEnd =>', projectIsEnd)
if (!projectIsEnd) { if (!projectIsEnd) {
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(JudgeTag, `项目结束-${xmdm}-${project.name}`) dConsole.info(JudgeTag, `项目结束-${xmdm}-${project.name}`)
await endProject(xmdm); await endProject(xmdm);
this.xmmcSingleCode = '0'; this.xmmcSingleCode = '0';
this.xmmcEndCode = undefined; this.xmmcEndCode = undefined;
@ -1159,7 +1160,7 @@ export default class Judge {
// 扣分 // 扣分
case 3: case 3:
console.info('surenjun', '扣分开始') dConsole.info('surenjun', '扣分开始')
//扣分时实时播报语音0-否+1-是) //扣分时实时播报语音0-否+1-是)
const currentKf = kf[kfLen -1]; const currentKf = kf[kfLen -1];
if (JudgeConfig.kfVoiceOpen || (examSubject == '2' && judgeConfigObj['618'] == '1') || if (JudgeConfig.kfVoiceOpen || (examSubject == '2' && judgeConfigObj['618'] == '1') ||
@ -1170,7 +1171,7 @@ export default class Judge {
const isStart = await checkProjectIsStart(Number(currentKf.xmdm), 2, currentKf); const isStart = await checkProjectIsStart(Number(currentKf.xmdm), 2, currentKf);
if (isStart) { if (isStart) {
await judgeTask.addTask(async () => { await judgeTask.addTask(async () => {
console.info(JudgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`) dConsole.info(JudgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`)
await pointsDedute(Number(currentKf.xmdm), currentKf) await pointsDedute(Number(currentKf.xmdm), currentKf)
}, { }, {
isDelay: true isDelay: true
@ -1184,14 +1185,14 @@ export default class Judge {
// 考试结束 // 考试结束
case 5: case 5:
console.info(JudgeTag, '考试结束') dConsole.info(JudgeTag, '考试结束')
//关闭录像 //关闭录像
const singlePlay = AppStorage.get<boolean>('singlePlay') const singlePlay = AppStorage.get<boolean>('singlePlay')
if (!singlePlay && this.videoData) { if (!singlePlay && this.videoData) {
await endRecordVideo(this.videoData) await endRecordVideo(this.videoData)
} }
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(JudgeTag, '考试结束 start') dConsole.info(JudgeTag, '考试结束 start')
AppStorage.setOrCreate('isJudge', false) AppStorage.setOrCreate('isJudge', false)
await handEndExam() await handEndExam()
}) })
@ -1287,20 +1288,20 @@ export default class Judge {
jkid: '17C53', jkid: '17C53',
drvexam drvexam
} }
// console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm) // dConsole.info(judgeTag + 'ksxm=>', data.drvexam.ksxm)
const temp = await this.sendWriteObjectOut(data, filePath); const temp = await this.sendWriteObjectOut(data, filePath);
if (temp.code == 2300007) { if (temp.code == 2300007) {
this.isJudgeDisConnect = true this.isJudgeDisConnect = true
} }
console.info(JudgeTag, '项目扣分 end') dConsole.info(JudgeTag, '项目扣分 end')
UploadRegulatoryCodeConversion('17C53', temp?.code || 0) UploadRegulatoryCodeConversion('17C53', temp?.code || 0)
} }
// 评判语音提示 // 评判语音提示
goJudgeVoice = async (sound: JudgeSound) => { goJudgeVoice = async (sound: JudgeSound) => {
const avPlayer = this.avPlayer const avPlayer = this.avPlayer
const fileLog = this.fileLog const fileLog = this.fileLog
console.info('surenjun code=>', JSON.stringify(sound.code)) dConsole.info('surenjun code=>', JSON.stringify(sound.code))
//判断是不是模拟灯光语音 //判断是不是模拟灯光语音
if (sound.type == 1) { if (sound.type == 1) {
avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`], false, () => { avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`], false, () => {
@ -1376,7 +1377,7 @@ export default class Judge {
// TODO globalThis.judgeUdp.send(bytes) // TODO globalThis.judgeUdp.send(bytes)
} }
} catch (e) { } catch (e) {
console.info(JudgeTag, JSON.stringify(e)) dConsole.info(JudgeTag, JSON.stringify(e))
} }
await endExam() await endExam()
}); });
@ -1452,7 +1453,7 @@ export default class Judge {
this.judgeUI.loadingPopupVisible = false; this.judgeUI.loadingPopupVisible = false;
return return
} }
console.info(JudgeTag, '考试结束 end') dConsole.info(JudgeTag, '考试结束 end')
const param302: string = Reflect.get(judgeConfigObj, '302') const param302: string = Reflect.get(judgeConfigObj, '302')
judgeUI.loadingPopupVisible = true; judgeUI.loadingPopupVisible = true;
let currentKssycs = '0'; let currentKssycs = '0';
@ -1512,7 +1513,7 @@ export default class Judge {
USER[0].kssycs = currentKssycs USER[0].kssycs = currentKssycs
await SqlInsertTable('USER', USER) await SqlInsertTable('USER', USER)
console.info(JudgeTag, `考试成绩:${totalScore}`) dConsole.info(JudgeTag, `考试成绩:${totalScore}`)
if (!singlePlay) { if (!singlePlay) {
// await uploadProgressData(); // await uploadProgressData();
} }
@ -1547,7 +1548,7 @@ export default class Judge {
} }
}) })
} catch (e) { } catch (e) {
console.info(JudgeTag, JSON.stringify(e)) dConsole.info(JudgeTag, JSON.stringify(e))
} }
}) })
} else { } else {
@ -1795,10 +1796,10 @@ export default class Judge {
} }
}) })
console.info(JudgeTag, '项目状态projectsObj:' + JSON.stringify(projectsObj)); dConsole.info(JudgeTag, '项目状态projectsObj:' + JSON.stringify(projectsObj));
console.info(JudgeTag, '所有考试项目数量:' + allProjectNum) dConsole.info(JudgeTag, '所有考试项目数量:' + allProjectNum)
console.info(JudgeTag, '必考项目数量:' + projectNum) dConsole.info(JudgeTag, '必考项目数量:' + projectNum)
console.info(JudgeTag, '必考项目已考数量:' + endProjectsNum) dConsole.info(JudgeTag, '必考项目已考数量:' + endProjectsNum)
//必考项目除靠边停车是否全部完成 //必考项目除靠边停车是否全部完成
this.judgeUI.isRequiredProjectsEnd = (projectNum - endProjectsNum === 0) this.judgeUI.isRequiredProjectsEnd = (projectNum - endProjectsNum === 0)
this.judgeUI.isAllProjectsEnd = (allProjectNum - allEndProjectsNum === 0) this.judgeUI.isAllProjectsEnd = (allProjectNum - allEndProjectsNum === 0)
@ -1873,13 +1874,13 @@ export default class Judge {
strArr = str.split('\n') strArr = str.split('\n')
} }
//日志回调 //日志回调
console.info(JudgeTag, '1.进入评判入口') dConsole.info(JudgeTag, '1.进入评判入口')
await examJudgeSetLogCallback(3, async (level: number, info: string, len: number) => { await examJudgeSetLogCallback(3, async (level: number, info: string, len: number) => {
console.log(JudgeTag, '评判日志:' + info) dConsole.log(JudgeTag, '评判日志:' + info)
await fileLog?.setExamJudgeLogData(info); await fileLog?.setExamJudgeLogData(info);
}) })
console.info(JudgeTag, '2.注册日志回调完成') dConsole.info(JudgeTag, '2.注册日志回调完成')
let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData(); let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData();
await fileLog?.setExamJudgeData(JSON.stringify(initInfo)) await fileLog?.setExamJudgeData(JSON.stringify(initInfo))
@ -1887,18 +1888,18 @@ export default class Judge {
if (!isJudgeInitBool) { if (!isJudgeInitBool) {
const tempJudge = await examJudgeInit(initInfo); const tempJudge = await examJudgeInit(initInfo);
AppStorage.setOrCreate('isJudgeInitBool', true) AppStorage.setOrCreate('isJudgeInitBool', true)
console.info(JudgeTag, '4.评判初始化完成') dConsole.info(JudgeTag, '4.评判初始化完成')
} }
AppStorage.setOrCreate('isJudge', true) AppStorage.setOrCreate('isJudge', true)
// 2.评判过程回调 // 2.评判过程回调
await examJudgeSetRealExamCallback(async (strData: string, len: number) => { await examJudgeSetRealExamCallback(async (strData: string, len: number) => {
await fileLog?.setExamJudgeCallbackData(strData) await fileLog?.setExamJudgeCallbackData(strData)
console.info('评判回调数据', strData) dConsole.info('评判回调数据', strData)
this.handleRealExam(strData, callBack) this.handleRealExam(strData, callBack)
}) })
await examJudgeSetPerformCallback(async (info: string) => { await examJudgeSetPerformCallback(async (info: string) => {
console.info('评判实时数据', info) dConsole.info('评判实时数据', info)
const performInfo: JudgePerformInfo = JSON.parse(info) const performInfo: JudgePerformInfo = JSON.parse(info)
this.performInfo = performInfo this.performInfo = performInfo
const jl = Math.floor((performInfo.qjjl + performInfo.dcjl) / 100); const jl = Math.floor((performInfo.qjjl + performInfo.dcjl) / 100);
@ -1922,7 +1923,7 @@ export default class Judge {
if (beginExamInfo) { if (beginExamInfo) {
await examJudgeBeginExam(beginExamInfo); await examJudgeBeginExam(beginExamInfo);
} }
console.info(JudgeTag, '6.开始考试注册完成') dConsole.info(JudgeTag, '6.开始考试注册完成')
avPlayer?.playAudio([judgeUI.singlePlay ? 'voice/ksks.wav' : 'voice/监管成功.mp3']) avPlayer?.playAudio([judgeUI.singlePlay ? 'voice/ksks.wav' : 'voice/监管成功.mp3'])
if (!judgeUI.singlePlay) { if (!judgeUI.singlePlay) {
@ -1948,7 +1949,7 @@ export default class Judge {
} }
// 处理实时udp里的plc信号 // 处理实时udp里的plc信号
DifferentialAndSignal.onMsg((data: string) => { DifferentialAndSignal.onMsg((data: string) => {
console.info(JudgeTag, 'socketTag[PLC.UdpClient]', '收到udp回调数据') dConsole.info(JudgeTag, 'socketTag[PLC.UdpClient]', '收到udp回调数据')
handleUdp(data) handleUdp(data)
//TODO UDP修改 //TODO UDP修改
// const udpIndex = globalThis.udpIndex; // const udpIndex = globalThis.udpIndex;
@ -1964,16 +1965,16 @@ export default class Judge {
// this.checkExamIsEnd(true); // this.checkExamIsEnd(true);
// }) // })
console.info(JudgeTag, JSON.stringify(manualMarkRules)) dConsole.info(JudgeTag, JSON.stringify(manualMarkRules))
//TODO 监听远程扣分 //TODO 监听远程扣分
// globalThis.udpEvent.onKfExam(async (content:JudgeUdpKf) => { // globalThis.udpEvent.onKfExam(async (content:JudgeUdpKf) => {
// console.info('评判收到远程扣分项目内容' + JSON.stringify(content)) // dConsole.info('评判收到远程扣分项目内容' + JSON.stringify(content))
// const kfxh = content.data.kfxh; // const kfxh = content.data.kfxh;
// const directives = content.data.directives; // const directives = content.data.directives;
// console.info(judgeTag, '评判收到远程扣分项目内容,扣分序号:' + `kfxh=>${kfxh}; directives=>${directives}`) // dConsole.info(judgeTag, '评判收到远程扣分项目内容,扣分序号:' + `kfxh=>${kfxh}; directives=>${directives}`)
// //根据扣分序号找扣分代码 // //根据扣分序号找扣分代码
// const currentKf:MarkRule = manualMarkRules.filter(mark => mark.kfxh == kfxh)[0]; // const currentKf:MarkRule = manualMarkRules.filter(mark => mark.kfxh == kfxh)[0];
// console.info(judgeTag, '扣分项目:' + JSON.stringify(currentKf)) // dConsole.info(judgeTag, '扣分项目:' + JSON.stringify(currentKf))
// this.setJudgeMark(String(currentKf.itemno), currentKf.markserial, 2); // this.setJudgeMark(String(currentKf.itemno), currentKf.markserial, 2);
// //TODO // //TODO
// //globalThis.judgeUdp.confirmKf(directives, 1) // //globalThis.judgeUdp.confirmKf(directives, 1)

View File

@ -2,25 +2,26 @@ import zlib from '@ohos.zlib';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import FileUtils from '../../../utils/FileUtils'; import FileUtils from '../../../utils/FileUtils';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { dConsole } from '../../../utils/LogWorker';
interface Options{ interface Options {
level:number level: number
memLevel:number memLevel: number
strategy:number strategy: number
} }
export default class FileModel { export default class FileModel {
public folderPath?: string public folderPath?: string
//后续文件路径待替换
private fileUtil?: FileUtils
// 设置文件夹 // 设置文件夹
public initFolder = async () => { public initFolder = async () => {
await this.fileUtil?.initFolder(`/models/model_enc`); await this.fileUtil?.initFolder(`/models/model_enc`);
const folderPath = await this.fileUtil?.initFolder(`/models`); const folderPath = await this.fileUtil?.initFolder(`/models`);
this.folderPath = folderPath; this.folderPath = folderPath;
} }
//后续文件路径待替换
private fileUtil?: FileUtils
constructor(context:common.UIAbilityContext) { constructor(context: common.UIAbilityContext) {
(async () => { (async () => {
const fileUtil = new FileUtils(context) const fileUtil = new FileUtils(context)
this.fileUtil = fileUtil this.fileUtil = fileUtil
@ -29,11 +30,11 @@ export default class FileModel {
} }
// 存储zip文件并解压 // 存储zip文件并解压
public storingFiles = async (str:string) => { public storingFiles = async (str: string) => {
await this.fileUtil?.editFile(`${this.folderPath}/model.zip`, str) await this.fileUtil?.editFile(`${this.folderPath}/model.zip`, str)
const folderPath = this.folderPath const folderPath = this.folderPath
let options:Options = { let options: Options = {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION,
memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT, memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT,
strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY
@ -44,18 +45,18 @@ export default class FileModel {
`${folderPath}/model.zip`, `${folderPath}/model.zip`,
`${folderPath}`, `${folderPath}`,
options).then((data) => { options).then((data) => {
console.log("unzipFile result" + data); dConsole.log("unzipFile result" + data);
}) })
}catch (err) { } catch (err) {
console.log("catch((err)=>" + err); dConsole.log("catch((err)=>" + err);
} }
} }
//获取文件内容 //获取文件内容
public getModelContent = (folderPath:string, fileName:string) => { public getModelContent = (folderPath: string, fileName: string) => {
try { try {
return this.fileUtil?.getFileContent(`${folderPath}/${fileName}`); return this.fileUtil?.getFileContent(`${folderPath}/${fileName}`);
} catch (e) { } catch (e) {
console.info('surenjun', JSON.stringify(e)); dConsole.info('surenjun', JSON.stringify(e));
promptAction.showToast({ promptAction.showToast({
message: `请检查模型路径${folderPath}/${fileName}是否正确!`, message: `请检查模型路径${folderPath}/${fileName}是否正确!`,
duration: 4000 duration: 4000

View File

@ -1,9 +1,10 @@
import { takePhoto } from '../../../utils/Video'; import { takePhoto } from '../../../utils/Video';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { JudgeConfig } from "../../../config"; import { JudgeConfig } from '../../../config';
import FileUtils from '../../../utils/FileUtils'; import FileUtils from '../../../utils/FileUtils';
import { VideoConfig } from '../../../model/Common'; import { VideoConfig } from '../../../model/Common';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { dConsole } from '../../../utils/LogWorker';
export default class FilePhoto { export default class FilePhoto {
private params!: VideoConfig private params!: VideoConfig
@ -13,12 +14,12 @@ export default class FilePhoto {
return '' return ''
} else { } else {
try { try {
console.info('surenjun', '拍照开始') dConsole.info('surenjun', '拍照开始')
const res = await takePhoto(this.params, this.context, 'pz/', 2); const res = await takePhoto(this.params, this.context, 'pz/', 2);
console.info('surenjun', '拍照结束' + JSON.stringify(res)) dConsole.info('surenjun', '拍照结束' + JSON.stringify(res))
return res.base64 return res.base64
} catch (e) { } catch (e) {
console.error('surenjun =>拍照异常' + JSON.stringify(e)) dConsole.error('surenjun =>拍照异常' + JSON.stringify(e))
promptAction.showToast({ promptAction.showToast({
message: '拍照异常,请联系工程人员!', message: '拍照异常,请联系工程人员!',
duration: 2000 duration: 2000

View File

@ -3,6 +3,7 @@ import Prompt from '@system.prompt';
import mediaLibrary from '@ohos.multimedia.mediaLibrary'; import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
import { dConsole } from '../../../utils/LogWorker';
const TAG = 'VoiceAnnounce' const TAG = 'VoiceAnnounce'
@ -29,7 +30,7 @@ export default class VoiceAnnounce {
async playAudio(urls: string[], shit?: boolean, callbackFn?: Function) { async playAudio(urls: string[], shit?: boolean, callbackFn?: Function) {
const isStopped = this.isStopped; const isStopped = this.isStopped;
const queue = this.queue; const queue = this.queue;
console.log(TAG, "播放") dConsole.log(TAG, "播放")
const tempUrls: Queue[] = urls.map((url, index) => { const tempUrls: Queue[] = urls.map((url, index) => {
const callback: Function | undefined = (index === urls.length - 1) ? callbackFn : undefined const callback: Function | undefined = (index === urls.length - 1) ? callbackFn : undefined
@ -48,10 +49,10 @@ export default class VoiceAnnounce {
if (queue.length) { if (queue.length) {
//队列续上 //队列续上
this.queue = this.queue.concat(tempUrls) this.queue = this.queue.concat(tempUrls)
// console.info(TAG,'语音队列开始'+shit + JSON.stringify( this.queue)) // dConsole.info(TAG,'语音队列开始'+shit + JSON.stringify( this.queue))
} else { } else {
this.queue = tempUrls this.queue = tempUrls
// console.info(TAG,'语音队列开始' + shit+JSON.stringify( this.queue)) // dConsole.info(TAG,'语音队列开始' + shit+JSON.stringify( this.queue))
await this.executeQueue() await this.executeQueue()
} }
} }
@ -69,11 +70,11 @@ export default class VoiceAnnounce {
await go() await go()
return return
} }
console.info(TAG, '当前播放队列' + JSON.stringify(queue)) dConsole.info(TAG, '当前播放队列' + JSON.stringify(queue))
await avPlayer.play(queue[0].url, queue[0].callback || (() => { await avPlayer.play(queue[0].url, queue[0].callback || (() => {
})); }));
this.queue.shift(); this.queue.shift();
console.info(TAG, '当前播放队列播放完成退出'); dConsole.info(TAG, '当前播放队列播放完成退出');
avPlayer.avPlayerStop(); avPlayer.avPlayerStop();
if (this.queue.length) { if (this.queue.length) {
await go() await go()
@ -95,24 +96,24 @@ class AVPlayer {
// 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例 // 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
async play(name: string, callback: Function): Promise<boolean> { async play(name: string, callback: Function): Promise<boolean> {
console.log(TAG, 'play => 开始播放语音') dConsole.log(TAG, 'play => 开始播放语音')
try { try {
//检查SD中的语音 //检查SD中的语音
// console.info('surenjun name',name) // dConsole.info('surenjun name',name)
// console.info('surenjun name',name.split('/')[1]) // dConsole.info('surenjun name',name.split('/')[1])
let playSrc = await this.queryFile(name.split('/')[1]); let playSrc = await this.queryFile(name.split('/')[1]);
let fdPath = await playSrc.open('r') let fdPath = await playSrc.open('r')
let audioPlayer = media.createAudioPlayer() let audioPlayer = media.createAudioPlayer()
// console.info('surenjun fdPath=>',fdPath) // dConsole.info('surenjun fdPath=>',fdPath)
console.info(TAG, 'audioPlayer => 准备加载资源播放') dConsole.info(TAG, 'audioPlayer => 准备加载资源播放')
audioPlayer.on('dataLoad', () => { audioPlayer.on('dataLoad', () => {
// this.voiceStatus = 'playing' // this.voiceStatus = 'playing'
console.info(TAG, 'audioPlayer => 播放资源开始') dConsole.info(TAG, 'audioPlayer => 播放资源开始')
audioPlayer.play() audioPlayer.play()
}) })
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
audioPlayer.on('finish', () => { audioPlayer.on('finish', () => {
console.info(TAG, 'audioPlayer => 播放资源播放') dConsole.info(TAG, 'audioPlayer => 播放资源播放')
// this.voiceStatus = 'completed' // this.voiceStatus = 'completed'
if (callback) { if (callback) {
callback() callback()
@ -179,7 +180,7 @@ class AVPlayer {
// 注册avplayer回调函数 // 注册avplayer回调函数
setAVPlayerCallback(callBack: Function) { setAVPlayerCallback(callBack: Function) {
this.avPlayer!.on('error', (err: BusinessError) => { this.avPlayer!.on('error', (err: BusinessError) => {
console.log(TAG, '播放器错误', JSON.stringify(err)) dConsole.log(TAG, '播放器错误', JSON.stringify(err))
this.avPlayer && this.avPlayer.stop() this.avPlayer && this.avPlayer.stop()
this.avPlayer && this.avPlayer.reset() this.avPlayer && this.avPlayer.reset()
this.avPlayer && this.avPlayer.release() this.avPlayer && this.avPlayer.release()
@ -196,7 +197,7 @@ class AVPlayer {
this.avPlayer!.prepare() this.avPlayer!.prepare()
break; break;
case 'prepared': // prepare调用成功后上报该状态机 case 'prepared': // prepare调用成功后上报该状态机
console.info(TAG, '播放资源播放') dConsole.info(TAG, '播放资源播放')
this.avPlayer!.play(); this.avPlayer!.play();
// this.voiceStatus = 'playing' // this.voiceStatus = 'playing'
break; break;
@ -210,7 +211,7 @@ class AVPlayer {
break; break;
case 'stopped': // stop接口成功调用后触发该状态机上报 case 'stopped': // stop接口成功调用后触发该状态机上报
this.avPlayer!.reset(); // 调用reset接口初始化avplayer状态 this.avPlayer!.reset(); // 调用reset接口初始化avplayer状态
console.info(TAG, '播放资源释放') dConsole.info(TAG, '播放资源释放')
if (endCallback) { if (endCallback) {
endCallback() endCallback()
} }