逻辑优化
This commit is contained in:
parent
b446c9442a
commit
7645ab8c14
@ -134,10 +134,13 @@ struct Index {
|
|||||||
}, router.RouterMode.Single)
|
}, router.RouterMode.Single)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async heartMsg() {
|
async heartMsg() {
|
||||||
|
|||||||
@ -884,14 +884,25 @@ struct UserInfo {
|
|||||||
const {carId,examinationRoomId} = carInfo;
|
const {carId,examinationRoomId} = carInfo;
|
||||||
let examItems = { getExaminationItemRsp: { body: { ykxx: '', jdxx: '' } } };
|
let examItems = { getExaminationItemRsp: { body: { ykxx: '', jdxx: '' } } };
|
||||||
if (!globalThis.singlePlay) {
|
if (!globalThis.singlePlay) {
|
||||||
//获取已考项目
|
try {
|
||||||
// @ts-ignore
|
|
||||||
examItems = await getExaminationItem({
|
//获取已考项目
|
||||||
time: getCurrentTime(),
|
// @ts-ignore
|
||||||
carId,
|
examItems = await getExaminationItem({
|
||||||
lsh: this.currentUser.lsh || '',
|
time: getCurrentTime(),
|
||||||
examinationRoomId
|
carId,
|
||||||
});
|
lsh: this.currentUser.lsh || '',
|
||||||
|
examinationRoomId
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
promptAction.showToast({
|
||||||
|
message: "获取考试信息失败,请重试",
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
this.isLoadingPopupVisible = false
|
||||||
|
this.isExamStart = false
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.currentUser.id = '1'
|
this.currentUser.id = '1'
|
||||||
const avPlayer = this.avPlayer;
|
const avPlayer = this.avPlayer;
|
||||||
@ -899,66 +910,74 @@ struct UserInfo {
|
|||||||
|
|
||||||
avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => {
|
avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => {
|
||||||
console.info('surenjun', '播放结束开始考试接口调用')
|
console.info('surenjun', '播放结束开始考试接口调用')
|
||||||
const {code,keystr,message} = await this.beginExam() || {};
|
try {
|
||||||
console.info('surenjun', '开始考试接口调用结束')
|
const {code,keystr,message} = await this.beginExam() || {};
|
||||||
// console.info('surenjun',code +'')
|
console.info('surenjun', '开始考试接口调用结束')
|
||||||
//@ts-ignore TODO code转换
|
|
||||||
|
|
||||||
if (code != 1) {
|
if (code != 1) {
|
||||||
avPlayer.playAudio([code == -200 ? 'voice/photo_error.mp3' : 'voice/监管审核未通过.mp3']);
|
avPlayer.playAudio([code == -200 ? 'voice/photo_error.mp3' : 'voice/监管审核未通过.mp3']);
|
||||||
|
this.isLoadingPopupVisible = false
|
||||||
|
this.isExamStart = false
|
||||||
|
promptAction.showToast({
|
||||||
|
message,
|
||||||
|
duration: 4000
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.currentUser.id = '0'
|
||||||
|
await upDateTableByArray('USER', [this.currentUser])
|
||||||
|
this.stepFlag = false
|
||||||
|
this.isLoadingPopupVisible = false
|
||||||
|
let kStringArr = decodeURIComponent(keystr || '').split(",").filter(item => item)
|
||||||
|
console.log("lixiao kStringArr", JSON.stringify(kStringArr))
|
||||||
|
await this.getExamMode(kStringArr)
|
||||||
|
console.log("lixiao mode", this.mode)
|
||||||
|
let score = Number(this.currentUser.jdxx?.split("^")[0])
|
||||||
|
let kfxm = this.currentUser.jdxx?.split("^")[1]
|
||||||
|
if (this.mode === 2 && !this.currentUser.jdxx) {
|
||||||
|
promptAction.showToast({
|
||||||
|
message: "当前尚未进行白考,无法开始夜考!"
|
||||||
|
})
|
||||||
|
this.updateTimeLimit = false
|
||||||
|
this.stopDeviceById()
|
||||||
|
this.stepFlag = false
|
||||||
|
this.ksksLimit = false
|
||||||
|
return
|
||||||
|
} else if (this.mode === 1 && this.currentUser.jdxx) {
|
||||||
|
promptAction.showToast({
|
||||||
|
message: "当前尚未进入夜考时间,无法开始夜考!"
|
||||||
|
})
|
||||||
|
this.updateTimeLimit = false
|
||||||
|
this.stopDeviceById()
|
||||||
|
this.stepFlag = false
|
||||||
|
this.ksksLimit = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
router.pushUrl({
|
||||||
|
url: 'pages/Judge',
|
||||||
|
params: {
|
||||||
|
examItems: [examItems?.getExaminationItemRsp?.body?.ykxx, kfxm],
|
||||||
|
sczb: Number(this.isBoardPrePareSetPopupOpen),
|
||||||
|
kfdm: this.sczbkf,
|
||||||
|
mode: this.mode,
|
||||||
|
//真实监管项目
|
||||||
|
kString: decodeURIComponent(keystr || ''),
|
||||||
|
// 白考分数
|
||||||
|
score
|
||||||
|
}
|
||||||
|
}, router.RouterMode.Single);
|
||||||
|
this.updateTimeLimit = false
|
||||||
|
this.stopDeviceById()
|
||||||
|
this.stepFlag = false
|
||||||
|
} catch (e) {
|
||||||
|
promptAction.showToast({
|
||||||
|
message: "监管审核失败,请重试",
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
this.isLoadingPopupVisible = false
|
this.isLoadingPopupVisible = false
|
||||||
this.isExamStart = false
|
this.isExamStart = false
|
||||||
promptAction.showToast({
|
|
||||||
message,
|
|
||||||
duration: 4000
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.currentUser.id = '0'
|
|
||||||
await upDateTableByArray('USER', [this.currentUser])
|
|
||||||
this.stepFlag = false
|
|
||||||
this.isLoadingPopupVisible = false
|
|
||||||
let kStringArr = decodeURIComponent(keystr || '').split(",").filter(item => item)
|
|
||||||
console.log("lixiao kStringArr", JSON.stringify(kStringArr))
|
|
||||||
await this.getExamMode(kStringArr)
|
|
||||||
console.log("lixiao mode", this.mode)
|
|
||||||
let score = Number(this.currentUser.jdxx?.split("^")[0])
|
|
||||||
let kfxm = this.currentUser.jdxx?.split("^")[1]
|
|
||||||
if (this.mode === 2 && !this.currentUser.jdxx) {
|
|
||||||
promptAction.showToast({
|
|
||||||
message: "当前尚未进行白考,无法开始夜考!"
|
|
||||||
})
|
|
||||||
this.updateTimeLimit = false
|
|
||||||
this.stopDeviceById()
|
|
||||||
this.stepFlag = false
|
|
||||||
this.ksksLimit = false
|
|
||||||
return
|
|
||||||
} else if (this.mode === 1 && this.currentUser.jdxx) {
|
|
||||||
promptAction.showToast({
|
|
||||||
message: "当前尚未进入夜考时间,无法开始夜考!"
|
|
||||||
})
|
|
||||||
this.updateTimeLimit = false
|
|
||||||
this.stopDeviceById()
|
|
||||||
this.stepFlag = false
|
|
||||||
this.ksksLimit = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
router.pushUrl({
|
|
||||||
url: 'pages/Judge',
|
|
||||||
params: {
|
|
||||||
examItems: [examItems?.getExaminationItemRsp?.body?.ykxx, kfxm],
|
|
||||||
sczb: Number(this.isBoardPrePareSetPopupOpen),
|
|
||||||
kfdm: this.sczbkf,
|
|
||||||
mode: this.mode,
|
|
||||||
//真实监管项目
|
|
||||||
kString: decodeURIComponent(keystr || ''),
|
|
||||||
// 白考分数
|
|
||||||
score
|
|
||||||
}
|
|
||||||
}, router.RouterMode.Single);
|
|
||||||
this.updateTimeLimit = false
|
|
||||||
this.stopDeviceById()
|
|
||||||
this.stepFlag = false
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1320,122 +1320,132 @@ export default class Judge {
|
|||||||
const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI
|
const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI
|
||||||
//TODO 断网考试结束补传
|
//TODO 断网考试结束补传
|
||||||
// await uploadDisConnectData();
|
// await uploadDisConnectData();
|
||||||
const time = await getCurrentTime();
|
try {
|
||||||
const photoBase64 = await getPhoto();
|
const time = await getCurrentTime();
|
||||||
const {d1,d2,d3,d4,d5} = ksjs
|
const photoBase64 = await getPhoto();
|
||||||
const data = {
|
const {d1,d2,d3,d4,d5} = ksjs
|
||||||
xtlb: '17', jkxlh: serialNumber, jkid: '17C56',
|
const data = {
|
||||||
drvexam: {
|
xtlb: '17', jkxlh: serialNumber, jkid: '17C56',
|
||||||
lsh,
|
drvexam: {
|
||||||
kchp: encodeURI(plateNo),
|
lsh,
|
||||||
kskm: examSubject,
|
kchp: encodeURI(plateNo),
|
||||||
sfzmhm: idCard,
|
kskm: examSubject,
|
||||||
//@ts-ignore
|
sfzmhm: idCard,
|
||||||
zp: photoBase64,
|
//@ts-ignore
|
||||||
jssj: time,
|
zp: photoBase64,
|
||||||
kscj: (totalScore * 1) > 0 ? totalScore : 0,
|
jssj: time,
|
||||||
kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100),
|
kscj: (totalScore * 1) > 0 ? totalScore : 0,
|
||||||
// 1,22;2,560;3,128;4,0;5,0;
|
kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100),
|
||||||
dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'),
|
// 1,22;2,560;3,128;4,0;5,0;
|
||||||
|
dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
let backTimeOut = setTimeout(() => {
|
||||||
let backTimeOut = setTimeout(() => {
|
router.back()
|
||||||
router.back()
|
}, 90 * 1000)
|
||||||
}, 90 * 1000)
|
const {code,keystr,message} = await this.sendWriteObjectOut(data, filePath);
|
||||||
const {code,keystr,message} = await this.sendWriteObjectOut(data, filePath);
|
promptWxCode('17C56', code)
|
||||||
promptWxCode('17C56', code)
|
|
||||||
|
|
||||||
if (code != 1) {
|
if (code != 1) {
|
||||||
avPlayer.playAudio(['voice/监管失败.mp3'])
|
avPlayer.playAudio(['voice/监管失败.mp3'])
|
||||||
this.judgeUI.errorMsg = decodeURIComponent(message)
|
this.judgeUI.errorMsg = decodeURIComponent(message)
|
||||||
|
|
||||||
if (code == 2300028 || code == 2300007) {
|
if (code == 2300028 || code == 2300007) {
|
||||||
this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!'
|
this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!'
|
||||||
|
}
|
||||||
|
this.isUdpEnd = true;
|
||||||
|
closeAllFiles()
|
||||||
|
this.judgeUI.loadingPopupVisible = false;
|
||||||
|
return
|
||||||
}
|
}
|
||||||
this.isUdpEnd = true;
|
console.info(judgeTag, '考试结束 end')
|
||||||
closeAllFiles()
|
const param302 = judgeConfigObj['302'];
|
||||||
this.judgeUI.loadingPopupVisible = false;
|
judgeUI.loadingPopupVisible = true;
|
||||||
return
|
let currentKssycs = 0;
|
||||||
}
|
let voiceURL = ''
|
||||||
console.info(judgeTag, '考试结束 end')
|
if (examSubject == 2) {
|
||||||
const param302 = judgeConfigObj['302'];
|
if (isAllProjectsEnd) {
|
||||||
judgeUI.loadingPopupVisible = true;
|
voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3')
|
||||||
let currentKssycs = 0;
|
} else {
|
||||||
let voiceURL = ''
|
voiceURL = `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav`
|
||||||
if (examSubject == 2) {
|
currentKssycs = kssycs == 1 ? 0 : 1
|
||||||
if (isAllProjectsEnd) {
|
}
|
||||||
voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3')
|
switch (voiceURL) {
|
||||||
} else {
|
case 'voice/unqualified_one.wav':
|
||||||
voiceURL = `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav`
|
currentKssycs = 0;
|
||||||
currentKssycs = kssycs == 1 ? 0 : 1
|
break;
|
||||||
}
|
|
||||||
switch (voiceURL) {
|
|
||||||
case 'voice/unqualified_one.wav':
|
|
||||||
currentKssycs = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'voice/unqualified_two.wav':
|
case 'voice/unqualified_two.wav':
|
||||||
currentKssycs = 1;
|
currentKssycs = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'voice/qualified.mp3':
|
case 'voice/qualified.mp3':
|
||||||
currentKssycs = 0;
|
currentKssycs = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (examSubject == 3) {
|
||||||
if (examSubject == 3) {
|
console.log(judgeTag, "exam end", isAllProjectsEnd);
|
||||||
console.log(judgeTag, "exam end", isAllProjectsEnd);
|
if (isAllProjectsEnd) {
|
||||||
if (isAllProjectsEnd) {
|
if (totalScore < passingScore) {
|
||||||
if (totalScore < passingScore) {
|
voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3`
|
||||||
|
currentKssycs = kssycs == 1 ? 0 : 1
|
||||||
|
} else {
|
||||||
|
voiceURL = 'voice/exam_pass.mp3'
|
||||||
|
currentKssycs = 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3`
|
voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3`
|
||||||
currentKssycs = kssycs == 1 ? 0 : 1
|
currentKssycs = kssycs == 1 ? 0 : 1
|
||||||
} else {
|
|
||||||
voiceURL = 'voice/exam_pass.mp3'
|
|
||||||
currentKssycs = 0
|
|
||||||
}
|
}
|
||||||
} else {
|
switch (voiceURL) {
|
||||||
voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3`
|
case 'voice/exam_no_pass_finish.mp3':
|
||||||
currentKssycs = kssycs == 1 ? 0 : 1
|
currentKssycs = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'voice/exam_no_pass.mp3':
|
||||||
|
currentKssycs = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'voice/exam_pass.mp3':
|
||||||
|
currentKssycs = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switch (voiceURL) {
|
|
||||||
case 'voice/exam_no_pass_finish.mp3':
|
|
||||||
currentKssycs = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'voice/exam_no_pass.mp3':
|
const USER = await getSyncData('USER');
|
||||||
currentKssycs = 1;
|
await upDateTableByArray('USER', [{
|
||||||
break;
|
...USER[0],
|
||||||
|
kssycs: currentKssycs
|
||||||
case 'voice/exam_pass.mp3':
|
}])
|
||||||
currentKssycs = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
console.info(judgeTag, `考试成绩:${totalScore}`)
|
||||||
|
if (!singlePlay) {
|
||||||
|
// await uploadProgressData();
|
||||||
}
|
}
|
||||||
}
|
clearTimeout(backTimeOut)
|
||||||
|
//语音播放扣分项
|
||||||
const USER = await getSyncData('USER');
|
let score = 0;
|
||||||
await upDateTableByArray('USER', [{
|
//结束考试时候是否播报一遍所有扣分
|
||||||
...USER[0],
|
const param634 = judgeConfigObj['634'];
|
||||||
kssycs: currentKssycs
|
if (kfArr.length && ((examSubject == 2 && param634 == 1) || examSubject == 3)) {
|
||||||
}])
|
avPlayer.playAudio([`voice/kfdesc.mp3`], false, () => {
|
||||||
|
try {
|
||||||
console.info(judgeTag, `考试成绩:${totalScore}`)
|
kfArr.forEach((kf, index) => {
|
||||||
if (!singlePlay) {
|
score += Math.abs(Number(kf.score));
|
||||||
// await uploadProgressData();
|
//TODO 考试分数待替换
|
||||||
}
|
if (score <= (examSubject == 3 ? 10 : 20)) {
|
||||||
clearTimeout(backTimeOut)
|
if (kfArr.length - 1 === index) {
|
||||||
//语音播放扣分项
|
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
|
||||||
let score = 0;
|
this.isUdpEnd = true;
|
||||||
//结束考试时候是否播报一遍所有扣分
|
closeAllFiles()
|
||||||
const param634 = judgeConfigObj['634'];
|
router.back();
|
||||||
if (kfArr.length && ((examSubject == 2 && param634 == 1) || examSubject == 3)) {
|
})
|
||||||
avPlayer.playAudio([`voice/kfdesc.mp3`], false, () => {
|
throw new Error('End Loop')
|
||||||
try {
|
}
|
||||||
kfArr.forEach((kf, index) => {
|
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`])
|
||||||
score += Math.abs(Number(kf.score));
|
} else {
|
||||||
//TODO 考试分数待替换
|
|
||||||
if (score <= (examSubject == 3 ? 10 : 20)) {
|
|
||||||
if (kfArr.length - 1 === index) {
|
|
||||||
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
|
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
|
||||||
this.isUdpEnd = true;
|
this.isUdpEnd = true;
|
||||||
closeAllFiles()
|
closeAllFiles()
|
||||||
@ -1443,30 +1453,27 @@ export default class Judge {
|
|||||||
})
|
})
|
||||||
throw new Error('End Loop')
|
throw new Error('End Loop')
|
||||||
}
|
}
|
||||||
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`])
|
})
|
||||||
} else {
|
} catch (e) {
|
||||||
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
|
console.info(judgeTag, JSON.stringify(e))
|
||||||
this.isUdpEnd = true;
|
}
|
||||||
closeAllFiles()
|
})
|
||||||
router.back();
|
} else {
|
||||||
})
|
avPlayer.playAudio([voiceURL], true, () => {
|
||||||
throw new Error('End Loop')
|
setTimeout(() => {
|
||||||
}
|
this.isUdpEnd = true
|
||||||
})
|
closeAllFiles()
|
||||||
} catch (e) {
|
router.back();
|
||||||
console.info(judgeTag, JSON.stringify(e))
|
}, param302 == 8 ? 3000 : 0)
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
} else {
|
} catch (e) {
|
||||||
avPlayer.playAudio([voiceURL], true, () => {
|
promptAction.showToast({
|
||||||
setTimeout(() => {
|
message: "考试结束异常,请尝试重新结束",
|
||||||
this.isUdpEnd = true
|
duration: 3000
|
||||||
closeAllFiles()
|
|
||||||
router.back();
|
|
||||||
}, param302 == 8 ? 3000 : 0)
|
|
||||||
})
|
})
|
||||||
|
judgeUI.loadingPopupVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前项目转换
|
// 当前项目转换
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user