Merge branch 'main' into lv_chengmai
This commit is contained in:
commit
d04828c5b4
@ -2,7 +2,7 @@ import request from "../common/utils/request"
|
|||||||
import { getCurrentTime } from '../common/utils/tools'
|
import { getCurrentTime } from '../common/utils/tools'
|
||||||
import { getSyncData } from '../common/service/initable';
|
import { getSyncData } from '../common/service/initable';
|
||||||
import writeObjectOutNew from './judgeNew'
|
import writeObjectOutNew from './judgeNew'
|
||||||
import FileLog from '../pages/judgeSDK/utils/fileLog';
|
import FileUtil from '../common/utils/File';
|
||||||
let baseHost = globalThis.host;
|
let baseHost = globalThis.host;
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ export async function download() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 通用监管接口
|
// 通用监管接口
|
||||||
export async function writeObjectOut(params): Promise<number> {
|
export async function writeObjectOut(params,filePath?:string): Promise<number> {
|
||||||
const singlePlay = globalThis.singlePlay
|
const singlePlay = globalThis.singlePlay
|
||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
return 1
|
return 1
|
||||||
@ -40,14 +40,18 @@ export async function writeObjectOut(params): Promise<number> {
|
|||||||
const {xtlb,jkxlh,jkid,drvexam} = params;
|
const {xtlb,jkxlh,jkid,drvexam} = params;
|
||||||
//新监管调用
|
//新监管调用
|
||||||
if (globalThis.isJGNew) {
|
if (globalThis.isJGNew) {
|
||||||
return await writeObjectOutNew(params)
|
return await writeObjectOutNew(params,filePath)
|
||||||
|
}
|
||||||
|
const drvexamArrs = Reflect.ownKeys(drvexam).map((key: string) => (`<${key}>${drvexam[key]}</${key}>`));
|
||||||
|
|
||||||
|
if(filePath){
|
||||||
|
const fileUtil = new FileUtil(globalThis.context);
|
||||||
|
await fileUtil.initFolder(filePath);
|
||||||
|
fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({
|
||||||
|
xtlb,jkxlh,jkid,drvexam
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileLog = new FileLog(globalThis.context)
|
|
||||||
const drvexamArrs = Reflect.ownKeys(drvexam).map((key: string) => (`<${key}>${drvexam[key]}</${key}>`));
|
|
||||||
fileLog.setExamJudgeWuxiData(JSON.stringify({
|
|
||||||
xtlb,jkxlh,jkid,drvexam
|
|
||||||
}))
|
|
||||||
//对象转换成xml
|
//对象转换成xml
|
||||||
const temp = await request({
|
const temp = await request({
|
||||||
host: globalThis.JGHOST,
|
host: globalThis.JGHOST,
|
||||||
@ -116,7 +120,6 @@ export async function uploadExamMileage(params) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const time = await getCurrentTime()
|
const time = await getCurrentTime()
|
||||||
|
|
||||||
return await request({
|
return await request({
|
||||||
url: '/der2/services/exam/uploadExamMileage.ws',
|
url: '/der2/services/exam/uploadExamMileage.ws',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8"?>
|
data: `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { getSyncData } from '../common/service/initable';
|
import { getSyncData } from '../common/service/initable';
|
||||||
import request from "../common/utils/request"
|
import request from "../common/utils/request"
|
||||||
let baseHost = globalThis.host;
|
let baseHost = globalThis.host;
|
||||||
|
import FileUtil from '../common/utils/File';
|
||||||
import FileLog from '../pages/judgeSDK/utils/fileLog';
|
import FileLog from '../pages/judgeSDK/utils/fileLog';
|
||||||
|
|
||||||
//新监管接口
|
//新监管接口
|
||||||
@ -16,12 +17,20 @@ const gjxlhObj = {
|
|||||||
'17C56': '02-21-000014',
|
'17C56': '02-21-000014',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function writeObjectOutNew(data): Promise<number> {
|
export default async function writeObjectOutNew(data,filePath): Promise<number> {
|
||||||
|
const fileUtil = new FileUtil(globalThis.context);
|
||||||
const {jkid , drvexam} = data;
|
const {jkid , drvexam} = data;
|
||||||
const basic = await getBasicConfig(jkid);
|
const basic = await getBasicConfig(jkid);
|
||||||
const params = await getParams(jkid, drvexam);
|
const params = await getParams(jkid, drvexam);
|
||||||
const {wglb,jkxlh,glbm,jgbh,sjbs} = basic;
|
const {wglb,jkxlh,glbm,jgbh,sjbs} = basic;
|
||||||
|
|
||||||
|
console.info('surenjun filePath=>',filePath)
|
||||||
|
fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({
|
||||||
|
wglb,jkxlh,glbm,jgbh,sjbs,
|
||||||
|
data:params.data,
|
||||||
|
file:params.file,
|
||||||
|
}));
|
||||||
|
|
||||||
return await request({
|
return await request({
|
||||||
host: globalThis.JGHOST,
|
host: globalThis.JGHOST,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import promptAction from '@ohos.promptAction'
|
import promptAction from '@ohos.promptAction'
|
||||||
|
import router from '@ohos.router'
|
||||||
import { dateFormat } from '../utils/tools'
|
import { dateFormat } from '../utils/tools'
|
||||||
import FileUtil from '../../common/utils/File'
|
import FileUtil from '../../common/utils/File'
|
||||||
|
import AccountTable from '../../common/database/tables/AccountTable'
|
||||||
|
import MA_SYSSET from '../../common/constants/MA_SYSSET'
|
||||||
import { takePhoto } from '../../common/service/videoService'
|
import { takePhoto } from '../../common/service/videoService'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -102,28 +105,8 @@ export async function getDoubleCeneterTable(param) {
|
|||||||
'MA_ITEMINFO': false,
|
'MA_ITEMINFO': false,
|
||||||
'MA_T_CARPARMSET': false
|
'MA_T_CARPARMSET': false
|
||||||
}
|
}
|
||||||
const name = {
|
|
||||||
'MA_MARKRULE': 'MA_MARKRULE',
|
|
||||||
'MA_SYSTEMPARM': 'MA_SYSTEMPARM',
|
|
||||||
'MA_MAP_COLLECT': 'MA_MAP_COLLECT',
|
|
||||||
'MA_MAP_COLLECT_SHAPE': 'MA_MAP_COLLECT_SHAPE',
|
|
||||||
'MA_MAP_ITEMCLASS': 'MA_MAP_ITEMCLASS',
|
|
||||||
'MA_MAP_POINT': 'MA_MAP_POINT',
|
|
||||||
'MA_MAP_POINT_ITEM': 'MA_MAP_POINT_ITEM',
|
|
||||||
'MA_MAP_ROAD': 'MA_MAP_ROAD',
|
|
||||||
'MA_MAP_ROAD_LANE': 'MA_MAP_ROAD_LANE',
|
|
||||||
'MA_MAP_SUBITEM': 'MAP_SUBITEM',
|
|
||||||
'ES_CARINFO': 'ES_CARINFO',
|
|
||||||
'ES_EXAMPOINTDETAIL': 'ES_EXAMPOINTDETAIL',
|
|
||||||
'MA_MARKRULESET': 'MA_MARKRULESET',
|
|
||||||
'ES_CAR_VIDEO_PARAMETER': 'ES_CAR_VIDEO_PARAMETER',
|
|
||||||
'MA_CDSBINFO': 'MA_CDSBINFO',
|
|
||||||
'MA_ITEMINFO': 'MA_ITEMINFO',
|
|
||||||
'MA_T_CARPARMSET': 'MA_T_CARPARMSET'
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let key in typeObj) {
|
for (let key in typeObj) {
|
||||||
typeObj[key] = await upDateTable({ tableName: name[key] }, param)
|
typeObj[key] = await upDateTable({ tableName: key }, param)
|
||||||
if (!typeObj[key]) {
|
if (!typeObj[key]) {
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
message: `未能查询到${key}表数据, 请先检查网络是否连接正常`,
|
message: `未能查询到${key}表数据, 请先检查网络是否连接正常`,
|
||||||
@ -134,9 +117,9 @@ export async function getDoubleCeneterTable(param) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
reslove(true)
|
reslove(true)
|
||||||
// router.pushUrl({
|
router.pushUrl({
|
||||||
// url: 'pages/ExaminerLogin',
|
url: 'pages/ExaminerLogin',
|
||||||
// }, router.RouterMode.Single);
|
}, router.RouterMode.Single);
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,7 +191,6 @@ export default class FileUtil{
|
|||||||
const {absolutePath} = this;
|
const {absolutePath} = this;
|
||||||
const { READ_WRITE }= fs.OpenMode
|
const { READ_WRITE }= fs.OpenMode
|
||||||
const path = `${absolutePath}/${filePath}`
|
const path = `${absolutePath}/${filePath}`
|
||||||
let file = fs.openSync(path, READ_WRITE);
|
|
||||||
const str = fs.readTextSync(path);
|
const str = fs.readTextSync(path);
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,6 +125,7 @@ export default class UdpClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMessage(callback?) {
|
onMessage(callback?) {
|
||||||
|
console.info(TAG, '注册udp message监听事件')
|
||||||
this.udp.on('message', value => {
|
this.udp.on('message', value => {
|
||||||
console.log(TAG,'udponmessage')
|
console.log(TAG,'udponmessage')
|
||||||
// 收到的是ArrayBuffer 需要进行转换解析
|
// 收到的是ArrayBuffer 需要进行转换解析
|
||||||
@ -160,14 +161,12 @@ export default class UdpClient {
|
|||||||
console.log('messageTimeEnd')
|
console.log('messageTimeEnd')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const arrRed = [0x55, 0xaa, 0x01, 0x01, 0x02, 0x00, 0x03, 0x00];
|
const arrRed = [0x55, 0xaa, 0x01, 0x01, 0x02, 0x00, 0x03, 0x00];
|
||||||
const arrBlue = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00];
|
const arrBlue = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00];
|
||||||
const arrGreen = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x00, 0x03, 0x01];
|
const arrGreen = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x00, 0x03, 0x01];
|
||||||
const arrBlueBuffer = Array2Byte(arrBlue).buffer
|
const arrBlueBuffer = Array2Byte(arrBlue).buffer
|
||||||
const arrRedBuffer = Array2Byte(arrRed).buffer
|
const arrRedBuffer = Array2Byte(arrRed).buffer
|
||||||
const arrGreenBugger = Array2Byte(arrGreen).buffer
|
const arrGreenBugger = Array2Byte(arrGreen).buffer
|
||||||
|
|
||||||
//监听udp是否断开
|
//监听udp是否断开
|
||||||
clearInterval(globalThis.messageTimer)
|
clearInterval(globalThis.messageTimer)
|
||||||
globalThis.messageTimer = setInterval(() => {
|
globalThis.messageTimer = setInterval(() => {
|
||||||
@ -229,8 +228,9 @@ export default class UdpClient {
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
interface StashFunction {
|
interface StashFunction {
|
||||||
(str: string)
|
(str: string)
|
||||||
|
|||||||
@ -42,6 +42,8 @@ export default class UdpClientByCenter {
|
|||||||
private isWorking: Boolean = false
|
private isWorking: Boolean = false
|
||||||
private plcUdpError = false;
|
private plcUdpError = false;
|
||||||
private initParam
|
private initParam
|
||||||
|
private onMessage_1Callback:Function = ()=>{}
|
||||||
|
public currentValue:string = ''
|
||||||
|
|
||||||
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
||||||
this.localIp = udplocalIp
|
this.localIp = udplocalIp
|
||||||
@ -257,39 +259,54 @@ export default class UdpClientByCenter {
|
|||||||
|
|
||||||
//plc
|
//plc
|
||||||
onMessage_1(callback?) {
|
onMessage_1(callback?) {
|
||||||
this.udp&&this.udp.on('message', value => {
|
this.onMessage_1Callback = callback;
|
||||||
console.log(TAG, 'udponmessage')
|
this.udp&&this.udp.on('message', this.message_1Fn);
|
||||||
// 收到的是ArrayBuffer 需要进行转换解析
|
}
|
||||||
this.plcUdpError = false
|
|
||||||
if (value) {
|
closeMessage_1(){
|
||||||
let dataView = new DataView(value.message)
|
console.info('surenjun', '关闭udp message监听事件')
|
||||||
let str = ""
|
this.udp.off('message',this.message_1Fn);
|
||||||
for (let i = 0; i < dataView?.byteLength; ++i) {
|
console.info('surenjun', '关闭udp message监听事件 成功')
|
||||||
let c = String.fromCharCode(dataView?.getUint8(i))
|
}
|
||||||
if (c !== "\n") {
|
|
||||||
str += c
|
message_1Fn = (value)=>{
|
||||||
}
|
console.log(TAG, 'udponmessage')
|
||||||
|
let callback = this.onMessage_1Callback
|
||||||
|
// 收到的是ArrayBuffer 需要进行转换解析
|
||||||
|
this.plcUdpError = false
|
||||||
|
if (value) {
|
||||||
|
let dataView = new DataView(value.message)
|
||||||
|
let str = ""
|
||||||
|
for (let i = 0; i < dataView?.byteLength; ++i) {
|
||||||
|
let c = String.fromCharCode(dataView?.getUint8(i))
|
||||||
|
if (c !== "\n") {
|
||||||
|
str += c
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`${TAG} udp on message array buffer:${str}`);
|
|
||||||
let strachArr = str.split(',')
|
|
||||||
if (strachArr[0] != '#DN_GD') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
console.log(`${TAG} udp222 on message array buffer:${str}`);
|
|
||||||
|
|
||||||
strachArr[28] = globalThis.chuankoMsg || '0'
|
|
||||||
// this.stashFn(str)
|
|
||||||
const newArr = JSON.parse(JSON.stringify(strachArr))
|
|
||||||
// this.stashFn=()=>{}
|
|
||||||
callback && callback(newArr.toString())
|
|
||||||
|
|
||||||
} else {
|
|
||||||
callback && callback('')
|
|
||||||
}
|
}
|
||||||
console.log('messageTimeEnd')
|
|
||||||
this.testIfUdpConnetced(callback)
|
console.log(`${TAG} udp on message array buffer:${str}`);
|
||||||
});
|
let strachArr = str.split(',')
|
||||||
|
if (strachArr[0] != '#DN_GD') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log(`${TAG} udp222 on message array buffer:${str}`);
|
||||||
|
|
||||||
|
strachArr[28] = globalThis.chuankoMsg || '0'
|
||||||
|
// this.stashFn(str)
|
||||||
|
const newArr = JSON.parse(JSON.stringify(strachArr))
|
||||||
|
// this.stashFn=()=>{}
|
||||||
|
callback && callback(newArr.toString())
|
||||||
|
this.currentValue = newArr.toString();
|
||||||
|
} else {
|
||||||
|
callback && callback('')
|
||||||
|
}
|
||||||
|
console.log('messageTimeEnd')
|
||||||
|
this.testIfUdpConnetced(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前UDP信号
|
||||||
|
getCurrentMessage = () => {
|
||||||
|
return this.currentValue
|
||||||
}
|
}
|
||||||
|
|
||||||
testIfUdpConnetced(callback) {
|
testIfUdpConnetced(callback) {
|
||||||
|
|||||||
@ -31,13 +31,14 @@ export default async function request(req: any) {
|
|||||||
}
|
}
|
||||||
//params转url拼接参数
|
//params转url拼接参数
|
||||||
let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || '';
|
let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || '';
|
||||||
|
|
||||||
paramsStr = paramsStr.toString();
|
paramsStr = paramsStr.toString();
|
||||||
paramsStr = paramsStr.substring(0, paramsStr.length-1)
|
paramsStr = paramsStr.substring(0, paramsStr.length-1)
|
||||||
try {
|
try {
|
||||||
let baseUrl=host?host:globalThis.host
|
let baseUrl=host?host:globalThis.host
|
||||||
// let baseUrl=host?config.csptHost:config.host'
|
// let baseUrl=host?config.csptHost:config.host'
|
||||||
|
console.log('响应头地址' + paramsStr)
|
||||||
const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options);
|
const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options);
|
||||||
|
console.log('响应头地址' + JSON.stringify(result))
|
||||||
let res:any = xml ? xmlToJson(result,url) : result;
|
let res:any = xml ? xmlToJson(result,url) : result;
|
||||||
console.log('响应头地址' + JSON.stringify(res))
|
console.log('响应头地址' + JSON.stringify(res))
|
||||||
let resObj = null;
|
let resObj = null;
|
||||||
|
|||||||
@ -242,19 +242,25 @@ struct Index {
|
|||||||
systemParm.txt3 = systemParm.TXT3;
|
systemParm.txt3 = systemParm.TXT3;
|
||||||
}
|
}
|
||||||
const {no1,no2,no3,} = systemParm;
|
const {no1,no2,no3,} = systemParm;
|
||||||
|
const txt1 = decodeURI(systemParm.txt1)
|
||||||
|
const txt2 = decodeURI(systemParm.txt2)
|
||||||
//获取当前考车的no2
|
//获取当前考车的no2
|
||||||
if (no1 == 3 && no3 == 1) {
|
if (no1 == 3 && no3 == 1) {
|
||||||
const txt1 = decodeURI(systemParm.txt1)
|
|
||||||
if (txt1 === carName) {
|
if (txt1 === carName) {
|
||||||
carNo = no2
|
carNo = no2
|
||||||
|
console.info('surenjun carNo => ',carNo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//获取及格分数线
|
||||||
|
if(no1 == 3 && no3 == 3 && carNo === no2){
|
||||||
|
this.passingScore = Number(txt1) || 0;
|
||||||
|
}
|
||||||
|
|
||||||
//获取当前考车的考试项目
|
//获取当前考车的考试项目
|
||||||
if (carNo !== '' && no1 == 3 && no2 == carNo && no3 == 10) {
|
if (carNo !== '' && no1 == 3 && no2 == carNo && no3 == 10) {
|
||||||
allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '')
|
allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '')
|
||||||
console.info('surenjun', JSON.stringify(allItems))
|
console.info('surenjun', JSON.stringify(allItems))
|
||||||
}
|
}
|
||||||
const txt2 = decodeURIComponent(systemParm.txt2);
|
|
||||||
if (
|
if (
|
||||||
//科目二获取项目
|
//科目二获取项目
|
||||||
(examSubject == 2 && allItems.length && no1 == 6 && allItems.includes(no2))
|
(examSubject == 2 && allItems.length && no1 == 6 && allItems.includes(no2))
|
||||||
@ -277,6 +283,8 @@ struct Index {
|
|||||||
isRequired: allItems.includes(no2 + ''),
|
isRequired: allItems.includes(no2 + ''),
|
||||||
//是否考过了
|
//是否考过了
|
||||||
isEnd: false,
|
isEnd: false,
|
||||||
|
//项目开始数据是否上传过
|
||||||
|
isUpload:false,
|
||||||
}
|
}
|
||||||
this.projectsObj[no2*1] = currentProject
|
this.projectsObj[no2*1] = currentProject
|
||||||
this.projectsCenterObj[txt2] = currentProject
|
this.projectsCenterObj[txt2] = currentProject
|
||||||
@ -358,6 +366,7 @@ struct Index {
|
|||||||
this.projectsObj[projectCode].type = '3'
|
this.projectsObj[projectCode].type = '3'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.ddxkKsxmArr = ddxkKsxmArr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//扣分续考
|
//扣分续考
|
||||||
@ -381,7 +390,6 @@ struct Index {
|
|||||||
})
|
})
|
||||||
this.totalScore += currentKf.markreal * 1;
|
this.totalScore += currentKf.markreal * 1;
|
||||||
})
|
})
|
||||||
this.ddxkKsxmArr = ddxkKsxmArr
|
|
||||||
this.ddxkKfArr = ddxkKfArr
|
this.ddxkKfArr = ddxkKfArr
|
||||||
this.ddxkTime = Date.parse(startTime);
|
this.ddxkTime = Date.parse(startTime);
|
||||||
this.isDdxk = true
|
this.isDdxk = true
|
||||||
@ -812,31 +820,6 @@ struct Index {
|
|||||||
.margin({ bottom: 20 })
|
.margin({ bottom: 20 })
|
||||||
}.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 })
|
}.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 })
|
||||||
|
|
||||||
//结束考试弹窗
|
|
||||||
if (this.endPopupVisible) {
|
|
||||||
EndPoPup({
|
|
||||||
title: '确定结束考试吗?',
|
|
||||||
cancelFn: () => {
|
|
||||||
this.endPopupVisible = false;
|
|
||||||
},
|
|
||||||
confirmFn: async () => {
|
|
||||||
if (this.judgeConfigObj['344'] == 1) {
|
|
||||||
Prompt.showToast({
|
|
||||||
message: '考试未结束,不允许手动退出!',
|
|
||||||
duration: 4000
|
|
||||||
});
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.endPopupVisible = false;
|
|
||||||
this.loadingPopupVisible = true
|
|
||||||
clearInterval(this.timer);
|
|
||||||
clearInterval(globalThis.judgeTimer)
|
|
||||||
globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
|
||||||
this.judge.checkExamIsEnd(true);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//loading 弹窗
|
//loading 弹窗
|
||||||
if (this.loadingPopupVisible) {
|
if (this.loadingPopupVisible) {
|
||||||
LoadingPopup({
|
LoadingPopup({
|
||||||
@ -902,6 +885,30 @@ struct Index {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//结束考试弹窗
|
||||||
|
if (this.endPopupVisible) {
|
||||||
|
EndPoPup({
|
||||||
|
title: '确定结束考试吗?',
|
||||||
|
cancelFn: () => {
|
||||||
|
this.endPopupVisible = false;
|
||||||
|
},
|
||||||
|
confirmFn: async () => {
|
||||||
|
if (this.judgeConfigObj['344'] == 1) {
|
||||||
|
Prompt.showToast({
|
||||||
|
message: '考试未结束,不允许手动退出!',
|
||||||
|
duration: 4000
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.endPopupVisible = false;
|
||||||
|
this.loadingPopupVisible = true
|
||||||
|
clearInterval(this.timer);
|
||||||
|
clearInterval(globalThis.judgeTimer)
|
||||||
|
globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
||||||
|
this.judge.checkExamIsEnd(true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start)
|
.height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start)
|
||||||
}
|
}
|
||||||
@ -967,7 +974,6 @@ struct Index {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取是否能人工进项目
|
// 获取是否能人工进项目
|
||||||
getIsExitManualProject = (index: number) => {
|
getIsExitManualProject = (index: number) => {
|
||||||
const {
|
const {
|
||||||
@ -1207,4 +1213,5 @@ struct Index {
|
|||||||
//速度
|
//速度
|
||||||
@State sd: string = ''
|
@State sd: string = ''
|
||||||
@State mileageTimer: number = 0;
|
@State mileageTimer: number = 0;
|
||||||
|
@State passingScore: number = 80
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,8 @@ struct Index {
|
|||||||
// '',]
|
// '',]
|
||||||
// @State inputTextList2: string[] = ['192.168.7.124','20022']
|
// @State inputTextList2: string[] = ['192.168.7.124','20022']
|
||||||
|
|
||||||
// @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','172.37.55.1','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122']
|
@State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','172.37.55.1','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122']
|
||||||
@State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122']
|
// @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122']
|
||||||
// @State inputTextList2: string[] = []
|
// @State inputTextList2: string[] = []
|
||||||
// 112.80.35.83 11052
|
// 112.80.35.83 11052
|
||||||
// @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
|
// @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import LoadingPopup from './compontents/judge/LoadingPopup';
|
|||||||
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
||||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||||
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
struct UserInfo {
|
struct UserInfo {
|
||||||
|
|||||||
@ -174,7 +174,7 @@ export default struct SignDisplayCom {
|
|||||||
Text("改正数次数/改正数大小:" + this.signArr[58] || '0')
|
Text("改正数次数/改正数大小:" + this.signArr[58] || '0')
|
||||||
.fontColor('#FFF5E5')
|
.fontColor('#FFF5E5')
|
||||||
.fontSize(14 * this.ratio)
|
.fontSize(14 * this.ratio)
|
||||||
.width('25%')
|
.width('30%')
|
||||||
.textAlign(TextAlign.Start)
|
.textAlign(TextAlign.Start)
|
||||||
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
|
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
|
||||||
}
|
}
|
||||||
@ -222,11 +222,10 @@ export default struct SignDisplayCom {
|
|||||||
Text('纬度:' + this.signArr[96]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
Text('纬度:' + this.signArr[96]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||||
Text('速度:' + this.signArr[97]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
Text('速度:' + this.signArr[97]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||||
}
|
}
|
||||||
// .backgroundColor('red')
|
|
||||||
.backgroundColor('#1A1A1A')
|
.backgroundColor('#1A1A1A')
|
||||||
// .width(180 * this.ratio)
|
.width(138 * this.ratio)
|
||||||
.height(300 * this.ratio)
|
.height(300 * this.ratio)
|
||||||
.position({ y: 0 * this.ratio, x: 700 * this.ratio })
|
.position({ y: 0 * this.ratio, x: 750 * this.ratio })
|
||||||
}.backgroundColor('#282828').width(this.ratio * 890).height(308 * this.ratio).margin({ top: 3 * this.ratio })
|
}.backgroundColor('#282828').width(this.ratio * 890).height(308 * this.ratio).margin({ top: 3 * this.ratio })
|
||||||
}
|
}
|
||||||
.width(936 * this.ratio)
|
.width(936 * this.ratio)
|
||||||
@ -237,26 +236,6 @@ export default struct SignDisplayCom {
|
|||||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||||
.visibility(this.active == 0 ? Visibility.Visible : Visibility.None)
|
.visibility(this.active == 0 ? Visibility.Visible : Visibility.None)
|
||||||
|
|
||||||
Column() {
|
|
||||||
Column() {
|
|
||||||
Text(this.msg)
|
|
||||||
.fontColor('#FFF5E5')
|
|
||||||
.fontSize(14 * this.ratio)
|
|
||||||
}
|
|
||||||
.backgroundColor('#282828')
|
|
||||||
.width(this.ratio * 890)
|
|
||||||
.height(436 * this.ratio)
|
|
||||||
.margin({ left: 0 * this.ratio, top: 15 * this.ratio })
|
|
||||||
|
|
||||||
}
|
|
||||||
.width(936 * this.ratio)
|
|
||||||
.height(480 * this.ratio)
|
|
||||||
.margin({ left: 10 * this.ratio })
|
|
||||||
.padding({ left: 10 * this.ratio, right: 10 * this.ratio })
|
|
||||||
.backgroundImage($r('app.media.km_open'))
|
|
||||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
|
||||||
.visibility(this.active == 2 ? Visibility.Visible : Visibility.None)
|
|
||||||
|
|
||||||
Row() {
|
Row() {
|
||||||
Flex({ direction: FlexDirection.Column }) {
|
Flex({ direction: FlexDirection.Column }) {
|
||||||
Row() {
|
Row() {
|
||||||
@ -328,7 +307,7 @@ export default struct SignDisplayCom {
|
|||||||
|
|
||||||
if (showBack) {
|
if (showBack) {
|
||||||
this.ratio = 1.4
|
this.ratio = 1.4
|
||||||
globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => {
|
globalThis.udpClient.onMessage_1((msg) => {
|
||||||
console.log('msgmsg', msg)
|
console.log('msgmsg', msg)
|
||||||
if (msg) {
|
if (msg) {
|
||||||
getSignal(msg)
|
getSignal(msg)
|
||||||
@ -353,7 +332,7 @@ export default struct SignDisplayCom {
|
|||||||
const that = this
|
const that = this
|
||||||
const showBack = this.showBack;
|
const showBack = this.showBack;
|
||||||
if (showBack) {
|
if (showBack) {
|
||||||
globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => {
|
globalThis.udpClient.onMessage_1((msg) => {
|
||||||
getSignal(msg)
|
getSignal(msg)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -554,7 +554,7 @@ export default struct DeductedPopup {
|
|||||||
}
|
}
|
||||||
.width(1300)
|
.width(1300)
|
||||||
.height(710)
|
.height(710)
|
||||||
.position({ x: '15%', y: '10%' })
|
.position({ x: '10%', y: '10%' })
|
||||||
.backgroundColor('#E6E3DF')
|
.backgroundColor('#E6E3DF')
|
||||||
.padding({ top: 15, bottom: 15, left: 25, right: 25 })
|
.padding({ top: 15, bottom: 15, left: 25, right: 25 })
|
||||||
.borderRadius(20)
|
.borderRadius(20)
|
||||||
|
|||||||
@ -36,6 +36,9 @@ export default struct DeductedPopup {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno + '')));
|
this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno + '')));
|
||||||
this.currentIndex = this.defaultTabIndex
|
this.currentIndex = this.defaultTabIndex
|
||||||
|
if(this.currentIndex == 1){
|
||||||
|
this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 )
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//上一页 下一页
|
//上一页 下一页
|
||||||
|
|||||||
@ -106,6 +106,7 @@ export default class Judge {
|
|||||||
name, lsh, idCard
|
name, lsh, idCard
|
||||||
});
|
});
|
||||||
this.fileLog = fileLog;
|
this.fileLog = fileLog;
|
||||||
|
this.filePath = filePath;
|
||||||
|
|
||||||
const {getJudgeBeginData,handleUdp,fileUtil,handleTrajectoryUdp,isTrajectoryOpen,trajectoryPath,avPlayer} = this;
|
const {getJudgeBeginData,handleUdp,fileUtil,handleTrajectoryUdp,isTrajectoryOpen,trajectoryPath,avPlayer} = this;
|
||||||
const isJudgeInitBool = globalThis.isJudgeInitBool;
|
const isJudgeInitBool = globalThis.isJudgeInitBool;
|
||||||
@ -170,7 +171,9 @@ export default class Judge {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 处理实时udp里的plc信号
|
// 处理实时udp里的plc信号
|
||||||
|
// globalThis.udpClient.closeMessage_1();
|
||||||
globalThis.udpClient.onMessage_1(async (msg) => {
|
globalThis.udpClient.onMessage_1(async (msg) => {
|
||||||
|
console.info('socketTag[PLC.UdpClient]', '收到udp回调数据')
|
||||||
handleUdp(msg)
|
handleUdp(msg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -321,7 +324,6 @@ export default class Judge {
|
|||||||
//项目结束
|
//项目结束
|
||||||
case 2:
|
case 2:
|
||||||
judgeUI.projectsObj[xmdm].type = (xmjs.xmhg === 0 ? '4' : '3');
|
judgeUI.projectsObj[xmdm].type = (xmjs.xmhg === 0 ? '4' : '3');
|
||||||
|
|
||||||
//计算项目是否全部结束
|
//计算项目是否全部结束
|
||||||
this.judgeUI.isProjectIn = (Reflect.ownKeys(judgeUI.projectsObj).filter(
|
this.judgeUI.isProjectIn = (Reflect.ownKeys(judgeUI.projectsObj).filter(
|
||||||
projectKey => judgeUI.projectsObj[projectKey].type == '2').length
|
projectKey => judgeUI.projectsObj[projectKey].type == '2').length
|
||||||
@ -387,7 +389,6 @@ export default class Judge {
|
|||||||
case 9:
|
case 9:
|
||||||
this.judgeUI.lane = lane
|
this.judgeUI.lane = lane
|
||||||
this.lane = lane;
|
this.lane = lane;
|
||||||
console.info(judgeTag + 'lane', JSON.stringify(lane))
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -443,19 +444,19 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
//项目已考不上传监管信息
|
//项目已考不上传监管信息
|
||||||
if (!isEnd) {
|
if (!isEnd) {
|
||||||
await judgeTask.addTask(async () => {
|
judgeTask.addTask(async () => {
|
||||||
console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
|
console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
|
||||||
await beginProject(xmdm)
|
await beginProject(xmdm)
|
||||||
}, {
|
}, {
|
||||||
isDelay: true
|
isDelay: true
|
||||||
})
|
})
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
await judgeTask.addTask(async () => {
|
console.info(judgeTag, `项目-${xmdm}-上传照片 start`)
|
||||||
console.info(judgeTag, '上传照片 start')
|
|
||||||
await uploadProgressPhoto(xmdm)
|
await uploadProgressPhoto(xmdm)
|
||||||
}, {
|
}, {
|
||||||
isDelay: true
|
isDelay: true
|
||||||
})
|
})
|
||||||
|
this.judgeUI.projectsObj[xmdm].isUpload = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -467,18 +468,19 @@ export default class Judge {
|
|||||||
if (!ignoreVoiceCodeArr.includes(endCode) && examSubject == 3) {
|
if (!ignoreVoiceCodeArr.includes(endCode) && examSubject == 3) {
|
||||||
endKmCode && avPlayer.playAudio([`voice/${endKmCode}.mp3`])
|
endKmCode && avPlayer.playAudio([`voice/${endKmCode}.mp3`])
|
||||||
}
|
}
|
||||||
|
|
||||||
const isStart = await checkProjectIsStart(xmdm,1);
|
const isStart = await checkProjectIsStart(xmdm,1);
|
||||||
if(isStart){
|
if(isStart){
|
||||||
//项目结束了就不再生成数据
|
//项目结束了就不再生成数据
|
||||||
|
console.info(judgeTag + ' projectIsEnd =>',projectIsEnd)
|
||||||
if (!projectIsEnd) {
|
if (!projectIsEnd) {
|
||||||
await judgeTask.addTask(async () => {
|
judgeTask.addTask(async () => {
|
||||||
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
|
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
|
||||||
await endProject(xmdm);
|
await endProject(xmdm);
|
||||||
}, {
|
}, {
|
||||||
isDelay: true
|
isDelay: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
judgeUI.projectsObj[xmdm].isEnd = true;
|
judgeUI.projectsObj[xmdm].isEnd = true;
|
||||||
break;
|
break;
|
||||||
@ -487,14 +489,16 @@ export default class Judge {
|
|||||||
// 扣分
|
// 扣分
|
||||||
case 3:
|
case 3:
|
||||||
//扣分时实时播报语音(0-否+1-是)
|
//扣分时实时播报语音(0-否+1-是)
|
||||||
|
const currentKf = kf[kfLen -1];
|
||||||
if (judgeConfigObj['418'] == '1' || judgeConfig.kfVoiceOpen) {
|
if (judgeConfigObj['418'] == '1' || judgeConfig.kfVoiceOpen) {
|
||||||
avPlayer.playAudio([`voice/${kf[kfLen -1].markcatalog}.mp3`])
|
avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`])
|
||||||
}
|
}
|
||||||
const isStart = await checkProjectIsStart(xmdm,2,kf[kfLen -1]);
|
const isStart = await checkProjectIsStart(currentKf.xmdm,2,currentKf);
|
||||||
|
console.info(judgeTag + '扣分 isStart=>',isStart)
|
||||||
if(isStart){
|
if(isStart){
|
||||||
await judgeTask.addTask(async () => {
|
await judgeTask.addTask(async () => {
|
||||||
console.info(judgeTag, `项目扣分-${kf[kfLen -1].markcatalog}-${kf[kfLen -1].desc}`)
|
console.info(judgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`)
|
||||||
await pointsDedute(kf[kfLen -1].xmdm, kf[kfLen -1])
|
await pointsDedute(currentKf.xmdm, currentKf)
|
||||||
}, {
|
}, {
|
||||||
isDelay: true
|
isDelay: true
|
||||||
})
|
})
|
||||||
@ -508,7 +512,7 @@ export default class Judge {
|
|||||||
// 考试结束
|
// 考试结束
|
||||||
case 5:
|
case 5:
|
||||||
console.info(judgeTag, '考试结束')
|
console.info(judgeTag, '考试结束')
|
||||||
await judgeTask.addTask(async () => {
|
judgeTask.addTask(async () => {
|
||||||
console.info(judgeTag, '考试结束 start')
|
console.info(judgeTag, '考试结束 start')
|
||||||
globalThis.isJudge = false;
|
globalThis.isJudge = false;
|
||||||
await handEndExam(ksjs)
|
await handEndExam(ksjs)
|
||||||
@ -519,29 +523,31 @@ export default class Judge {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (event == 2 || event == 3) {
|
if (event == 2 || event == 3) {
|
||||||
//科目三统计必考数量
|
|
||||||
await this.setCountItems();
|
|
||||||
await checkExamIsEnd()
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
console.info(judgeTag,'滚动开始')
|
||||||
this.judgeUI.kfArrScroller.scrollTo({
|
this.judgeUI.kfArrScroller.scrollTo({
|
||||||
yOffset: 999999, xOffset: 0
|
yOffset: 999999, xOffset: 0
|
||||||
})
|
})
|
||||||
console.info(judgeTag, '发生滚动')
|
console.info(judgeTag,'滚动结束')
|
||||||
})
|
},500)
|
||||||
|
//科目三统计必考数量
|
||||||
|
await this.setCountItems();
|
||||||
|
await checkExamIsEnd()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测扣分、结束项目时该项目是否开始
|
// 检测扣分、结束项目时该项目是否开始
|
||||||
checkProjectIsStart = async(xmdm,currentType:1|2,kf?:KF) => {
|
checkProjectIsStart = async(xmdm,currentType:1|2,kf?:KF) => {
|
||||||
if(xmdm == 20){
|
if(xmdm == 20){
|
||||||
return
|
return true
|
||||||
}
|
}
|
||||||
const {judgeTask,beginProject,pointsDedute,uploadProgressPhoto,endProject,checkExamIsEnd} = this;
|
const {judgeTask,beginProject,pointsDedute,uploadProgressPhoto,endProject,checkExamIsEnd} = this;
|
||||||
const {projectsObj} = this.judgeUI
|
const {projectsObj} = this.judgeUI
|
||||||
const type = projectsObj[xmdm].type;
|
console.info(judgeTag + ' projectsObj=> ',JSON.stringify(projectsObj))
|
||||||
|
const {isUpload} = projectsObj[xmdm];
|
||||||
|
console.info(judgeTag + ' projectsObj[xmdm] => ',JSON.stringify(projectsObj[xmdm]))
|
||||||
//如果项目没有开始
|
//如果项目没有开始
|
||||||
if(type == 1){
|
if(!isUpload){
|
||||||
console.info(judgeTag,'项目补传开始')
|
console.info(judgeTag,'项目补传开始')
|
||||||
//项目开始补传
|
//项目开始补传
|
||||||
judgeTask.addTask(async ()=>{await beginProject(xmdm)},{isDelay:true})
|
judgeTask.addTask(async ()=>{await beginProject(xmdm)},{isDelay:true})
|
||||||
@ -555,7 +561,6 @@ export default class Judge {
|
|||||||
this.judgeUI.projectsObj[xmdm].isEnd = true;
|
this.judgeUI.projectsObj[xmdm].isEnd = true;
|
||||||
checkExamIsEnd()
|
checkExamIsEnd()
|
||||||
})
|
})
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}else{
|
}else{
|
||||||
return true
|
return true
|
||||||
@ -566,7 +571,7 @@ export default class Judge {
|
|||||||
beginProject = async (ksxm) => {
|
beginProject = async (ksxm) => {
|
||||||
const carInfo = globalThis.carInfo;
|
const carInfo = globalThis.carInfo;
|
||||||
const { examSubject,plateNo } = carInfo;
|
const { examSubject,plateNo } = carInfo;
|
||||||
const {judgeUI,fileLog,getSbbm,xmxh} = this;
|
const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this;
|
||||||
const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,ksxl} = judgeUI
|
const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,ksxl} = judgeUI
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const project = projectsObj[ksxm]
|
const project = projectsObj[ksxm]
|
||||||
@ -589,19 +594,20 @@ export default class Judge {
|
|||||||
kssj: time
|
kssj: time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const code = await writeObjectOut(data)
|
const code = await writeObjectOut(data,filePath)
|
||||||
console.info(judgeTag, '项目开始 end')
|
console.info(judgeTag, '项目开始 end')
|
||||||
if (code === 2300007) {
|
if (code === 2300007) {
|
||||||
this.isJudgeDisConnect = true;
|
this.isJudgeDisConnect = true;
|
||||||
}
|
}
|
||||||
promptWxCode('17C52', code)
|
promptWxCode('17C52', code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 项目结束接口同步
|
// 项目结束接口同步
|
||||||
endProject = async (ksxm) => {
|
endProject = async (ksxm) => {
|
||||||
const carInfo = globalThis.carInfo;
|
const carInfo = globalThis.carInfo;
|
||||||
const deviceNo = globalThis.deviceNo;
|
const deviceNo = globalThis.deviceNo;
|
||||||
const { examSubject,plateNo,carNo } = carInfo;
|
const { examSubject,plateNo,carNo } = carInfo;
|
||||||
const {judgeUI,fileLog,getSbxh,xmxh,getSbbm} = this;
|
const {judgeUI,fileLog,getSbxh,xmxh,getSbbm,filePath} = this;
|
||||||
const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,ksxl,} = judgeUI
|
const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,ksxl,} = judgeUI
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const project = projectsObj[ksxm]
|
const project = projectsObj[ksxm]
|
||||||
@ -624,19 +630,20 @@ export default class Judge {
|
|||||||
jssj: time
|
jssj: time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const code = await writeObjectOut(data)
|
const code = await writeObjectOut(data,filePath)
|
||||||
if (code === 2300007) {
|
if (code === 2300007) {
|
||||||
this.isJudgeDisConnect = true;
|
this.isJudgeDisConnect = true;
|
||||||
}
|
}
|
||||||
console.info(judgeTag, '项目结束 end')
|
console.info(judgeTag, '项目结束 end')
|
||||||
promptWxCode('17C55', code)
|
promptWxCode('17C55', code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 考试扣分
|
// 考试扣分
|
||||||
pointsDedute = async (ksxm, kf) => {
|
pointsDedute = async (ksxm, kf) => {
|
||||||
const carInfo = globalThis.carInfo;
|
const carInfo = globalThis.carInfo;
|
||||||
const deviceNo = globalThis.deviceNo;
|
const deviceNo = globalThis.deviceNo;
|
||||||
const { examSubject,plateNo,carNo } = carInfo;
|
const { examSubject,plateNo,carNo } = carInfo;
|
||||||
const {judgeUI,getProjectInfo,fileLog,xmmcSingleCode} = this;
|
const {judgeUI,getProjectInfo,fileLog,xmmcSingleCode,filePath} = this;
|
||||||
const {lsh,idCard,serialNumber,ksdd} = judgeUI
|
const {lsh,idCard,serialNumber,ksdd} = judgeUI
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const project = getProjectInfo(ksxm);
|
const project = getProjectInfo(ksxm);
|
||||||
@ -660,17 +667,18 @@ export default class Judge {
|
|||||||
kfsj: time
|
kfsj: time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const code = await writeObjectOut(data);
|
const code = await writeObjectOut(data,filePath);
|
||||||
if (code === 2300007) {
|
if (code === 2300007) {
|
||||||
this.isJudgeDisConnect = true
|
this.isJudgeDisConnect = true
|
||||||
}
|
}
|
||||||
console.info(judgeTag, '项目扣分 end')
|
console.info(judgeTag, '项目扣分 end')
|
||||||
promptWxCode('17C53', code)
|
promptWxCode('17C53', code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 考试过程照片
|
// 考试过程照片
|
||||||
uploadProgressPhoto = async (ksxm) => {
|
uploadProgressPhoto = async (ksxm) => {
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const {judgeUI,plcData,getPhoto,fileLog} = this;
|
const {judgeUI,plcData,getPhoto,fileLog,filePath} = this;
|
||||||
const photoBase64 = await getPhoto();
|
const photoBase64 = await getPhoto();
|
||||||
const carInfo = globalThis.carInfo;
|
const carInfo = globalThis.carInfo;
|
||||||
const { examSubject,plateNo,carNo } = carInfo;
|
const { examSubject,plateNo,carNo } = carInfo;
|
||||||
@ -689,11 +697,11 @@ export default class Judge {
|
|||||||
zpsj: time,
|
zpsj: time,
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
zp: photoBase64,
|
zp: photoBase64,
|
||||||
cs: Math.ceil(gps.sd * 1.852),
|
cs: Math.floor(gps.sd * 1.852),
|
||||||
ksdd: encodeURI(ksdd)
|
ksdd: encodeURI(ksdd)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const code = await writeObjectOut(data);
|
const code = await writeObjectOut(data,filePath);
|
||||||
if (code === 2300007) {
|
if (code === 2300007) {
|
||||||
this.isJudgeDisConnect = true
|
this.isJudgeDisConnect = true
|
||||||
}
|
}
|
||||||
@ -707,9 +715,8 @@ export default class Judge {
|
|||||||
const {xmdm,code,type} = sound;
|
const {xmdm,code,type} = sound;
|
||||||
//判断是不是模拟灯光语音
|
//判断是不是模拟灯光语音
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
console.info(judgeTag, '模拟灯光开始播放:' + code)
|
// console.info(judgeTag, '模拟灯光开始播放:' + code)
|
||||||
}
|
}
|
||||||
console.info(judgeTag, '语音播放代码:' + code)
|
|
||||||
avPlayer.playAudio([`voice/${code}.mp3`], false, () => {
|
avPlayer.playAudio([`voice/${code}.mp3`], false, () => {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
console.info(judgeTag, '播放结束:' + code)
|
console.info(judgeTag, '播放结束:' + code)
|
||||||
@ -728,14 +735,14 @@ export default class Judge {
|
|||||||
|
|
||||||
// 校验考试是否结束
|
// 校验考试是否结束
|
||||||
checkExamIsEnd = async (isManual?: boolean) => {
|
checkExamIsEnd = async (isManual?: boolean) => {
|
||||||
const {judgeUI,avPlayer,isExamEnd} = this;
|
const {judgeUI,avPlayer,isExamEnd,} = this;
|
||||||
const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,jl,examMileage} = judgeUI;
|
const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,passingScore} = judgeUI;
|
||||||
|
|
||||||
if (isExamEnd) {
|
if (isExamEnd) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//及格分
|
//及格分
|
||||||
let passingGrade = examSubject == 2 ? 80 : 90
|
let passingGrade = passingScore
|
||||||
if (isManual) {
|
if (isManual) {
|
||||||
if (isAllProjectsEnd) {
|
if (isAllProjectsEnd) {
|
||||||
// 考试合格
|
// 考试合格
|
||||||
@ -754,7 +761,7 @@ export default class Judge {
|
|||||||
} else {
|
} else {
|
||||||
//单机模式
|
//单机模式
|
||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
console.info(judgeTag + ' isAllProjectsEnd',isAllProjectsEnd)
|
console.info(judgeTag + ' isAllProjectsEnd => ',isAllProjectsEnd)
|
||||||
if (isAllProjectsEnd) {
|
if (isAllProjectsEnd) {
|
||||||
await examJudgeEndExam()
|
await examJudgeEndExam()
|
||||||
this.isExamEnd = true
|
this.isExamEnd = true
|
||||||
@ -786,9 +793,11 @@ export default class Judge {
|
|||||||
public handEndExam = async (ksjs: KSJS) => {
|
public handEndExam = async (ksjs: KSJS) => {
|
||||||
this.judgeUI.loadingPopupVisible = true;
|
this.judgeUI.loadingPopupVisible = true;
|
||||||
this.judgeUI.endPopupVisible = false;
|
this.judgeUI.endPopupVisible = false;
|
||||||
|
this.judgeUI.isDeductedPopShow = false;
|
||||||
|
|
||||||
const {qjjl,dcjl} = ksjs
|
const {qjjl,dcjl} = ksjs
|
||||||
const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual} = this;
|
const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual} = this;
|
||||||
const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,projectsObj} = judgeUI;
|
const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI;
|
||||||
//计算考试分数
|
//计算考试分数
|
||||||
this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0;
|
this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0;
|
||||||
const singlePlay = globalThis.singlePlay
|
const singlePlay = globalThis.singlePlay
|
||||||
@ -796,7 +805,7 @@ export default class Judge {
|
|||||||
globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
||||||
|
|
||||||
//自动退出待验证并且不合格
|
//自动退出待验证并且不合格
|
||||||
if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < 90) {
|
if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) {
|
||||||
avPlayer.playAudio([`voice/考试结束.mp3`])
|
avPlayer.playAudio([`voice/考试结束.mp3`])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,8 +819,7 @@ export default class Judge {
|
|||||||
|
|
||||||
if (examSubject == 3) {
|
if (examSubject == 3) {
|
||||||
const param302 = judgeConfigObj['302'];
|
const param302 = judgeConfigObj['302'];
|
||||||
//TODO 分数待修改从sysset表里获取
|
if (totalScore < passingScore) {
|
||||||
if (totalScore < 90) {
|
|
||||||
//考试不合格;考试模式,自动退出;
|
//考试不合格;考试模式,自动退出;
|
||||||
if (param302 == 4 || param302 == 5 || param302 == 7 || param302 == 8) {
|
if (param302 == 4 || param302 == 5 || param302 == 7 || param302 == 8) {
|
||||||
}
|
}
|
||||||
@ -844,8 +852,8 @@ export default class Judge {
|
|||||||
const carInfo = globalThis.carInfo;
|
const carInfo = globalThis.carInfo;
|
||||||
const singlePlay = globalThis.singlePlay
|
const singlePlay = globalThis.singlePlay
|
||||||
const { examSubject ,plateNo} = carInfo;
|
const { examSubject ,plateNo} = carInfo;
|
||||||
const {judgeUI,ksjs,getPhoto,uploadProgressData,uploadDisConnectData,avPlayer,kfArr,judgeTask} = this;
|
const {judgeUI,ksjs,getPhoto,uploadProgressData,uploadDisConnectData,avPlayer,kfArr,judgeTask,filePath} = this;
|
||||||
const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd} = judgeUI
|
const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI
|
||||||
await uploadDisConnectData();
|
await uploadDisConnectData();
|
||||||
const time = await getCurrentTime();
|
const time = await getCurrentTime();
|
||||||
const photoBase64 = await getPhoto();
|
const photoBase64 = await getPhoto();
|
||||||
@ -865,22 +873,20 @@ export default class Judge {
|
|||||||
dwlc: '',
|
dwlc: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const code = await writeObjectOut(data);
|
const code = await writeObjectOut(data,filePath);
|
||||||
promptWxCode('17C56', code)
|
promptWxCode('17C56', code)
|
||||||
console.info(judgeTag, '考试结束 end')
|
console.info(judgeTag, '考试结束 end')
|
||||||
let noPassExitVoice = ''
|
|
||||||
const param302 = judgeConfigObj['302'];
|
const param302 = judgeConfigObj['302'];
|
||||||
|
|
||||||
judgeUI.loadingPopupVisible = true;
|
judgeUI.loadingPopupVisible = true;
|
||||||
|
|
||||||
let voiceURL = ''
|
let voiceURL = ''
|
||||||
if (examSubject == 2) {
|
if (examSubject == 2) {
|
||||||
voiceURL = (totalScore < 80 ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3')
|
voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (examSubject == 3) {
|
if (examSubject == 3) {
|
||||||
if (isAllProjectsEnd) {
|
if (isAllProjectsEnd) {
|
||||||
if (totalScore < 90) {
|
if (totalScore < passingScore) {
|
||||||
voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3`
|
voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3`
|
||||||
} else {
|
} else {
|
||||||
voiceURL = 'voice/exam_pass.mp3'
|
voiceURL = 'voice/exam_pass.mp3'
|
||||||
@ -900,7 +906,6 @@ export default class Judge {
|
|||||||
try {
|
try {
|
||||||
kfArr.forEach((kf, index) => {
|
kfArr.forEach((kf, index) => {
|
||||||
score += Math.abs(Number(kf.score));
|
score += Math.abs(Number(kf.score));
|
||||||
console.info(judgeTag + 'score=>', score)
|
|
||||||
//TODO 考试分数待替换
|
//TODO 考试分数待替换
|
||||||
if (score <= (examSubject == 3 ? 10 : 20)) {
|
if (score <= (examSubject == 3 ? 10 : 20)) {
|
||||||
if (kfArr.length - 1 === index) {
|
if (kfArr.length - 1 === index) {
|
||||||
@ -1221,7 +1226,7 @@ export default class Judge {
|
|||||||
usbService.sendUSB(str)
|
usbService.sendUSB(str)
|
||||||
}
|
}
|
||||||
this.judgeUI.isDwztRight = plcData.gps.dwzt == 4;
|
this.judgeUI.isDwztRight = plcData.gps.dwzt == 4;
|
||||||
this.judgeUI.sd = (Math.floor(plcData.gps.sd as number) || 0) + '';
|
this.judgeUI.sd = (Math.floor((plcData.gps.sd as number) || 0) * 1.852) + '';
|
||||||
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
|
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
|
||||||
await examJudgeRealExam(plcData)
|
await examJudgeRealExam(plcData)
|
||||||
const udpIndex = globalThis.udpIndex;
|
const udpIndex = globalThis.udpIndex;
|
||||||
@ -1276,19 +1281,19 @@ export default class Judge {
|
|||||||
const {fileLog,setJudgeItem,setJudgeMark,endExam} = this;
|
const {fileLog,setJudgeItem,setJudgeMark,endExam} = this;
|
||||||
let num = 2;
|
let num = 2;
|
||||||
const judgeTimer = setInterval(async () => {
|
const judgeTimer = setInterval(async () => {
|
||||||
const msg = JSON.parse(strArr[num]);
|
const msgStr = strArr[num];
|
||||||
await fileLog.setExamJudgeData(msg)
|
if(msgStr == ''){
|
||||||
if (!msg) {
|
|
||||||
console.info(judgeTag, '模拟数据考试结束')
|
console.info(judgeTag, '模拟数据考试结束')
|
||||||
examJudgeEndExam();
|
|
||||||
globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
||||||
clearInterval(judgeTimer)
|
clearInterval(judgeTimer)
|
||||||
|
this.checkExamIsEnd(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const msg = JSON.parse(strArr[num]);
|
||||||
// 4.过程数据
|
// 4.过程数据
|
||||||
this.tempData = msg
|
this.tempData = msg
|
||||||
this.judgeUI.isDwztRight = msg?.gps?.dwzt == 4;
|
this.judgeUI.isDwztRight = msg?.gps?.dwzt == 4;
|
||||||
this.judgeUI.sd = Math.floor(msg?.gps?.sd) + '';
|
this.judgeUI.sd = Math.floor(msg?.gps?.sd) * 1.852 + '';
|
||||||
this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + ''
|
this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + ''
|
||||||
this.plcData = msg
|
this.plcData = msg
|
||||||
// this.judgeUI.isDwztRight = msg.gps.dwzt == 4;
|
// this.judgeUI.isDwztRight = msg.gps.dwzt == 4;
|
||||||
@ -1301,7 +1306,7 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
await examJudgeRealExam(msg)
|
await examJudgeRealExam(msg)
|
||||||
num++
|
num++
|
||||||
}, 50)
|
}, 200)
|
||||||
globalThis.judgeTimer = judgeTimer;
|
globalThis.judgeTimer = judgeTimer;
|
||||||
}
|
}
|
||||||
// 统计必考项目、所有项目、已考数量
|
// 统计必考项目、所有项目、已考数量
|
||||||
@ -1347,6 +1352,7 @@ export default class Judge {
|
|||||||
public plcStr: string
|
public plcStr: string
|
||||||
private judgeUI
|
private judgeUI
|
||||||
private fileLog
|
private fileLog
|
||||||
|
private filePath
|
||||||
private totalScore: number
|
private totalScore: number
|
||||||
private folderPath: string
|
private folderPath: string
|
||||||
private modelPath: string
|
private modelPath: string
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export default class FileLog {
|
|||||||
const time = await getCurrentTime()
|
const time = await getCurrentTime()
|
||||||
const date = time.split(' ')[0].split('-').join('_')
|
const date = time.split(' ')[0].split('-').join('_')
|
||||||
const hourTime = time.split(' ')[1].split(':').join('_')
|
const hourTime = time.split(' ')[1].split(':').join('_')
|
||||||
const folderPath = await fileUtil.initFolder(`/logs/${date}/${lsh}_${idCard}_${name}_${date}_${hourTime}`);
|
const folderPath = await fileUtil.initFolder(`/logs/${date}/${date}_${hourTime}_${lsh}_${idCard}_${name}`);
|
||||||
this.folderPath = folderPath;
|
this.folderPath = folderPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
//考试回放开关
|
//考试回放开关
|
||||||
export const judgeConfig = {
|
export const judgeConfig = {
|
||||||
//本地目录开关
|
//本地目录开关
|
||||||
isTrajectoryOpen: false,
|
isTrajectoryOpen: true,
|
||||||
//是否开启拍照
|
//是否开启拍照
|
||||||
isPhotoOpen: false,
|
isPhotoOpen: false,
|
||||||
//扣分语音是否强制开启
|
//扣分语音是否强制开启
|
||||||
@ -14,7 +14,7 @@ export const judgeConfig = {
|
|||||||
// 本地模型地址
|
// 本地模型地址
|
||||||
modelPath: 'models/model_enc',
|
modelPath: 'models/model_enc',
|
||||||
// 济南科目三
|
// 济南科目三
|
||||||
trajectoryPath: 'logs/2024_07_31/0000000000001_342323199501470011_测试学员1_2024_07_31_10_21_38/judge_exam_data.txt',
|
trajectoryPath: 'logs/2024_08_01/9999931199729_210601620482055232_蒲秀_2024_08_01_11_52_27/judge_exam_data.txt',
|
||||||
// 杭州科目二
|
// 杭州科目二
|
||||||
// trajectoryPath: 'logs/2024_07_19/0000000000001_342323199501470011_测试学员1_2024_07_19_06_49_12/judge_exam_data.txt',
|
// trajectoryPath: 'logs/2024_07_19/0000000000001_342323199501470011_测试学员1_2024_07_19_06_49_12/judge_exam_data.txt',
|
||||||
//TODO 济南临时特殊配置
|
//TODO 济南临时特殊配置
|
||||||
|
|||||||
@ -86,15 +86,14 @@ class AVPlayer {
|
|||||||
|
|
||||||
// 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
|
// 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
|
||||||
async play(name,callback) {
|
async play(name,callback) {
|
||||||
let isInSD = true
|
|
||||||
try {
|
try {
|
||||||
//检查SD中的语音
|
//检查SD中的语音
|
||||||
console.info('surenjun name',name)
|
// console.info('surenjun name',name)
|
||||||
console.info('surenjun name',name.split('/')[1])
|
// console.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)
|
// console.info('surenjun fdPath=>',fdPath)
|
||||||
audioPlayer.on('dataLoad', () => {
|
audioPlayer.on('dataLoad', () => {
|
||||||
this.voiceStatus = 'playing'
|
this.voiceStatus = 'playing'
|
||||||
audioPlayer.play()
|
audioPlayer.play()
|
||||||
@ -114,56 +113,49 @@ class AVPlayer {
|
|||||||
audioPlayer.reset()
|
audioPlayer.reset()
|
||||||
audioPlayer.src = `fd://${fdPath}`
|
audioPlayer.src = `fd://${fdPath}`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
return
|
|
||||||
}catch (e){
|
}catch (e){
|
||||||
console.info('surenjun fdPath=>',JSON.stringify(e))
|
//检查SD中的语音
|
||||||
isInSD = false;
|
this.endCallback = callback
|
||||||
}
|
const avPlayer = await media.createAVPlayer();
|
||||||
if(!isInSD){
|
this.avPlayer = avPlayer;
|
||||||
return
|
return new Promise(async (resolve,reject) => {
|
||||||
}
|
await this.setAVPlayerCallback(()=>{
|
||||||
//检查SD中的语音
|
//@ts-ignore
|
||||||
this.endCallback = callback
|
resolve()
|
||||||
const avPlayer = await media.createAVPlayer();
|
|
||||||
this.avPlayer = avPlayer;
|
|
||||||
|
|
||||||
return new Promise(async (resolve,reject) => {
|
|
||||||
let url = ''
|
|
||||||
await this.setAVPlayerCallback(()=>{
|
|
||||||
//@ts-ignore
|
|
||||||
resolve()
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
url = await globalThis.context.resourceManager.getRawFd(name);
|
|
||||||
this.avPlayer.fdSrc = url;
|
|
||||||
} catch (e) {
|
|
||||||
Prompt.showToast({
|
|
||||||
message: `${name}语音文件不存在`,
|
|
||||||
duration: 4000
|
|
||||||
});
|
});
|
||||||
resolve(1)
|
try {
|
||||||
}
|
this.avPlayer.fdSrc = await globalThis.context.resourceManager.getRawFd(name);
|
||||||
})
|
} catch (e) {
|
||||||
|
Prompt.showToast({
|
||||||
|
message: `${name}语音文件不存在`,
|
||||||
|
duration: 4000
|
||||||
|
});
|
||||||
|
resolve(1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async queryFile(displayName): Promise<mediaLibrary.FileAsset> {
|
async queryFile(displayName): Promise<mediaLibrary.FileAsset> {
|
||||||
const mediaLib = mediaLibrary.getMediaLibrary(globalThis.context);
|
return new Promise(async (resolve,reject)=>{
|
||||||
let ret
|
const mediaLib = mediaLibrary.getMediaLibrary(globalThis.context);
|
||||||
let fetchOp = {
|
let ret
|
||||||
selections: `media_type=? AND display_name = ?`,
|
let fetchOp = {
|
||||||
selectionArgs: [`${mediaLibrary.MediaType.AUDIO}`,displayName],
|
selections: `media_type=? AND display_name = ?`,
|
||||||
};
|
selectionArgs: [`${mediaLibrary.MediaType.AUDIO}`,displayName],
|
||||||
let fileResult = await mediaLib.getFileAssets(fetchOp);
|
};
|
||||||
let retCount = fileResult.getCount();
|
let fileResult = await mediaLib.getFileAssets(fetchOp);
|
||||||
console.info('surenjun retCount=>',retCount)
|
let retCount = fileResult.getCount();
|
||||||
if (retCount > 0) {
|
if (retCount > 0) {
|
||||||
ret = fileResult.getFirstObject();
|
ret = fileResult.getFirstObject();
|
||||||
return Promise.resolve(ret);
|
return resolve(ret);
|
||||||
}else{
|
}else{
|
||||||
return Promise.reject(0);
|
return reject(false);
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user