Compare commits
5 Commits
a9cdc3c552
...
d461cca1c4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d461cca1c4 | ||
|
|
a8bf95df5f | ||
|
|
0f564b746a | ||
|
|
dee00b45cf | ||
|
|
5a8b3d314f |
@ -2,6 +2,11 @@
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
"externalNativeOptions": {
|
||||
"abiFilters": [
|
||||
"arm64-v8a",
|
||||
"armeabi-v7a",
|
||||
"x86_64"
|
||||
],
|
||||
"path": "./src/main/cpp/CMakeLists.txt",
|
||||
"arguments": "",
|
||||
"cppFlags": "",
|
||||
@ -16,5 +21,5 @@
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
],
|
||||
}
|
||||
@ -1,6 +1,12 @@
|
||||
import request from '../utils/Request'
|
||||
import http from '@ohos.net.http'
|
||||
import { FaceCompareResp, GetExaminationItemRsp, GetExaminationStudentInfoResponse } from '../model'
|
||||
import {
|
||||
ApiResponseType,
|
||||
ExaminationStuAbsentParams,
|
||||
FaceCompareResp,
|
||||
GetExaminationItemRsp,
|
||||
GetExaminationStudentInfoResponse
|
||||
} from '../model'
|
||||
|
||||
/**
|
||||
* 照片比对
|
||||
@ -49,10 +55,19 @@ export async function getExaminationStudentInfo(params: ESObject) {
|
||||
}
|
||||
|
||||
//缺考
|
||||
export async function examinationStuAbsent(params: object) {
|
||||
return request({
|
||||
export async function examinationStuAbsent(params: ExaminationStuAbsentParams) {
|
||||
return request<ApiResponseType>({
|
||||
url: '/der2/services/exam/examinationStuAbsent.ws',
|
||||
data: params,
|
||||
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<examinationStuAbsentReq>
|
||||
<body>
|
||||
<carId>${params.carId}</carId>
|
||||
<cardNo>${params.sfzmhm}</cardNo>
|
||||
<examinationRoomId>${params.examinationRoomId}</examinationRoomId>
|
||||
<examinerName>${params.username}</examinerName>
|
||||
<lsh>${params.lsh}</lsh>
|
||||
</body>
|
||||
</examinationStuAbsentReq>`,
|
||||
method: http.RequestMethod.POST,
|
||||
xml: true
|
||||
})
|
||||
|
||||
@ -3,4 +3,7 @@ export const DbTag = '[DBTag]';
|
||||
export const SerialPortTag = '[SerialPortTag]';
|
||||
|
||||
// usb tag
|
||||
export const UsbTag = '[UsbTag]';
|
||||
export const UsbTag = '[UsbTag]';
|
||||
|
||||
//voice tag
|
||||
export const VoiceTag = '[VoiceTag]';
|
||||
@ -94,38 +94,70 @@ export const StackValueData = {
|
||||
29: "",
|
||||
}
|
||||
|
||||
export const WarnFlagTipData = {
|
||||
0: [],
|
||||
1: [],
|
||||
2: [],
|
||||
3: ['check1.wav', 'check2.wav'],
|
||||
4: ['check3.wav', 'check4.wav'],
|
||||
5: ['check5.wav', 'check6.wav'],
|
||||
6: ['check7.wav', 'check8.wav'],
|
||||
7: ['check9.wav', 'check10.wav'],
|
||||
8: ['check26.wav', 'check27.wav'],
|
||||
9: ['dianhuoVideo.wav', 'xihuoVideo.wav'],
|
||||
10: ['check31.wav'],
|
||||
11: ['check30.wav'],
|
||||
12: ['check28.wav'],
|
||||
13: ['check29.wav'],
|
||||
14: ['check11.wav'],
|
||||
15: ['check12.wav'],
|
||||
16: ['check13.wav'],
|
||||
17: ['check14.wav'],
|
||||
18: ['check15.wav'],
|
||||
19: ['check16.wav'],
|
||||
20: ['check17.wav'],
|
||||
21: ['check18.wav'],
|
||||
22: ['check19.wav'],
|
||||
23: ['check22.wav'],
|
||||
24: ['check23.wav'],
|
||||
25: ['check20.wav', 'check21.wav'],
|
||||
26: ['check24.wav'],
|
||||
// 27:[],
|
||||
// 28:[],
|
||||
// 29:[],
|
||||
}
|
||||
// export const WarnFlagTipData = {
|
||||
// 0: [],
|
||||
// 1: [],
|
||||
// 2: [],
|
||||
// 3: ['check1.wav', 'check2.wav'],
|
||||
// 4: ['check3.wav', 'check4.wav'],
|
||||
// 5: ['check5.wav', 'check6.wav'],
|
||||
// 6: ['check7.wav', 'check8.wav'],
|
||||
// 7: ['check9.wav', 'check10.wav'],
|
||||
// 8: ['check26.wav', 'check27.wav'],
|
||||
// 9: ['dianhuoVideo.wav', 'xihuoVideo.wav'],
|
||||
// 10: ['check31.wav'],
|
||||
// 11: ['check30.wav'],
|
||||
// 12: ['check28.wav'],
|
||||
// 13: ['check29.wav'],
|
||||
// 14: ['check11.wav'],
|
||||
// 15: ['check12.wav'],
|
||||
// 16: ['check13.wav'],
|
||||
// 17: ['check14.wav'],
|
||||
// 18: ['check15.wav'],
|
||||
// 19: ['check16.wav'],
|
||||
// 20: ['check17.wav'],
|
||||
// 21: ['check18.wav'],
|
||||
// 22: ['check19.wav'],
|
||||
// 23: ['check22.wav'],
|
||||
// 24: ['check23.wav'],
|
||||
// 25: ['check20.wav', 'check21.wav'],
|
||||
// 26: ['check24.wav'],
|
||||
// // 27:[],
|
||||
// // 28:[],
|
||||
// // 29:[],
|
||||
// }
|
||||
export const WarnFlagTipData = new Map<number, string[]>([
|
||||
[0, []],
|
||||
[1, []],
|
||||
[2, []],
|
||||
[3, ['check1.wav', 'check2.wav']],
|
||||
[4, ['check3.wav', 'check4.wav']],
|
||||
[5, ['check5.wav', 'check6.wav']],
|
||||
[6, ['check7.wav', 'check8.wav']],
|
||||
[7, ['check9.wav', 'check10.wav']],
|
||||
[8, ['check26.wav', 'check27.wav']],
|
||||
[9, ['dianhuoVideo.wav', 'xihuoVideo.wav']],
|
||||
[10, ['check31.wav']],
|
||||
[11, ['check30.wav']],
|
||||
[12, ['check28.wav']],
|
||||
[13, ['check29.wav']],
|
||||
[14, ['check11.wav']],
|
||||
[15, ['check12.wav']],
|
||||
[16, ['check13.wav']],
|
||||
[17, ['check14.wav']],
|
||||
[18, ['check15.wav']],
|
||||
[19, ['check16.wav']],
|
||||
[20, ['check17.wav']],
|
||||
[21, ['check18.wav']],
|
||||
[22, ['check19.wav']],
|
||||
[23, ['check22.wav']],
|
||||
[24, ['check23.wav']],
|
||||
[25, ['check20.wav', 'check21.wav']],
|
||||
[26, ['check24.wav']],
|
||||
// 27:[],
|
||||
// 28:[],
|
||||
// 29:[],
|
||||
]);
|
||||
|
||||
export const RealNumData = {
|
||||
3: 19,
|
||||
@ -154,7 +186,7 @@ export const RealNumData = {
|
||||
26: ''
|
||||
}
|
||||
|
||||
export const DwMapData={
|
||||
export const DwMapData = {
|
||||
14: '1',
|
||||
15: '2',
|
||||
16: '3',
|
||||
|
||||
@ -98,6 +98,7 @@ export interface RouteParamsType {
|
||||
wayno?: string;
|
||||
kString?: string;
|
||||
examItems?: string;
|
||||
fromIndex?: boolean;
|
||||
}
|
||||
|
||||
// 车辆信息
|
||||
|
||||
@ -11,6 +11,13 @@ export interface ApiResponseType {
|
||||
|
||||
// 时间同步 /der2/services/exam/timeSynchronization.ws
|
||||
timeSynchronizationRsp?: TimeSynchronizationRsp;
|
||||
|
||||
// 缺考
|
||||
examinationStuAbsentRsp?: ExaminationStuAbsentRsp
|
||||
}
|
||||
|
||||
interface ExaminationStuAbsentRsp {
|
||||
head: Head
|
||||
}
|
||||
|
||||
interface TimeSynchronizationRsp {
|
||||
@ -163,7 +170,6 @@ export interface BeginExamRequest {
|
||||
code?: number
|
||||
}
|
||||
|
||||
// { getExaminationItemRsp: { body: { ykxx: '' } } }
|
||||
export interface GetExaminationItemRsp {
|
||||
getExaminationItemRsp: GetExaminationItemRspDetails
|
||||
}
|
||||
@ -175,6 +181,14 @@ interface GetExaminationItemRspDetails {
|
||||
|
||||
interface GetExaminationItemRspBody {
|
||||
ykxx: string;
|
||||
kssycs?: string | number;
|
||||
}
|
||||
|
||||
export interface ExaminationStuAbsentParams {
|
||||
carId: string;
|
||||
sfzmhm: string;
|
||||
examinationRoomId: string;
|
||||
username: string;
|
||||
lsh: string;
|
||||
}
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import { voiceService } from '../service/voiceService';
|
||||
import router from '@ohos.router';
|
||||
import { carConfigurationInfo, uploadExamCarCheckResult } from '../api/checkCar';
|
||||
import TopLogo from './compontents/TopLogo';
|
||||
import testNapi from '@ohos.hiserialsdk';
|
||||
import { dateFormat } from '../common/utils/tools';
|
||||
import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFlagTipData } from '../mock';
|
||||
import { BaseInfoType } from '../model/Common';
|
||||
import { BaseInfoType, RouteParamsType } from '../model/Common';
|
||||
import { CarCheckDataType, CarConfigurationParams, CarInfoType } from '../model';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { SpzdType } from '../model';
|
||||
import { voiceService } from '../utils/Voice';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@ -33,7 +33,7 @@ struct Index {
|
||||
@State @Watch('outClick') outFlag: boolean = false;
|
||||
@State passArray: object = PassData
|
||||
@State stachValue: object = StackValueData
|
||||
@State warnFlagTip: object = WarnFlagTipData
|
||||
@State warnFlagTip: Map<number, string[]> = WarnFlagTipData
|
||||
@State realNum: object = RealNumData
|
||||
@State dwMap: object = DwMapData
|
||||
@State fd: number = -1;
|
||||
@ -41,7 +41,7 @@ struct Index {
|
||||
@State stopFlag: boolean = false
|
||||
@State fromIndex: boolean = false
|
||||
@State carInfo: CarInfoType = {}
|
||||
private vocObj: ESObject;
|
||||
private vocObj: voiceService;
|
||||
|
||||
// private AccountTable = new AccountTable(()=>{},CommonConstants);
|
||||
aboutToAppear() {
|
||||
@ -62,7 +62,7 @@ struct Index {
|
||||
}
|
||||
}
|
||||
});
|
||||
let routParam: ESObject = router.getParams();
|
||||
let routParam: RouteParamsType = router.getParams() as RouteParamsType;
|
||||
this.fromIndex = routParam?.fromIndex || false
|
||||
this.carConfigurationInfoFn()
|
||||
|
||||
@ -345,21 +345,23 @@ struct Index {
|
||||
this.passArray[this.index] = true
|
||||
this.passArray = JSON.parse(JSON.stringify(this.passArray))
|
||||
this.subFlag = true
|
||||
let name: string = this.warnFlagTip[this.index][0]
|
||||
if (this.warnFlagTip[this.index].length == 1) {
|
||||
this.vocObj.playAudio({
|
||||
type: 1,
|
||||
name: this.warnFlagTip[this.index][0],
|
||||
name,
|
||||
})
|
||||
} else if (this.warnFlagTip[this.index].length == 2) {
|
||||
if (this.signArr[this.realNum[this.index]] && this.signArr[this.realNum[this.index]] != '0') {
|
||||
name = this.warnFlagTip[this.index][1]
|
||||
this.vocObj.playAudio({
|
||||
type: 1,
|
||||
name: this.warnFlagTip[this.index][1],
|
||||
name,
|
||||
})
|
||||
} else {
|
||||
this.vocObj.playAudio({
|
||||
type: 1,
|
||||
name: this.warnFlagTip[this.index][0],
|
||||
name,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ import { setliushuiNum, takePhotoFn } from '../common/service/indexService';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import errorMsgDialog from './compontents/errorMsgDialog';
|
||||
import GetDistance from '../common/utils/GetDistance';
|
||||
import { delPic } from '../service/videoService';
|
||||
import imageBtn from './compontents/imageBtn';
|
||||
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
||||
import { BaseInfoType } from '../model/Common';
|
||||
@ -21,6 +20,7 @@ import { InitializeTheCentralTableType, MASYSSETTableType, TimeInfo } from '../m
|
||||
import { GetCarInfo, GetDeviceInfo, SetCurrentTime, UseAuth } from './Index/utils';
|
||||
import { GetSyncData, InitializeTheCentralTable } from '../utils/table/Operation';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { delPic } from '../utils/Video';
|
||||
|
||||
|
||||
@Entry
|
||||
@ -465,7 +465,7 @@ struct Index {
|
||||
// setVideoParam()
|
||||
console.log('diyidiy')
|
||||
this.context.resourceManager.getRawFileContent("welcome.wav")
|
||||
.then(value => {
|
||||
.then(() => {
|
||||
this.avPlayer.playAudio(['welcome.wav'])
|
||||
|
||||
// this.vocObj.playAudio({
|
||||
|
||||
@ -24,7 +24,7 @@ import {
|
||||
SYSTEMPARMARR
|
||||
} from './judgeSDK/api/judgeSDK.d';
|
||||
|
||||
import { chunkArr, formatTime, getCurrentHourTime, getCurrentTime } from '../common/utils/tools';
|
||||
import { chunkArr, getCurrentTime } from '../common/utils/tools';
|
||||
import { getSyncData } from '../common/service/initable';
|
||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||
import FileUtil from '../common/utils/File';
|
||||
@ -222,8 +222,8 @@ struct Index {
|
||||
IPADDR: '',
|
||||
CARCLASS: decodeURI(carInfo.carclass),
|
||||
KSCX: carInfo.kscx,
|
||||
// TODO 确定一下是否有这个字段,表定义中没有
|
||||
CARNAME: decodeURI(carInfo.carname),
|
||||
// CARNAME: decodeURI(carInfo.carname),
|
||||
CARNAME: "",
|
||||
FLAG: carInfo.flag,
|
||||
BK1: carInfo.bk1,
|
||||
BK2: carInfo.bk2,
|
||||
@ -238,7 +238,7 @@ struct Index {
|
||||
// const { xm, sfzmhm, lsh, kszp, ksdd, kssycs, kslx, ksxl, xldm } = stuInfo;
|
||||
this.name = stuInfo.xm || '测试考生';
|
||||
this.idCard = stuInfo.sfzmhm || '01234567891010';
|
||||
this.lsh = this.singlePlay ? '0000000000000' : lsh;
|
||||
this.lsh = this.singlePlay ? '0000000000000' : stuInfo.lsh;
|
||||
this.kszp = stuInfo.kszp;
|
||||
this.ksdd = stuInfo.ksdd;
|
||||
this.kssycs = stuInfo.kssycs;
|
||||
@ -250,7 +250,7 @@ struct Index {
|
||||
|
||||
// 获取扣分代码信息
|
||||
async initMarkRules(markRules ?: MarkRule[]) {
|
||||
const markRuleParams = markRules || (await GetSyncData<MA_MARKRULEType>('MA_MARKRULE')
|
||||
const markRuleParams = markRules || (await GetSyncData<MA_MARKRULEType>('MA_MARKRULE'))
|
||||
|
||||
markRuleParams.forEach(mark => {
|
||||
const tempObj = {
|
||||
@ -692,7 +692,7 @@ struct Index {
|
||||
Text(this.startTime).fontColor('#FFF').fontSize(this.FONTSIZE)
|
||||
}.margin({ bottom: 10 })
|
||||
|
||||
if (this.examSubject == 3) {
|
||||
if (this.examSubject == "3") {
|
||||
Row() {
|
||||
Text('考试路线:').fontColor('#E5CCA1').fontSize(this.FONTSIZE)
|
||||
Text(`线路${this.wayno || 3}`).fontColor('#FFAD33').fontSize(this.FONTSIZE)
|
||||
|
||||
@ -61,7 +61,6 @@ struct Index {
|
||||
.linearGradient({
|
||||
angle: 0,
|
||||
colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
|
||||
|
||||
})
|
||||
.onChange((value: string) => {
|
||||
this.inputTextList1[index] = value
|
||||
|
||||
@ -2,7 +2,7 @@ import { examinationStuAbsent, getExaminationItem, getExaminationStudentInfo } f
|
||||
import router from '@ohos.router';
|
||||
import TopLogo from './compontents/TopLogo';
|
||||
import Md5 from '../common/utils/md5';
|
||||
import { dateFormat, getCurrentHourTime, getCurrentTime, string2Bytes } from '../common/utils/tools';
|
||||
import { dateFormat, getCurrentTime, string2Bytes } from '../common/utils/tools';
|
||||
import FaceCompare from './compontents/FaceCompare';
|
||||
import { writeObjectOut } from '../api/judge';
|
||||
import testNapi from '@ohos.idcard';
|
||||
@ -25,6 +25,7 @@ import {
|
||||
BeginExamRequest,
|
||||
CarInfoType,
|
||||
DrvexamType,
|
||||
ExaminationStuAbsentParams,
|
||||
ExaminerLoginInfo,
|
||||
GetExaminationItemRsp,
|
||||
IdCard,
|
||||
@ -35,6 +36,7 @@ import {
|
||||
RouteParamsType,
|
||||
SckType,
|
||||
SystemParamType,
|
||||
UDPParamType,
|
||||
User
|
||||
} from '../model';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
@ -190,7 +192,7 @@ struct UserInfo {
|
||||
if (this.singlePlay) {
|
||||
return ''
|
||||
} else {
|
||||
const photoBase64 = await this.filePhoto.getPhoto();
|
||||
const photoBase64: string = await this.filePhoto.getPhoto();
|
||||
return photoBase64
|
||||
}
|
||||
}
|
||||
@ -788,17 +790,22 @@ struct UserInfo {
|
||||
return
|
||||
}
|
||||
console.log('JsonJson', JSON.stringify(this.currentUser))
|
||||
const param =
|
||||
`<?xml version="1.0" encoding="UTF-8" ?><examinationStuAbsentReq><body><carId>${this.carInfo.carId}</carId><cardNo>${this.currentUser.sfzmhm}</cardNo><examinationRoomId>${this.carInfo.examinationRoomId}</examinationRoomId><examinerName>${this.examinerLoginInfo.username}</examinerName><lsh>${this.lsh}</lsh></body></examinationStuAbsentReq>`
|
||||
const param: ExaminationStuAbsentParams = {
|
||||
carId: this.carInfo.carId,
|
||||
sfzmhm: this.currentUser.sfzmhm,
|
||||
examinationRoomId: this.carInfo.examinationRoomId,
|
||||
username: this.examinerLoginInfo.username,
|
||||
lsh: this.lsh
|
||||
}
|
||||
console.log('carNo1111', param)
|
||||
|
||||
examinationStuAbsent(param).then(res => {
|
||||
const arr = [this.signNum || 0, 1]
|
||||
let tmpList = [];
|
||||
let tmpList: number[] = [];
|
||||
tmpList.push(string2Bytes(arr[0], 1 * 8)[0])
|
||||
tmpList.push(string2Bytes(arr[1], 1 * 8)[0])
|
||||
|
||||
const param = {
|
||||
const param: UDPParamType = {
|
||||
id: 43,
|
||||
list: tmpList,
|
||||
carNo: this.carInfo.carNo,
|
||||
@ -843,7 +850,12 @@ struct UserInfo {
|
||||
async sfbdinterfaceFn() {
|
||||
AppStorage.setOrCreate('statue', 4)
|
||||
this.stepFlag = true
|
||||
let examItems: GetExaminationItemRsp = { getExaminationItemRsp: { body: { ykxx: '' } } };
|
||||
let examItems: GetExaminationItemRsp = {
|
||||
getExaminationItemRsp:
|
||||
{
|
||||
body: { ykxx: '' }
|
||||
}
|
||||
};
|
||||
if (!this.singlePlay) {
|
||||
//获取已考项目
|
||||
examItems = await getExaminationItem({
|
||||
|
||||
@ -2,10 +2,10 @@ import TopLogo from './compontents/topLogo';
|
||||
import FileUtil from '../common/utils/File';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import { endRecordVideo, startRecordVideo, takePhoto } from '../service/videoService';
|
||||
import { GlobalConfig } from '../config/index';
|
||||
import { VideoConfigData } from '../mock';
|
||||
import { CommonType, RecordHandleType, VideoConfig, VideoItemType } from '../model';
|
||||
import { endRecordVideo, startRecordVideo, takePhoto } from '../utils/Video';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@ -583,7 +583,7 @@ struct Index {
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
const radio=AppStorage.get('ratio') as number
|
||||
const radio = AppStorage.get('ratio') as number
|
||||
this.ratio = radio
|
||||
this.openFlag = true
|
||||
const fileUtil = new FileUtil(this.context)
|
||||
@ -709,7 +709,6 @@ struct Index {
|
||||
async writeConfig() {
|
||||
this.oldParam = JSON.parse(JSON.stringify(this.param))
|
||||
this.videoArr = JSON.parse(JSON.stringify(this.videoArr))
|
||||
console.log('kkkk', JSON.stringify(this.param))
|
||||
const folderPath = await this.fileUtil.initFolder(`/config`);
|
||||
this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.param), 'overWrite')
|
||||
this.showFlag = false
|
||||
|
||||
@ -64,21 +64,20 @@ export default struct DeductedPopup {
|
||||
fontColor: '#FFF',
|
||||
bgColor: '#B36E00'
|
||||
}
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
private judgeTask: JudgeTask
|
||||
private filePhoto: FilePhoto
|
||||
// 过程照片拍照
|
||||
getPhoto = async (empty?: boolean) => {
|
||||
//单机模式返回空照片
|
||||
if (this.singlePlay) {
|
||||
return ''
|
||||
} else {
|
||||
const { filePhoto } = this;
|
||||
const photoBase64 = await filePhoto.getPhoto();
|
||||
const photoBase64: string = await this.filePhoto.getPhoto();
|
||||
return photoBase64
|
||||
}
|
||||
}
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
private judgeTask: JudgeTask
|
||||
private filePhoto: FilePhoto
|
||||
private avPlayer
|
||||
private avPlayer: VoiceAnnounce
|
||||
|
||||
async aboutToAppear() {
|
||||
this.carInfo = AppStorage.get('carInfo')
|
||||
@ -89,8 +88,8 @@ export default struct DeductedPopup {
|
||||
this.filePhoto = mediaTest
|
||||
//上车准备
|
||||
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
|
||||
const { isTrajectoryOpen } = judgeConfig;
|
||||
if (isTrajectoryOpen) {
|
||||
// const { isTrajectoryOpen } = judgeConfig;
|
||||
if (judgeConfig.isTrajectoryOpen) {
|
||||
await this.initDb()
|
||||
} else {
|
||||
await this.initSysset()
|
||||
@ -109,16 +108,19 @@ export default struct DeductedPopup {
|
||||
|
||||
//本地数据初始化
|
||||
async initDb() {
|
||||
const { isTrajectoryOpen, trajectoryPath } = judgeConfig
|
||||
// const { isTrajectoryOpen, trajectoryPath } = judgeConfig
|
||||
const examSubject = this.carInfo.examSubject;
|
||||
//轨迹回放读取 systemparam表、markrule表
|
||||
const fileUtil = new FileUtil(this.context);
|
||||
const folderPath = await fileUtil.initFolder(trajectoryPath);
|
||||
const folderPath = await fileUtil.initFolder(judgeConfig.trajectoryPath);
|
||||
const str = await fileUtil.readFile(folderPath);
|
||||
const strArr = str.split('\n');
|
||||
const [initData, beginData] = [strArr[0], strArr[1]];
|
||||
const initDataObj = JSON.parse(initData);
|
||||
this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject;
|
||||
// const [initData, beginData] = [strArr[0], strArr[1]];
|
||||
const initData = strArr[0];
|
||||
const beginData = strArr[1];
|
||||
// TODO 补全类型
|
||||
const initDataObj: ESObject = JSON.parse(initData);
|
||||
this.examSubject = Number(judgeConfig.isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject);
|
||||
await this.initMarkRules(initDataObj.mark);
|
||||
await this.initSysset(initDataObj.sysset);
|
||||
await this.initStudent()
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import media from '@ohos.multimedia.media';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { VoiceTag } from '../config';
|
||||
|
||||
type AVPlayerCallback = (status: string, val?: string) => void;
|
||||
|
||||
@ -10,7 +12,8 @@ export class voiceService {
|
||||
private playerName: string = '';
|
||||
private type: number = 1;
|
||||
private endFlag: Boolean = false;
|
||||
private mediaArray: Array<any> = [];
|
||||
private mediaArray: Array<string> = [];
|
||||
private callBack: AVPlayerCallback = null;
|
||||
|
||||
constructor(callBack: AVPlayerCallback) {
|
||||
// 创建avPlayer实例对象
|
||||
@ -24,11 +27,11 @@ export class voiceService {
|
||||
|
||||
// 注册avplayer回调函数
|
||||
setAVPlayerCallback(callBack: AVPlayerCallback) {
|
||||
console.log('jiangsong avPlayerFdSrc setAVPlayerCallback begin')
|
||||
console.log(VoiceTag, ' avPlayerFdSrc setAVPlayerCallback begin')
|
||||
|
||||
// error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程
|
||||
this.avPlayer.on('error', (err: BusinessError) => {
|
||||
console.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
|
||||
console.error(VoiceTag, `Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
|
||||
this.avPlayer.reset(); // 调用reset重置资源,触发idle状态
|
||||
})
|
||||
|
||||
@ -38,7 +41,7 @@ export class voiceService {
|
||||
switch (state) {
|
||||
case 'idle': // 成功调用reset接口后触发该状态机上报
|
||||
// callBack('idle');
|
||||
console.log('jiangsong AVPlayer idle')
|
||||
console.log(VoiceTag, ' AVPlayer idle')
|
||||
if (this.type == 3) {
|
||||
if (this.mediaArray.length && !this.endFlag) {
|
||||
this.mediaArray.splice(0, 1)
|
||||
@ -51,11 +54,11 @@ export class voiceService {
|
||||
callBack('idle', this.playerName);
|
||||
break;
|
||||
case 'initialized': // avplayer 设置播放源后触发该状态上报
|
||||
console.info('jiangsong AVPlayerstate initialized called.');
|
||||
console.info(VoiceTag, ' AVPlayerstate initialized called.');
|
||||
this.avPlayer.prepare().then(() => {
|
||||
console.info('jiangsong AVPlayer prepare succeeded.');
|
||||
console.info(VoiceTag, ' AVPlayer prepare succeeded.');
|
||||
}, (err: BusinessError) => {
|
||||
console.error(`jiangsong Invoke prepare failed, code is ${err.code}, message is ${err.message}`);
|
||||
console.error(VoiceTag, ` Invoke prepare failed, code is ${err.code}, message is ${err.message}`);
|
||||
});
|
||||
callBack('initialized');
|
||||
break;
|
||||
@ -70,21 +73,21 @@ export class voiceService {
|
||||
callBack('paused');
|
||||
break;
|
||||
case 'completed': // 播放结束后触发该状态机上报
|
||||
console.info('jiangsong AVPlayer state completed called.');
|
||||
console.info(VoiceTag, ' AVPlayer state completed called.');
|
||||
this.avPlayer.stop(); //调用播放结束接口
|
||||
|
||||
break;
|
||||
case 'stopped': // stop接口成功调用后触发该状态机上报
|
||||
console.info('jiangsong AVPlayer state stopped called.');
|
||||
console.info(VoiceTag, ' AVPlayer state stopped called.');
|
||||
this.avPlayer.reset(); // 调用reset接口初始化avplayer状态
|
||||
// callBack('stopped');
|
||||
break;
|
||||
case 'released':
|
||||
console.info('jiangsong AVPlayer state released called.');
|
||||
console.info(VoiceTag, ' AVPlayer state released called.');
|
||||
callBack('released');
|
||||
break;
|
||||
default:
|
||||
console.info('jiangsong AVPlayer state unknown called.');
|
||||
console.info(VoiceTag, ' AVPlayer state unknown called.');
|
||||
callBack('unknown');
|
||||
break;
|
||||
}
|
||||
@ -92,13 +95,13 @@ export class voiceService {
|
||||
}
|
||||
|
||||
// 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
|
||||
avPlayerFdSrc(name) {
|
||||
const context = AppStorage.get('context')
|
||||
avPlayerFdSrc(name: string) {
|
||||
const context: common.UIAbilityContext = AppStorage.get('context')
|
||||
context.resourceManager.getRawFd(name, async (error, value) => {
|
||||
if (error != null) {
|
||||
console.log(`jiangsong callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
|
||||
console.log(VoiceTag, ` callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
|
||||
} else {
|
||||
console.log('jiangsongjiangsong', this.avPlayer)
|
||||
console.log(VoiceTag, this.avPlayer)
|
||||
if (this.avPlayer) {
|
||||
await this.avPlayer.reset()
|
||||
this.avPlayer.fdSrc = value;
|
||||
@ -106,13 +109,13 @@ export class voiceService {
|
||||
|
||||
// 为fdSrc赋值触发initialized状态机上报
|
||||
// this.avPlayer.play()
|
||||
console.info("jiangsong click me after success value.fd " + JSON.stringify(value));
|
||||
console.info(VoiceTag, " click me after success value.fd " + JSON.stringify(value));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 以下为通过url设置网络地址来实现播放直播码流的
|
||||
avPlayerLive(url) {
|
||||
avPlayerLive(url: string) {
|
||||
this.avPlayer.url = url
|
||||
}
|
||||
|
||||
@ -121,18 +124,17 @@ export class voiceService {
|
||||
}
|
||||
|
||||
avPlayerStop() {
|
||||
this.avPlayer && this.avPlayer.stop((err) => {
|
||||
this.avPlayer && this.avPlayer.stop((err: BusinessError) => {
|
||||
if (err == null) {
|
||||
this.endFlag = true
|
||||
console.info('stop success');
|
||||
console.info(VoiceTag, 'stop success');
|
||||
} else {
|
||||
console.error('stop filed,error message is :' + err.message)
|
||||
console.error(VoiceTag, 'stop filed,error message is :' + err.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
playAudio(param) {
|
||||
console.log('jiangsong')
|
||||
playAudio(param: playParams) {
|
||||
this.endFlag = false
|
||||
this.mediaArray = []
|
||||
this.type = param.type
|
||||
@ -150,6 +152,13 @@ export class voiceService {
|
||||
}
|
||||
}
|
||||
|
||||
private callBack = function (value) {
|
||||
}
|
||||
// private callBack = function (value) {
|
||||
// }
|
||||
}
|
||||
|
||||
interface playParams {
|
||||
type?: number,
|
||||
name?: string,
|
||||
url?: string,
|
||||
value?: string[]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user