feat:语音文件更新

This commit is contained in:
Surenjun 2024-07-02 10:02:22 +08:00
parent 3d5bba8022
commit 5524d0e7c9
418 changed files with 169 additions and 238 deletions

3
entry/.gitignore vendored
View File

@ -2,4 +2,5 @@
/.preview
/build
/.cxx
/.idea
/.idea
/oh_modules

View File

@ -98,8 +98,8 @@ struct Index {
const students = await getSyncData('USER')
const stuInfo = students[0] || {};
const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx} = stuInfo;
this.name = xm;
this.idCard = sfzmhm;
this.name = xm || '测试考生';
this.idCard = sfzmhm || '01234567891010';
this.lsh = lsh;
this.kszp = kszp;
this.ksdd = ksdd;
@ -405,7 +405,7 @@ struct Index {
? await this.initSystemKm2Param(systemparm)
: await this.initSystemKm3Param(systemparm)
//@ts-ignore
await this.initMarkRules(testMarkRules);
await this.initMarkRules(initDataObj.mark);
await this.initSysset(initDataObj.sysset);
}
@ -484,28 +484,43 @@ struct Index {
}.height(40)
Row() {
Flex({ direction: FlexDirection.Column }) {
List({}) {
ForEach(this.kfArr, (item) => {
ListItem() {
Column() {
Row() {
Text(item.xmmcStr).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
Text(`${item.score}分`).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
}
.width('100%')
.backgroundColor('#38260B')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ top: 12, bottom: 12, left: 8, right: 5 })
Text(item.desc)
.fontSize(this.BIGFONTSIZE)
.fontColor('#E5CBA1')
.margin({ top: 10, bottom: 8, left: 5, right: 5 })
}.margin({ top: 15 }).alignItems(HorizontalAlign.Start)
if(this.kfArr.length){
List({}) {
ForEach(this.kfArr, (item) => {
ListItem() {
Column() {
Row() {
Text(item.xmmcStr).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
Text(`${item.score}分`).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
}
.width('100%')
.backgroundColor('#38260B')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ top: 12, bottom: 12, left: 8, right: 5 })
Text(item.desc)
.fontSize(this.BIGFONTSIZE)
.fontColor('#E5CBA1')
.margin({ top: 10, bottom: 8, left: 5, right: 5 })
}.margin({ top: 15 }).alignItems(HorizontalAlign.Start)
}.margin({bottom:25})
})
}.padding({left:15,right:15,top:30,bottom:5})
}else{
Column() {
Row() {
Text('暂无扣分项').fontSize(this.BIGFONTSIZE).fontColor('#FFF')
}
.width('100%')
.backgroundColor('#38260B')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ top: 12, bottom: 12, left: 8, right: 3 })
}.margin({ top: 35 }).padding({left:20,right:20}).alignItems(HorizontalAlign.Start)
}
}.margin({bottom:25})
})
}.padding({left:15,right:15,top:30,bottom:5})
}
.backgroundImage($rawfile('judge/score_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
@ -640,7 +655,6 @@ struct Index {
})
}
Row(){
Row(){}.width(60).height(60).backgroundImage($rawfile('judge/phone.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' })
Text('呼叫请求').fontColor('#FFF').fontSize(32).padding({right:12})

View File

@ -1,146 +0,0 @@
import hilog from '@ohos.hilog';
import apiJudgeSdk from 'libJudgeSdk.so';
import Judge from './judgeSDK/utils/judge-real'
import {Project,ProjectObj,MarkRule} from './judgeSDK/api/judgeSDK.d'
import AccountTable from '../common/database/tables/AccountTable';
import MA_SYSSET from '../common//constants/MA_SYSSET';
import common from '@ohos.app.ability.common';
import { getSyncData } from '../common/service/initable'
@Entry
@Component
struct Index {
@State message: string = '开始绘制'
// 控制XComponent组件的创建和销毁
@State draw: boolean = false
//监管接口序列号
@State serialNumber:number = 0
//模拟考试项目
@State projects:Project[] = []
@State projectsObj:ProjectObj = {}
@State markRuleListObj:MarkRule ={}
private context = getContext(this) as common.UIAbilityContext;
// xcomponentController: XComponentController = new XComponentController()
build() {
Row() {
Column() {
if (this.draw) {
XComponent({
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称注意这个ID要和C++侧一致,不能变
type: 'surface',
libraryname: 'JudgeSdk'
})
.width(640)
.height(480)
.onLoad(() => {
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制
hilog.info(0x0000, 'sdk-tag-ets', 'onLoad');
})
.onDestroy(() => {
hilog.info(0x0000, 'sdk-tag-ets', 'onDestroy');
apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹false:表示结束绘制
})
} else {
Column() {}
.width(640/2)
.height(480/2)
}
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.fontColor('rgba(255,255,255,0)')
.onClick(() => {
hilog.info(0x0000, 'sdk-tag-ets', 'start render');
// 控制XComponent组件的创建和销毁创建XComponent组件时会调用libentry.so中的模块注册函数Init
this.draw = !this.draw;
clearInterval(globalThis.realTimer)
})
}
.width('100%')
.backgroundColor('#777777')
}
.height('100%')
}
async aboutToAppear() {
await this.initMarkRules();
//初始化项目
await this.initProjectInfo();
//初始化sysset表
await this.initSysset()
const judge = new Judge(this)
}
//获取项目信息
async initProjectInfo(){
const that = this;
const systemParamsArr = await getSyncData('MA_SYSTEMPARM')
const itemInfoArr = await getSyncData('MA_ITEMINFO')
//@ts-ignore
const filterProjectsArr = systemParamsArr.filter(item => item.no1 == 6)
that.projects = filterProjectsArr.map(project => {
//TODO 临时代码
const testType= {
0:1,
2:4,
3:3,
5:5,
6:2
}
const currentProject = {
name:decodeURI(project.txt1),
abbreviation:decodeURI(project.txt3),
projectCode:decodeURI(project.no2),
projectCodeCenter:decodeURI(project.txt2),
//@ts-ignore
type:testType[decodeURI(project.no2)*1]
// type:'0' + (project.type || '1')
}
that.projectsObj[project.no2] = currentProject
return currentProject
});
}
//获取扣分代码信息
async initMarkRules(){
const that = this;
const markRuleParams = await getSyncData('MA_MARKRULE')
//@ts-ignore
markRuleParams.forEach(mark=>{
that.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = {
itemno:mark.itemno*1,
markcatalog:mark.markcatalog,
markshow:decodeURI(mark.markshow),
markreal:mark.markreal*1,
markserial:mark.markserial
};
})
}
// 获取sysset表信息
async initSysset(){
const that = this;
const db = new AccountTable(()=>{},MA_SYSSET);
const syssetParams = await getSyncData('MA_SYSSET')
//@ts-ignore
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901');
that.serialNumber = serialNumberArr || '1234567'
}
aboutToDisappear() {
//apiJudgeSdk.stopRender();
}
}

View File

@ -14,7 +14,7 @@ const amplifyArrs = [
]
@Component
struct EndPopup {
export default struct EndPopup {
constructor() {
super()
}
@ -35,5 +35,3 @@ struct EndPopup {
.onClick(()=>{this.closeAmplifyPop()})
}
}
export default EndPopup

View File

@ -5,7 +5,7 @@ interface SEL{
}
@Component
struct DeductedPopup {
export default struct DeductedPopup {
constructor() {
super()
}
@ -149,6 +149,4 @@ struct DeductedPopup {
.onClick(()=>{this.closePopup()})
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
}
}
export default DeductedPopup
}

View File

@ -1,6 +1,6 @@
@Component
struct EndPopup {
export default struct EndPopup {
constructor() {
super()
}
@ -22,6 +22,4 @@ struct EndPopup {
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
}
}
export default EndPopup
}

View File

@ -1,6 +1,5 @@
@Component
struct LoadingPopup {
export default struct LoadingPopup {
constructor() {
super()
}
@ -17,5 +16,3 @@ struct LoadingPopup {
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
}
}
export default LoadingPopup

View File

@ -4,13 +4,8 @@ import apiJudgeSdk from 'libJudgeSdk.so';
// import apiJudgeSdk from '@ohos.judgesdk';
import Judge from '../../judgeSDK/utils/judge-real'
// import Judge from '../../judgeSDK/judge-track-playback'
import {Project,ProjectObj,MarkRule} from '../../judgeSDK/api/judgeSDK.d'
import AccountTable from '../../../common/database/tables/AccountTable';
import MA_SYSSET from '../../../common//constants/MA_SYSSET';
import common from '@ohos.app.ability.common';
import { getSyncData } from '../../../common/service/initable'
import {testAllitems,testUIAllitems,testMarkRules} from '../../judgeSDK/dataTest/index'
@Component
struct RealTime {

View File

@ -1,27 +0,0 @@
@Component
struct EndPopup {
constructor() {
super()
}
private title:string = ''
private cancelFn:(event?: ClickEvent) => void
private confirmFn:(event?: ClickEvent) => void
build(){
Column(){
Column(){
Text(this.title).fontSize(38).margin({bottom:20})
Row(){}.height(50)
Row(){
Text('取消').backgroundImage($rawfile('judge/end-btn.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(250).height(100).fontSize(30).fontColor('#FFF').textAlign(TextAlign.Center).onClick(this.cancelFn)
Text('确定').backgroundImage($rawfile('judge/end-btn.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(250).height(100).fontSize(30).fontColor('#FFF').textAlign(TextAlign.Center).margin({left:45}).onClick(this.confirmFn)
}
}.width('80%').height('70%').backgroundColor('#E6E3DF').borderRadius(38).position({y:'12%',x:'10%'}).justifyContent(FlexAlign.Center)
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
}
}
export default EndPopup

View File

@ -3116,7 +3116,6 @@ export const testMarkRules = [{
}, {
"itemno": "41",
"markcatalog": "41603",
"markdepend": "通过急弯、坡路、拱桥、人行横道或者没有交通信号灯控制的路口时,不交替使用远近光灯示意",
"markreal": "-100",

View File

@ -19,7 +19,8 @@ import { judgeConfig } from './utils/judge-config'
import {writeObjectOut,uploadExamProgressData} from '../../api/judge'
import {deepClone,getCurrentTime,stringToASC,string2Bytes,fillZero,Array2Byte,convertGpsCoord2} from '../../common/utils/tools'
import {getTranslateSignals,getCarStatus,getCarStatusType,getCenterProjectStatus,plcStrToJson,plcStrToWXJson,promptWxCode,getKmProjectVoice,senorToWXDataStr} from './utils//judge-common'
import {examJudgeSetLogCallback,examJudgeBeginExam,examJudgeInit,examJudgeRealExam,examJudgeSetRealExamCallback,examJudgeSetPerformCallback,examJudgeEndExam,examJudgeArtificialMark,examJudgeArtificialItem} from './api/index'
import {examJudgeSetLogCallback,examJudgeBeginExam,examJudgeInit,examJudgeRealExam,examJudgeSetRealExamCallback,examJudgeSetPerformCallback,examJudgeEndExam,examJudgeArtificialMark,examJudgeArtificialItem
,examJudgeMapSetScaling,examJudgeMapSetParam} from './api/index'
import UsbService from '../../common/service/usbService'
import prompt from '@ohos.prompt';
@ -89,7 +90,7 @@ export default class Judge{
}
//日志回调
console.info(judgeTag,'1.进入评判入口')
await examJudgeSetLogCallback(3, async (level, info,len)=>{
await examJudgeSetLogCallback(6, async (level, info,len)=>{
console.log('评判日志:' + info)
await fileLog.setExamJudgeLogData(info);
})
@ -134,12 +135,19 @@ export default class Judge{
console.info(judgeTag,'6.开始考试注册完成')
avPlayer.playAudio(['voice/ksks.WAV'])
await examJudgeMapSetParam(640, 480); //设置参数宽、高
await examJudgeMapSetScaling(120); //设置缩放比例一般默认填100就是100%的意思) 数字越大视野越大数字越小视野越小不能为0
this.judgeUI.draw = true
// 处理轨迹plc信息
if(isTrajectoryOpen){
handleTrajectoryUdp(strArr);
return
}
// 处理实时udp里的plc信号
globalThis.udpClient.onMessage(async (msg) => {
handleUdp(msg)
@ -254,12 +262,15 @@ export default class Judge{
const {xmdm,code} = sound;
//判断是不是模拟灯光语音
const isLight = code.slice(0,3) === '417';
console.info(judgeTag,'评判语音提示' + JSON.stringify(sound))
if(isLight){
console.info(judgeTag,'模拟灯光开始播放:' + code)
}
avPlayer.playAudio([`voice/${code}.mp3`],true,()=>{
if(isLight){
this.wav = 1;
console.info(judgeTag,'模拟灯光播放代码:' + code)
console.info(judgeTag,'播放结束:' + code)
setTimeout(()=>{
this.wav = 1;
})
}
})
@ -314,10 +325,10 @@ export default class Judge{
// 扣分
case 3:
avPlayer.playAudio([`voice/${kf[kfLen -1].markcatalog}.mp3`])
// avPlayer.playAudio([`voice/${kf[kfLen -1].markcatalog}.mp3`])
await judgeTask.addTask(async ()=>{
console.info(judgeTag,`项目扣分-${kf[kfLen -1].markcatalog}-${kf[kfLen -1].desc}`)
await pointsDedute(kf[kfLen -1].xmdm,kf[kfLen -1])
// await pointsDedute(kf[kfLen -1].xmdm,kf[kfLen -1])
})
break;
@ -946,7 +957,6 @@ export default class Judge{
if(usbService.isWXUSBDevice){
usbService.sendUSB(str)
}
console.info(judgeTag,str)
await examJudgeRealExam(msg)
num++
},200)

View File

@ -9,9 +9,8 @@ export const judgeConfig = {
// 本地模型地址
modelPath: 'models/model_enc',
// 轨迹回放地址
trajectoryPath: 'logs/0000000000001_342323199501470011_测试学员1_1970_01_01_08_44_33/judge_exam_data.txt'
trajectoryPath: 'logs/2024_06_18/0000000000001_342323199501470011_测试学员1_2024_06_26_10_04_23/judge_exam_data.txt'
}
//0000000000001_342323199501470011_测试学员1_2024_04_28_10_59_44
// 模拟灯光轨迹
// test_sub3_car_test_jinan-32038219990808021X-20240417092356.txt

View File

@ -1,11 +1,5 @@
import {
examJudgeSetLogCallback,
examJudgeBeginExam,
examJudgeInit,
examJudgeRealExam,
examJudgeSetRealExamCallback,
examJudgeMapSetParam,
examJudgeMapSetDrawing,
examJudgeMapSetScaling
} from '../api/index'
import systemTime from '@ohos.systemDateTime';

View File

@ -17,7 +17,7 @@ export default class JudgeTask{
try {
await currentTask();
}catch (e){
console.info(TAG,'过程数据接口解析错误')
// console.info(TAG,'过程数据接口解析错误')
prompt.showToast({
message: '过程数据接口解析错误',
duration: 3000

View File

@ -9,7 +9,6 @@
"pages/TerminalInfos",
"pages/VideoConfig",
"pages/SignDisplay",
"pages/RealTime",
"pages/Roads",
"pages/Judge"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More