Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev
This commit is contained in:
commit
e0b0a7b777
@ -183,9 +183,11 @@ export async function getUDP2(context,errorFlag?) {
|
||||
|
||||
}
|
||||
if(val.body[0] == 11){
|
||||
console.info('surenjun','GlobalUdp收到beginExam事件')
|
||||
globalThis.udpEvent.sendBeginExam()
|
||||
}
|
||||
if(val.body[0] == 12){
|
||||
console.info('surenjun','GlobalUdp收到endExam事件')
|
||||
globalThis.udpEvent.sendEndExam()
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ export default class JudgeEmitter{
|
||||
}
|
||||
|
||||
init = async ()=>{
|
||||
console.info('surenjun','开始注册udp事件')
|
||||
emitter.on({eventId:EVENTID.beginExamEventId}, () => {
|
||||
this?.beginExamCallBack()
|
||||
});
|
||||
@ -36,6 +37,7 @@ export default class JudgeEmitter{
|
||||
|
||||
//监听开始考试
|
||||
public onBeginExam = async (callBack?:Function)=>{
|
||||
console.info('surenjun','userInfo注册onBeginExam事件')
|
||||
this.beginExamCallBack = callBack
|
||||
}
|
||||
|
||||
@ -50,14 +52,14 @@ export default class JudgeEmitter{
|
||||
}
|
||||
|
||||
//开始考试
|
||||
public sendBeginExam = async(content)=>{
|
||||
public sendBeginExam = async(content:string)=>{
|
||||
emitter.emit({eventId:EVENTID.beginExamEventId}, {
|
||||
data:{ content }
|
||||
});
|
||||
}
|
||||
|
||||
//结束考试
|
||||
public sendEndExam = async(content)=>{
|
||||
public sendEndExam = async(content:string)=>{
|
||||
emitter.emit({eventId:EVENTID.endExamEventId}, {
|
||||
data:{content}
|
||||
});
|
||||
|
||||
@ -184,7 +184,7 @@ struct Index {
|
||||
Column() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text('V 1.0')
|
||||
Text('V ' + globalThis.version)
|
||||
.fontColor('#CCAE7A')
|
||||
.fontSize(22 * globalThis.ratio)
|
||||
.width('30%')
|
||||
|
||||
@ -82,6 +82,7 @@ struct Index {
|
||||
this.singlePlay = globalThis.singlePlay
|
||||
}
|
||||
await this.initCDSBInfo()
|
||||
await this.initItemInfo()
|
||||
|
||||
// 科目三新增读取表数据
|
||||
if (examSubject == 3) {
|
||||
@ -257,6 +258,7 @@ struct Index {
|
||||
if (no1 == 3 && no3 == 1) {
|
||||
if (txt1 === carName) {
|
||||
carNo = no2
|
||||
this.carlist = carNo
|
||||
console.info('surenjun carNo => ',carNo)
|
||||
}
|
||||
}
|
||||
@ -355,7 +357,28 @@ struct Index {
|
||||
xmxh: key.split('~')[1],
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取itemInfo表信息
|
||||
async initItemInfo(){
|
||||
const infoParams = await getSyncData('MA_ITEMINFO');
|
||||
const carlist = this.carlist;
|
||||
const projectsObj = this.projectsObj
|
||||
//@ts-ignore
|
||||
infoParams.forEach((info)=>{
|
||||
const key = decodeURI(info.itemsno);
|
||||
const carlistArr = decodeURI(info.carlist).split(',') || []
|
||||
const newKey = key.split('~').join('_')
|
||||
//@ts-ignore
|
||||
const xmdm = key.split('~')[0] * 1
|
||||
if(projectsObj[xmdm] && (carlistArr.length == 0 || carlistArr.includes(carlist))){
|
||||
this.itemInfoObj[newKey] = {
|
||||
modelKey: newKey,
|
||||
xmdm,
|
||||
xmxh: key.split('~')[1],
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -1113,7 +1136,6 @@ struct Index {
|
||||
//里程是否达标 && 必考项目是否全完成
|
||||
return jl >= Number(examMileage) && isRequiredProjectsEnd
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -1160,7 +1182,7 @@ struct Index {
|
||||
|
||||
//405参数为2是,如果在最左侧车道,超车项目不能触发;
|
||||
if (projectCode == '10' &&
|
||||
judgeConfigObj['402'] == '2' &&
|
||||
judgeConfigObj['405'] == '2' &&
|
||||
(num === count) &&
|
||||
num > 0
|
||||
) {
|
||||
@ -1231,6 +1253,7 @@ struct Index {
|
||||
@State projectsCenterObj: ProjectObj = {}
|
||||
@State markRuleListObj: MarkRule = {}
|
||||
@State cdsbInfoObj: CDSBInfo = {}
|
||||
@State itemInfoObj: CDSBInfo = {}
|
||||
@State timer: number = 0
|
||||
@State judgeConfig: { [k: string]: string }[] = []
|
||||
@State judgeConfigObj: { [k: string]: any } = defaultJudgeConfigObj
|
||||
@ -1288,4 +1311,5 @@ struct Index {
|
||||
@State passingScore: number = 80
|
||||
@State dwztErrorVisible: boolean = false;
|
||||
@State popTimer:number =0;
|
||||
@State carlist:string= ''
|
||||
}
|
||||
|
||||
@ -817,8 +817,77 @@ struct UserInfo {
|
||||
return temp
|
||||
}
|
||||
|
||||
//开始上车准备
|
||||
prePareSCZB = async () => {
|
||||
try {
|
||||
await this.checkSignal()
|
||||
this.isExamStart = true
|
||||
this.currentUser.id = '0'
|
||||
await upDateTableByArray('USER', [this.currentUser])
|
||||
globalThis.statue = 4
|
||||
this.isBoardPrePareSetPopupShow = true;
|
||||
this.isFirstBoardPrePareSetPopupBtnShow = true;
|
||||
this.stepFlag = false
|
||||
this.stopDeviceById()
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//开始考试准备
|
||||
prePareExam = async() => {
|
||||
if (this.ksksLimit) {
|
||||
return
|
||||
}
|
||||
console.log('routerParamrouterParam')
|
||||
try {
|
||||
await this.checkSignal()
|
||||
this.faceCompareSucess = 0
|
||||
globalThis.statue = 2
|
||||
if (!this.currentUser.xm) {
|
||||
return
|
||||
}
|
||||
this.ksksLimit = true
|
||||
|
||||
if (globalThis.singlePlay) {
|
||||
const {examSubject} = globalThis.carInfo;
|
||||
this.currentUser.id = '0'
|
||||
await upDateTableByArray('USER', [this.currentUser])
|
||||
router.pushUrl({
|
||||
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
|
||||
params: {
|
||||
sczb: Number(this.isBoardPrePareSetPopupOpen),
|
||||
kfdm: this.sczbkf,
|
||||
}
|
||||
}, router.RouterMode.Single);
|
||||
this.ksksLimit = false
|
||||
|
||||
this.stopDeviceById()
|
||||
return
|
||||
}
|
||||
console.log('this.FaceOpenStatuethis.FaceOpenStatue',this.FaceOpenStatue)
|
||||
if (this.FaceOpenStatue != '0') {
|
||||
this.showFaceCompare = true
|
||||
} else {
|
||||
this.sfbdinterfaceFn()
|
||||
}
|
||||
} catch (e) {
|
||||
console.info('Throw Error', JSON.stringify(e))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
this.outClick()
|
||||
//监听远程开始考试
|
||||
globalThis.udpEvent.onBeginExam(async ()=>{
|
||||
console.info('surenjun','userInfo收到UdpEvent事件')
|
||||
if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
|
||||
await this.prePareSCZB()
|
||||
}else{
|
||||
await this.prePareExam()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
outClick() {
|
||||
@ -953,63 +1022,13 @@ struct UserInfo {
|
||||
if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
|
||||
//上车准备
|
||||
Image($r('app.media.sczb_btn')).commStyle().onClick(async () => {
|
||||
try {
|
||||
await this.checkSignal()
|
||||
this.isExamStart = true
|
||||
this.currentUser.id = '0'
|
||||
await upDateTableByArray('USER', [this.currentUser])
|
||||
globalThis.statue = 4
|
||||
this.isBoardPrePareSetPopupShow = true;
|
||||
this.isFirstBoardPrePareSetPopupBtnShow = true;
|
||||
this.stepFlag = false
|
||||
this.stopDeviceById()
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
await this.prePareSCZB()
|
||||
})
|
||||
} else {
|
||||
Image($r('app.media.ksks_btn'))
|
||||
.commStyle()
|
||||
.onClick(async () => {
|
||||
if (this.ksksLimit) {
|
||||
return
|
||||
}
|
||||
console.log('routerParamrouterParam')
|
||||
try {
|
||||
await this.checkSignal()
|
||||
this.faceCompareSucess = 0
|
||||
globalThis.statue = 2
|
||||
if (!this.currentUser.xm) {
|
||||
return
|
||||
}
|
||||
this.ksksLimit = true
|
||||
|
||||
if (globalThis.singlePlay) {
|
||||
const {examSubject} = globalThis.carInfo;
|
||||
this.currentUser.id = '0'
|
||||
await upDateTableByArray('USER', [this.currentUser])
|
||||
router.pushUrl({
|
||||
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
|
||||
params: {
|
||||
sczb: Number(this.isBoardPrePareSetPopupOpen),
|
||||
kfdm: this.sczbkf,
|
||||
}
|
||||
}, router.RouterMode.Single);
|
||||
this.ksksLimit = false
|
||||
|
||||
this.stopDeviceById()
|
||||
return
|
||||
}
|
||||
console.log('this.FaceOpenStatuethis.FaceOpenStatue',this.FaceOpenStatue)
|
||||
if (this.FaceOpenStatue != '0') {
|
||||
this.showFaceCompare = true
|
||||
} else {
|
||||
this.sfbdinterfaceFn()
|
||||
}
|
||||
} catch (e) {
|
||||
console.info('Throw Error', JSON.stringify(e))
|
||||
}
|
||||
|
||||
await this.prePareExam()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,6 +198,9 @@ export default class Judge {
|
||||
handDistance();
|
||||
}
|
||||
})
|
||||
globalThis.udpEvent.onBeginExam(async ()=>{
|
||||
this.checkExamIsEnd(true);
|
||||
})
|
||||
//TODO 监听远程扣分
|
||||
}
|
||||
//实时计算gps经纬度距离
|
||||
@ -227,13 +230,13 @@ export default class Judge {
|
||||
const carInfo = globalThis.carInfo;
|
||||
const { examSubject,plateNo,carId } = carInfo;
|
||||
const judgeUI = this.judgeUI
|
||||
const {projectsObj,cdsbInfoObj,markRuleListObj,carType,carName,systemparmArr} = judgeUI
|
||||
const {projectsObj,itemInfoObj,markRuleListObj,carType,carName,systemparmArr} = judgeUI
|
||||
const examType = examSubject == 2 ? 'km2' : 'km3'
|
||||
|
||||
let allitems = [];
|
||||
if (examSubject == 2) {
|
||||
allitems = Reflect.ownKeys(cdsbInfoObj).map(cdsbKey => {
|
||||
const cdsb = cdsbInfoObj[cdsbKey];
|
||||
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
||||
const cdsb = itemInfoObj[cdsbKey];
|
||||
const {xmdm,xmxh,modelKey} = cdsb
|
||||
return {
|
||||
xmdm, xmxh, model: getModelData(`${examType}/${modelKey}.txt`)
|
||||
@ -254,6 +257,8 @@ export default class Judge {
|
||||
systemparm: systemparmArr,
|
||||
mark: Reflect.ownKeys(markRuleListObj).map(ruleKey => (markRuleListObj[ruleKey])) || testMarkRules,
|
||||
sysset: judgeUI.judgeConfig,
|
||||
itemInfoObj,
|
||||
carlist:judgeUI.carlist
|
||||
};
|
||||
let km3Config = {}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user