fix: 拉起app
This commit is contained in:
parent
c3c8783969
commit
076fa74604
@ -10,7 +10,7 @@ import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
|
|||||||
import { initJudgeUdp } from '../common/utils/UdpJudge';
|
import { initJudgeUdp } from '../common/utils/UdpJudge';
|
||||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||||
import { getTCP } from '../common/utils/GlobalTcp';
|
import { getTCP } from '../common/utils/GlobalTcp';
|
||||||
import { getSingleCenterTable, setliushuiNum, takePhotoFn ,uploadLogFile} from '../common/service/indexService';
|
import { getSingleCenterTable, setliushuiNum, takePhotoFn, uploadLogFile } from '../common/service/indexService';
|
||||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||||
import promptAction from '@ohos.promptAction';
|
import promptAction from '@ohos.promptAction';
|
||||||
import errorMsgDialog from './compontents/errorMsgDialog';
|
import errorMsgDialog from './compontents/errorMsgDialog';
|
||||||
@ -19,9 +19,10 @@ import UdpEvent from '../common/utils/UdpEvent';
|
|||||||
import { delPic } from '../common/service/videoService';
|
import { delPic } from '../common/service/videoService';
|
||||||
import imageBtn from './compontents/imageBtn';
|
import imageBtn from './compontents/imageBtn';
|
||||||
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
||||||
import {updateModelAndCar} from '../common/autoUpdate/index'
|
import { updateModelAndCar } from '../common/autoUpdate/index'
|
||||||
// import {uploadLogFile} from '../common/service/indexService'
|
// import {uploadLogFile} from '../common/service/indexService'
|
||||||
import { getModalValueCdAndCar } from '../api';
|
import { getModalValueCdAndCar } from '../api';
|
||||||
|
import Want from '@ohos.app.ability.Want';
|
||||||
|
|
||||||
// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
||||||
|
|
||||||
@ -342,7 +343,7 @@ struct Index {
|
|||||||
.width(80 * globalThis.ratio)
|
.width(80 * globalThis.ratio)
|
||||||
.height(80 * globalThis.ratio)
|
.height(80 * globalThis.ratio)
|
||||||
.position({ x: 288 * globalThis.ratio, y: 89 * globalThis.ratio })
|
.position({ x: 288 * globalThis.ratio, y: 89 * globalThis.ratio })
|
||||||
Text(this.loadingText ||'获取考车信息,请稍候……')
|
Text(this.loadingText || '获取考车信息,请稍候……')
|
||||||
.fontSize(24 * globalThis.ratio)
|
.fontSize(24 * globalThis.ratio)
|
||||||
.margin({ top: 20 * globalThis.ratio })
|
.margin({ top: 20 * globalThis.ratio })
|
||||||
.fontWeight(400)
|
.fontWeight(400)
|
||||||
@ -438,9 +439,9 @@ struct Index {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
console.log("sql 1111")
|
console.log("sql 1111")
|
||||||
|
|
||||||
getSingleCenterTable(param).then(async (ret:any) => {
|
getSingleCenterTable(param).then(async (ret: any) => {
|
||||||
|
|
||||||
if(!this.isModelInit){
|
if (!this.isModelInit) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.loadingText = '正在下载考车模型,请稍候……'
|
this.loadingText = '正在下载考车模型,请稍候……'
|
||||||
await updateModelAndCar(false)
|
await updateModelAndCar(false)
|
||||||
@ -449,7 +450,7 @@ struct Index {
|
|||||||
this.isModelInit = true
|
this.isModelInit = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof ret == 'object' && ret.resultCode == '3'){
|
if (typeof ret == 'object' && ret.resultCode == '3') {
|
||||||
this.loadingText = '正在下载考车最新版本,请稍候……'
|
this.loadingText = '正在下载考车最新版本,请稍候……'
|
||||||
this.loading = true
|
this.loading = true
|
||||||
await updateModelAndCar(true)
|
await updateModelAndCar(true)
|
||||||
@ -469,7 +470,7 @@ struct Index {
|
|||||||
if (globalThis.singlePlay) {
|
if (globalThis.singlePlay) {
|
||||||
router.pushUrl({
|
router.pushUrl({
|
||||||
url: 'pages/userInfo'
|
url: 'pages/userInfo'
|
||||||
},router.RouterMode.Single)
|
}, router.RouterMode.Single)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (globalThis.singlePlay) {
|
if (globalThis.singlePlay) {
|
||||||
|
|||||||
@ -59,6 +59,7 @@ import { GlobalConfig } from '../../config';
|
|||||||
import Want from '@ohos.app.ability.Want';
|
import Want from '@ohos.app.ability.Want';
|
||||||
|
|
||||||
const judgeTag = 'SURENJUN_JUDGE'
|
const judgeTag = 'SURENJUN_JUDGE'
|
||||||
|
const newAppTag = 'NewAppTag'
|
||||||
|
|
||||||
function ifNeedRetry(code: number | string): boolean {
|
function ifNeedRetry(code: number | string): boolean {
|
||||||
let arr = ["B210010", "B210023", "B210024", "B210031", "B210033", "B210034", "B210041"]
|
let arr = ["B210010", "B210023", "B210024", "B210031", "B210033", "B210034", "B210041"]
|
||||||
@ -67,6 +68,7 @@ function ifNeedRetry(code: number | string): boolean {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Judge {
|
export default class Judge {
|
||||||
// 过程照片拍照
|
// 过程照片拍照
|
||||||
getPhoto = async (empty?: boolean) => {
|
getPhoto = async (empty?: boolean) => {
|
||||||
@ -117,7 +119,7 @@ export default class Judge {
|
|||||||
const examDataArr = examDataStr.split('\n');
|
const examDataArr = examDataStr.split('\n');
|
||||||
for (let examDataStr of examDataArr) {
|
for (let examDataStr of examDataArr) {
|
||||||
const examData = JSON.parse(examDataStr)
|
const examData = JSON.parse(examDataStr)
|
||||||
const code = await writeObjectOut(examData,false);
|
const code = await writeObjectOut(examData, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//上传无锡所过程数据
|
//上传无锡所过程数据
|
||||||
@ -392,10 +394,10 @@ export default class Judge {
|
|||||||
//成绩不合格
|
//成绩不合格
|
||||||
if (totalScore < passingGrade) {
|
if (totalScore < passingGrade) {
|
||||||
//科目三不合格报靠边停车
|
//科目三不合格报靠边停车
|
||||||
if (examSubject == 3 ) {
|
if (examSubject == 3) {
|
||||||
if( param302 == 1){
|
if (param302 == 1) {
|
||||||
avPlayer.playAudio([`voice/考试结束.mp3`]);
|
avPlayer.playAudio([`voice/考试结束.mp3`]);
|
||||||
}else if(param302 == 0){
|
} else if (param302 == 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -471,7 +473,7 @@ export default class Judge {
|
|||||||
private testKmItems: any
|
private testKmItems: any
|
||||||
private plcData: any
|
private plcData: any
|
||||||
//特殊扣分标记
|
//特殊扣分标记
|
||||||
private specialkf:string = ''
|
private specialkf: string = ''
|
||||||
// 获取plc数据
|
// 获取plc数据
|
||||||
getPlcData = async (plc: string) => {
|
getPlcData = async (plc: string) => {
|
||||||
const {fileLog,mndgStr,rmndg} = this;
|
const {fileLog,mndgStr,rmndg} = this;
|
||||||
@ -542,7 +544,7 @@ export default class Judge {
|
|||||||
// 调代理接口是否断网了
|
// 调代理接口是否断网了
|
||||||
private isJudgeDisConnect: boolean;
|
private isJudgeDisConnect: boolean;
|
||||||
// 项目开始接口同步
|
// 项目开始接口同步
|
||||||
beginProject = async (ksxm,xmxh?:string) => {
|
beginProject = async (ksxm, xmxh?: string) => {
|
||||||
const carInfo = globalThis.carInfo;
|
const carInfo = globalThis.carInfo;
|
||||||
const { examSubject,plateNo } = carInfo;
|
const { examSubject,plateNo } = carInfo;
|
||||||
const {judgeUI,fileLog,getSbbm,filePath} = this;
|
const {judgeUI,fileLog,getSbbm,filePath} = this;
|
||||||
@ -576,7 +578,7 @@ export default class Judge {
|
|||||||
promptWxCode('17C52', code)
|
promptWxCode('17C52', code)
|
||||||
}
|
}
|
||||||
// 项目结束接口同步
|
// 项目结束接口同步
|
||||||
endProject = async (ksxm,xmxh?:string) => {
|
endProject = async (ksxm, xmxh?: string) => {
|
||||||
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;
|
||||||
@ -606,7 +608,7 @@ export default class Judge {
|
|||||||
const {code} = await this.sendWriteObjectOut(data, filePath)
|
const {code} = await this.sendWriteObjectOut(data, filePath)
|
||||||
|
|
||||||
//科三 & 432=3
|
//科三 & 432=3
|
||||||
if(examSubject == 3 && this.judgeUI.judgeConfigObj['432'] == 2){
|
if (examSubject == 3 && this.judgeUI.judgeConfigObj['432'] == 2) {
|
||||||
this.judgeUI.uploadMileage()
|
this.judgeUI.uploadMileage()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,8 +626,6 @@ export default class Judge {
|
|||||||
private disConnectNum: number = 0;
|
private disConnectNum: number = 0;
|
||||||
//调用监管接口
|
//调用监管接口
|
||||||
private externalTransmission: boolean = false
|
private externalTransmission: boolean = false
|
||||||
// 计算是否启动
|
|
||||||
private whetherToStart: boolean
|
|
||||||
//调用监管接口
|
//调用监管接口
|
||||||
sendWriteObjectOut = async (data, filePath) => {
|
sendWriteObjectOut = async (data, filePath) => {
|
||||||
const temp = await writeObjectOut(data, this.externalTransmission, filePath);
|
const temp = await writeObjectOut(data, this.externalTransmission, filePath);
|
||||||
@ -646,9 +646,10 @@ export default class Judge {
|
|||||||
return await this.sendWriteObjectOut(data, filePath)
|
return await this.sendWriteObjectOut(data, filePath)
|
||||||
}
|
}
|
||||||
if (this.disConnectNum >= 5) {
|
if (this.disConnectNum >= 5) {
|
||||||
|
console.log(newAppTag, "大于5次,需要拉起app")
|
||||||
this.externalTransmission = true
|
this.externalTransmission = true
|
||||||
let want: Want = {
|
let want: Want = {
|
||||||
bundleName: 'com.oh.upload', // 替换为你的应用包名
|
bundleName: 'com.example.upload', // 替换为你的应用包名
|
||||||
abilityName: 'EntryAbility', // 你的 Service Ability 名称
|
abilityName: 'EntryAbility', // 你的 Service Ability 名称
|
||||||
moduleName: 'entry', // 你的模块名称,通常是 'entry',
|
moduleName: 'entry', // 你的模块名称,通常是 'entry',
|
||||||
parameters: {}
|
parameters: {}
|
||||||
@ -659,10 +660,10 @@ export default class Judge {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(`拉起应用失败: ${error.code} - ${error.message}`);
|
console.error(newAppTag, `拉起应用失败: ${error.code} - ${error.message}`);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`启动Ability异常: ${error.message}`);
|
console.error(newAppTag, `启动Ability异常: ${error.message}`);
|
||||||
}
|
}
|
||||||
return await this.sendWriteObjectOut(data, filePath)
|
return await this.sendWriteObjectOut(data, filePath)
|
||||||
}
|
}
|
||||||
@ -670,9 +671,8 @@ export default class Judge {
|
|||||||
|
|
||||||
if (this.disConnectNum >= 5) {
|
if (this.disConnectNum >= 5) {
|
||||||
console.info('surenjun', '123')
|
console.info('surenjun', '123')
|
||||||
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
|
// this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
|
||||||
this.judgeUI.disConnectErrorOpen = true
|
// this.judgeUI.disConnectErrorOpen = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.disConnectNum = 0
|
this.disConnectNum = 0
|
||||||
@ -776,12 +776,12 @@ export default class Judge {
|
|||||||
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
||||||
const cdsb = itemInfoObj[cdsbKey];
|
const cdsb = itemInfoObj[cdsbKey];
|
||||||
const {xmdm,xmxh,modelKey} = cdsb
|
const {xmdm,xmxh,modelKey} = cdsb
|
||||||
const modelVal= getModelData(`${modelKey}.txt`)
|
const modelVal = getModelData(`${modelKey}.txt`)
|
||||||
if(modelVal){
|
if (modelVal) {
|
||||||
return {
|
return {
|
||||||
xmdm, xmxh, model: modelVal
|
xmdm, xmxh, model: modelVal
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
}).filter(item => item !== undefined)
|
}).filter(item => item !== undefined)
|
||||||
@ -875,7 +875,7 @@ export default class Judge {
|
|||||||
mfxx: false,
|
mfxx: false,
|
||||||
mfxxn: false,
|
mfxxn: false,
|
||||||
//科目三特殊扣分项
|
//科目三特殊扣分项
|
||||||
specialkf:judgeUI.specialkf,
|
specialkf: judgeUI.specialkf,
|
||||||
}
|
}
|
||||||
console.info(judgeTag, '5.获取开始考试数据完成')
|
console.info(judgeTag, '5.获取开始考试数据完成')
|
||||||
return beginInfo
|
return beginInfo
|
||||||
@ -1100,7 +1100,7 @@ export default class Judge {
|
|||||||
if (!isEnd) {
|
if (!isEnd) {
|
||||||
judgeTask.addTask(async () => {
|
judgeTask.addTask(async () => {
|
||||||
console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
|
console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
|
||||||
await beginProject(xmdm,xmxh)
|
await beginProject(xmdm, xmxh)
|
||||||
}, {
|
}, {
|
||||||
isDelay: true
|
isDelay: true
|
||||||
})
|
})
|
||||||
@ -1129,7 +1129,7 @@ export default class Judge {
|
|||||||
if (!projectIsEnd) {
|
if (!projectIsEnd) {
|
||||||
judgeTask.addTask(async () => {
|
judgeTask.addTask(async () => {
|
||||||
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
|
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
|
||||||
await endProject(xmdm,xmxh)
|
await endProject(xmdm, xmxh)
|
||||||
this.xmmcSingleCode = 0;
|
this.xmmcSingleCode = 0;
|
||||||
this.xmmcEndCode = undefined;
|
this.xmmcEndCode = undefined;
|
||||||
}, {
|
}, {
|
||||||
@ -1268,11 +1268,11 @@ export default class Judge {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
//收到综合评判语音时,显示综合评判弹窗
|
//收到综合评判语音时,显示综合评判弹窗
|
||||||
if(code[0] == 'zhpp'){
|
if (code[0] == 'zhpp') {
|
||||||
const param512 = (this.judgeUI.judgeConfigObj['512'] || '').split(',');
|
const param512 = (this.judgeUI.judgeConfigObj['512'] || '').split(',');
|
||||||
this.judgeUI.isDeductedPopShow = false
|
this.judgeUI.isDeductedPopShow = false
|
||||||
clearTimeout(this.deductedPopShowTimer)
|
clearTimeout(this.deductedPopShowTimer)
|
||||||
if(param512[7] != 0){
|
if (param512[7] != 0) {
|
||||||
this.judgeUI.isDeductedPopShow = true
|
this.judgeUI.isDeductedPopShow = true
|
||||||
this.judgeUI.defaultTabIndex = 1
|
this.judgeUI.defaultTabIndex = 1
|
||||||
}
|
}
|
||||||
@ -1864,7 +1864,7 @@ export default class Judge {
|
|||||||
//TODO 待优化 跨组件传值不生效
|
//TODO 待优化 跨组件传值不生效
|
||||||
globalThis.laneData = performInfo.lane;
|
globalThis.laneData = performInfo.lane;
|
||||||
//特殊扣分标记上传中心
|
//特殊扣分标记上传中心
|
||||||
if(performInfo.specialkf !== this.specialkf){
|
if (performInfo.specialkf !== this.specialkf) {
|
||||||
this.judgeUI.uploadMileage(performInfo.specialkf)
|
this.judgeUI.uploadMileage(performInfo.specialkf)
|
||||||
this.specialkf = performInfo.specialkf
|
this.specialkf = performInfo.specialkf
|
||||||
}
|
}
|
||||||
@ -1946,7 +1946,7 @@ export default class Judge {
|
|||||||
globalThis.udpEvent.onStopExam(async () => {
|
globalThis.udpEvent.onStopExam(async () => {
|
||||||
const config392 = (this.judgeUI.judgeConfigObj['392'] || '20,81').split(',');
|
const config392 = (this.judgeUI.judgeConfigObj['392'] || '20,81').split(',');
|
||||||
console.info(judgeTag, '开始远程终止考试扣分')
|
console.info(judgeTag, '开始远程终止考试扣分')
|
||||||
this.setJudgeMark(config392[0]*1, config392[1], 2);
|
this.setJudgeMark(config392[0] * 1, config392[1], 2);
|
||||||
})
|
})
|
||||||
|
|
||||||
this.checkExamIsEnd();
|
this.checkExamIsEnd();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user