Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
surenjun 2024-12-30 09:22:11 +08:00
commit 1e2b71e499
16 changed files with 246 additions and 183 deletions

View File

@ -4,7 +4,7 @@ import router from '@ohos.router'
import { dateFormat } from '../utils/tools' import { dateFormat } from '../utils/tools'
import FileUtil from '../../common/utils/File' import FileUtil from '../../common/utils/File'
import { takePhoto, deleteAllFileByPiC } from '../../common/service/videoService' import { takePhoto, deleteAllFileByPiC } from '../../common/service/videoService'
import { VideoConfigData } from '../../mock'; // import { VideoConfigData } from '../../mock';
import { import {
delSyncTable, delSyncTable,
@ -19,27 +19,25 @@ import fs from '@ohos.file.fs';
let num = 0 let num = 0
export async function getliushuiNum(context) { async function getliushuiNum(data) {
console.log('getLiushuihao') // let data = AppStorage.get('liushuiNo')
const fileUtil = new FileUtil(context) if (data) {
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/liushui.txt'); num = Number(data) + 1
if (data === '' || data === undefined) { let str = num.toString()
for (let i = 0; str.length <= 5; i++) {
str = '0' + str
}
globalThis.lshNo = str
} else {
num = 0 num = 0
let str = num.toString() let str = num.toString()
for (let i = 0; str.length <= 5; i++) { for (let i = 0; str.length <= 5; i++) {
str = '0' + str str = '0' + str
} }
globalThis.lshNo = str globalThis.lshNo = str
// return str
} else {
num = Number(JSON.parse(data).value) + 1
let str = num.toString()
for (let i = 0; str.length <= 5; i++) {
str = '0' + str
}
globalThis.lshNo = str
// return str
} }
console.log('liushuiNo1',globalThis.lshNo)
} }
export async function deleteAllFIleLog(path) { export async function deleteAllFIleLog(path) {
@ -67,25 +65,6 @@ export async function deleteAllFIleLog(path) {
} }
export async function delHilog(day) {
// const fileUtil = new FileUtil(globalThis.context)
// const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/hilogTime.txt');
// const folderPath = await fileUtil.initFolder(`/config`);
// if (data === '' || data === undefined) {
// const date = dateFormat(new Date()).split(' ')[0]
// console.log('mm'.date)
// fileUtil.addFile(`${folderPath}/hilogTime.txt`, date)
// } else {
// console.log('kkkkmmm2', data)
// console.log('datadata', data, isSevenDaysAgo(data))
// if (isSevenDaysAgo(data,day)) {
// const date = dateFormat(new Date()).split(' ')[0]
// fileUtil.addFile(`${folderPath}/hilogTime.txt`, date)
// // deleteAllFileByPiC('pz', 1)
// // fileUtil.addFile(`${folderPath}/hilogTime.txt`, JSON.stringify(num))
// }
// }
}
function isSevenDaysAgo(date, saveDays?) { function isSevenDaysAgo(date, saveDays?) {
const today = new Date(); // 当前日期 const today = new Date(); // 当前日期
@ -99,54 +78,46 @@ function isSevenDaysAgo(date,saveDays?) {
} }
export async function setVideoParam() { export async function setVideoParam() {
return // return
const fileUtil = new FileUtil(context) // const fileUtil = new FileUtil(context)
console.log('configconfig',) // console.log('configconfig',)
try{ // try {
const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt'); // const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
//
}catch(error){ // } catch (error) {
const param: VideoConfig = VideoConfigData // const param: VideoConfig = VideoConfigData
const folderPath = await fileUtil.initFolder(`/config`); // const folderPath = await fileUtil.initFolder(`/config`);
fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(param)) // fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(param))
} // }
} }
let fileFd
//配置流水号 //配置流水号
export async function setliushuiNum(context) { export async function setliushuiNum() {
const fileUtil = new FileUtil(context) const data = AppStorage.get('liushuiNo')
try { const liushuiDate = AppStorage.get('liushuiDate')
const fileData = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/liushui.txt'); console.log('liushuiNo',data,'liushuiDate',liushuiDate)
getliushuiNum(data)
if (data&&liushuiDate) {
const date = new Date() const date = new Date()
const time1 = JSON.parse(fileData).date.split(' ')[0] const time1 = liushuiDate.split(' ')[0]
const time2 = dateFormat(date).split(' ')[0] const time2 = dateFormat(date).split(' ')[0]
if (time1 == time2) { if (time1 != time2) {
const param = { AppStorage.setOrCreate('liushuiDate', dateFormat(date));
date: dateFormat(date), AppStorage.setOrCreate('liushuiNo', '0');
value: Number(JSON.parse(fileData).value) + 1 }else{
AppStorage.setOrCreate('liushuiNo', Number(data) + 1);
} }
const folderPath = await fileUtil.initFolder(`/config`); } else {
fileUtil.addFile(`${folderPath}/liushui.txt`, JSON.stringify(param))
return
}
const param = {
date: dateFormat(date),
value: 0
}
const folderPath = await fileUtil.initFolder(`/config`);
fileUtil.addFile(`${folderPath}/liushui.txt`, JSON.stringify(param))
} catch (err) {
const date = new Date() const date = new Date()
const param = { // PersistentStorage.PersistProp('liushuiNo', 0);
date: dateFormat(date), // PersistentStorage.PersistProp('liushuiDate', dateFormat(date));
value: 0 AppStorage.setOrCreate('liushuiNo', '0');
AppStorage.setOrCreate('liushuiDate', dateFormat(date));
} }
const folderPath = await fileUtil.initFolder(`/config`);
fileUtil.addFile(`${folderPath}/liushui.txt`, JSON.stringify(param))
}
} }
//双中心表 //双中心表

View File

@ -227,8 +227,8 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
const time = await getCurrentTime() const time = await getCurrentTime()
const date = time.split(' ')[0] const date = time.split(' ')[0]
await fileHelper.createAlbum(date) await fileHelper.createAlbum(date)
rtsp_server.getVideoSnapshot(context, video_uri, fileName, '/jt', true, (err, snapResult) => { rtsp_server.getVideoSnapshot(context, video_uri, fileName, '/jt', true,async (err, snapResult) => {
console.log('baoyihubaoyihu', video_uri, flag, JSON.stringify(snapResult)) console.log('baoyihubaoyihu', video_uri, flag, JSON.stringify(snapResult.fileSize))
console.log('getPhtot', JSON.stringify(snapResult)) console.log('getPhtot', JSON.stringify(snapResult))
if(snapResult.result&&snapResult.errorCode==0){ if(snapResult.result&&snapResult.errorCode==0){
resolve({ resolve({
@ -238,8 +238,8 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
errorCode: snapResult.errorCode errorCode: snapResult.errorCode
}) })
}else{ }else{
takePhoto(param, context, dir, flag, callback) const data=await takePhoto(param, context, dir, flag, callback)
resolve(data)
// reject() // reject()
} }

View File

@ -6,6 +6,7 @@ import common from '@ohos.app.ability.common'
import fs from '@ohos.file.fs' import fs from '@ohos.file.fs'
const LOGTAG = 'LOGTAG' const LOGTAG = 'LOGTAG'
export default class FileUtil { export default class FileUtil {
private context: common.UIAbilityContext private context: common.UIAbilityContext
private wantInfos: Want[] private wantInfos: Want[]
@ -50,12 +51,11 @@ export default class FileUtil{
})); }));
return path; return path;
} }
/* /*
* @desc * @desc
* *
*/ */
public addFile = async (filePath:string,content:string,type?:string)=>{ public addFile = async (filePath: string, content: string, type?: string, fd?) => {
const { READ_WRITE,CREATE,APPEND } = fs.OpenMode const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
const isExit = fs.accessSync(filePath); const isExit = fs.accessSync(filePath);
//文件存在先删除 //文件存在先删除
@ -63,12 +63,14 @@ export default class FileUtil{
fs.unlinkSync(filePath); fs.unlinkSync(filePath);
} }
try { try {
let file = fs.openSync(filePath, READ_WRITE | CREATE); let file
if (!fd) {
file = fs.openSync(filePath, READ_WRITE | CREATE);
}
//追加写入文件 //追加写入文件
fs.writeSync(file.fd, content) fs.writeSync(file.fd, content)
fs.closeSync(file) fs.closeSync(file)
console.error(LOGTAG,'写入文件成功') return file.fd
return true
} catch (e) { } catch (e) {
console.error(LOGTAG, '写入失败', JSON.stringify(e)) console.error(LOGTAG, '写入失败', JSON.stringify(e))
@ -87,6 +89,7 @@ export default class FileUtil{
fs.closeSync(file) fs.closeSync(file)
console.error(LOGTAG, '写入文件成功') console.error(LOGTAG, '写入文件成功')
} }
/* /*
* @desc * @desc
* *
@ -251,6 +254,4 @@ export default class FileUtil{
} }
}) })
} }
} }

View File

@ -12,6 +12,7 @@ export default class GetDistance {
public totalDistance: number public totalDistance: number
public totalTime:number public totalTime:number
public date: string public date: string
public fd: number
constructor(context) { constructor(context) {
const fileUtil = new FileUtil(context) const fileUtil = new FileUtil(context)
@ -22,7 +23,7 @@ export default class GetDistance {
public initFolder= async () => { public initFolder= async () => {
const {fileUtil} = this const {fileUtil} = this
const time = await getCurrentTime() const time = await getCurrentTime()
const folderPath = await fileUtil.initFolder(`/distance`); const folderPath = await fileUtil.initFolder(`/车辆行驶距离统计`);
console.info('surenjun folderPath=>' ,folderPath); console.info('surenjun folderPath=>' ,folderPath);
const date = time.split(' ')[0].split('-').join('_') const date = time.split(' ')[0].split('-').join('_')
const timeStr = time.split(' ')[1] const timeStr = time.split(' ')[1]
@ -31,8 +32,8 @@ export default class GetDistance {
this.totalDistance = 0; this.totalDistance = 0;
this.totalTime = 0; this.totalTime = 0;
this.date = date; this.date = date;
await fileUtil.editFile( this.fd=await fileUtil.editFile(
`${folderPath}/${date}.txt`,`程序启动时间:${timeStr} 累计行驶距离:${this.totalDistance}m 累计运行时常:${this.totalTime}min` `${folderPath}/${date}.txt`,`程序启动时间:${timeStr} 累计行驶距离:${this.totalDistance}m 累计运行时常:${this.totalTime}min`,this.fd
); );
return folderPath return folderPath
} }

View File

@ -259,10 +259,11 @@ export default class TcpClient {
}); });
} }
async writeLog(param){ async writeLog(param){
const fileUtil = new FileUtil(globalThis.context) // const fileUtil = new FileUtil(globalThis.context)
fileUtil.editFile(`${this.folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`) // fileUtil.editFile(`${this.folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
} }
async initPath(){ async initPath(){
return
const fileUtil = new FileUtil(globalThis.context) const fileUtil = new FileUtil(globalThis.context)
const date=dateFormat(new Date).split(' ')[0] const date=dateFormat(new Date).split(' ')[0]
this.folderPath = await fileUtil.initFolder(`/PLC/${date}`); this.folderPath = await fileUtil.initFolder(`/PLC/${date}`);

View File

@ -349,7 +349,7 @@ export default class UdpClientByCenter {
// time:dateFormat(new Date()), // time:dateFormat(new Date()),
// PLC: JSON.stringify(newArr.toString()), // PLC: JSON.stringify(newArr.toString()),
// }) // })
if(strachArr[83]!='4'||strachArr[92]!='0'){ if(strachArr[83]!='4'){
console.log('差分状态异常',strachArr[83],strachArr[92]) console.log('差分状态异常',strachArr[83],strachArr[92])
this.writeLog({ this.writeLog({
time:dateFormat(new Date()), time:dateFormat(new Date()),
@ -369,13 +369,13 @@ export default class UdpClientByCenter {
this.testIfUdpConnetced(callback) this.testIfUdpConnetced(callback)
} }
async writeLog(param){ async writeLog(param){
const fileUtil = new FileUtil(globalThis.context) // const fileUtil = new FileUtil(globalThis.context)
fileUtil.editFile(`${this.folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`) // fileUtil.editFile(`${this.folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
} }
async initPath(){ async initPath(){
const fileUtil = new FileUtil(globalThis.context) // const fileUtil = new FileUtil(globalThis.context)
const date=dateFormat(new Date).split(' ')[0] // const date=dateFormat(new Date).split(' ')[0]
this.folderPath = await fileUtil.initFolder(`/PLC/${date}`); // this.folderPath = await fileUtil.initFolder(`/PLC/${date}`);
} }
//获取当前UDP信号 //获取当前UDP信号
getCurrentMessage = () => { getCurrentMessage = () => {

View File

@ -30,7 +30,8 @@ export default async function request(req: any) {
header: { header: {
'Content-Type': xml ? 'text/xml' : 'application/json' 'Content-Type': xml ? 'text/xml' : 'application/json'
}, },
extraData: xml ? data : JSON.stringify(data) extraData: xml ? data : JSON.stringify(data),
connectTimeout:120000,
} }
//params转url拼接参数 //params转url拼接参数
let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || ''; let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || '';

View File

@ -4,6 +4,7 @@ import { examinerLoginService } from '../common/service/ExaminerService';
import Md5 from '../common/utils/md5'; import Md5 from '../common/utils/md5';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import errorMsgDialog from './compontents/errorMsgDialog' import errorMsgDialog from './compontents/errorMsgDialog'
import { voiceService } from '../common/service/voiceService';
@Entry @Entry
@Component @Component
@ -72,7 +73,6 @@ export default struct Index {
ForEach(this.imgArr1, (item: Resource, index: number) => { ForEach(this.imgArr1, (item: Resource, index: number) => {
if (index === this.imgArr1.length - 1) { if (index === this.imgArr1.length - 1) {
Image(item).width('38%').height('24%').onClick(() => { Image(item).width('38%').height('24%').onClick(() => {
if (this.inputTextArr[0].trim() == '' || this.inputTextArr[1].trim() == '') { if (this.inputTextArr[0].trim() == '' || this.inputTextArr[1].trim() == '') {
promptAction.showToast({ promptAction.showToast({
message: '请输入用户名和密码', message: '请输入用户名和密码',
@ -132,10 +132,10 @@ export default struct Index {
}) })
} else { } else {
Image(item).width('18%').height('24%').onClick(() => { Image(item).width('18%').height('24%').onClick(() => {
// this.vocObj.playAudio({ this.vocObj.playAudio({
// type: 1, type: 1,
// name: 'media_button.wav' name: 'media_button.wav'
// }) })
this.url = '' this.url = ''
if (index < 9) { if (index < 9) {
this.inputTextArr[this.currentInputIndex] += (index + 1).toString() this.inputTextArr[this.currentInputIndex] += (index + 1).toString()
@ -182,6 +182,8 @@ export default struct Index {
} }
onPageShow() { onPageShow() {
this.vocObj = new voiceService(async (status, val, next) => {
});
} }
outClick() { outClick() {

View File

@ -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 { getliushuiNum, setliushuiNum, takePhotoFn, delHilog, setVideoParam } from '../common/service/indexService'; import { setliushuiNum, takePhotoFn, setVideoParam } from '../common/service/indexService';
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import worker, { MessageEvents } from '@ohos.worker'; import worker, { MessageEvents } from '@ohos.worker';
import promptAction from '@ohos.promptAction' import promptAction from '@ohos.promptAction'
@ -38,6 +38,7 @@ struct Index {
@State dialogRatio: number = 0.8 @State dialogRatio: number = 0.8
@State ratio: number = 1700 / 960 @State ratio: number = 1700 / 960
@State loading: boolean = true @State loading: boolean = true
@State initParamFlag: boolean = false
@State fd: number = -1; @State fd: number = -1;
@State num: number = 0; @State num: number = 0;
fileHelper = null; fileHelper = null;
@ -77,6 +78,10 @@ struct Index {
Row() { Row() {
Image($r('app.media.btn_setting')).width('16.7%').height('12.2%') Image($r('app.media.btn_setting')).width('16.7%').height('12.2%')
.onClick(async () => { .onClick(async () => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
if (this.loading) { if (this.loading) {
return return
} }
@ -86,6 +91,10 @@ struct Index {
}) })
Image($r('app.media.btn_back')).width('14.4%').height('12.2%') Image($r('app.media.btn_back')).width('14.4%').height('12.2%')
.onClick(() => { .onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
this.dialogVisiable = true this.dialogVisiable = true
}) })
} }
@ -102,7 +111,14 @@ struct Index {
.height('71%') .height('71%')
.margin({ left: 80 * globalThis.ratio }) .margin({ left: 80 * globalThis.ratio })
.onClick(async () => { .onClick(async () => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
// ||!this.initParamFlag
if (this.loading) { if (this.loading) {
// globalThis.title = '正在初始化请等待5s后重试'
// this.errorDialog.open()
return return
} }
setTimeout(() => { setTimeout(() => {
@ -145,6 +161,10 @@ struct Index {
if (this.loading) { if (this.loading) {
return return
} }
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
if (judgeConfig.isTrajectoryOpen) { if (judgeConfig.isTrajectoryOpen) {
router.pushUrl({ router.pushUrl({
url: 'pages/UserInfo', url: 'pages/UserInfo',
@ -172,6 +192,10 @@ struct Index {
if (this.loading) { if (this.loading) {
return return
} }
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
router.pushUrl({ router.pushUrl({
url: 'pages/CarCheck' url: 'pages/CarCheck'
}, router.RouterMode.Single); }, router.RouterMode.Single);
@ -243,6 +267,10 @@ struct Index {
.commStyle() .commStyle()
.onClick(() => { .onClick(() => {
this.dialogVisiable = false this.dialogVisiable = false
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
}).margin({ right: 10 * this.ratio }) }).margin({ right: 10 * this.ratio })
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
@ -253,6 +281,10 @@ struct Index {
} }
.commStyle() .commStyle()
.onClick(() => { .onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
router.back() router.back()
}) })
}.position({ y: 265 * this.ratio * this.dialogRatio, x: 115 * this.ratio * this.dialogRatio }) }.position({ y: 265 * this.ratio * this.dialogRatio, x: 115 * this.ratio * this.dialogRatio })
@ -305,6 +337,7 @@ struct Index {
} }
async aboutToAppear() { async aboutToAppear() {
this.initParamFlag=false
this.dialogVisiable = false this.dialogVisiable = false
this.angle = 0 this.angle = 0
this.loading = false this.loading = false
@ -341,6 +374,7 @@ struct Index {
console.log("baoyihu after postMessage :", JSON.stringify(e.data)); console.log("baoyihu after postMessage :", JSON.stringify(e.data));
// @ts-ignore // @ts-ignore
let workData: WorkData = e.data; let workData: WorkData = e.data;
this.loading = false
if (workData.isComplete) { if (workData.isComplete) {
if(globalThis.singlePlay){ if(globalThis.singlePlay){
router.pushUrl({ router.pushUrl({
@ -370,8 +404,6 @@ struct Index {
}, router.RouterMode.Single) }, router.RouterMode.Single)
} }
}) })
this.loading = false
}); });
} }
@ -488,14 +520,17 @@ struct Index {
this.carNum = globalThis.carInfo.plateNo; this.carNum = globalThis.carInfo.plateNo;
this.version = globalThis.version; this.version = globalThis.version;
this.hasAuth = globalThis.hasAuth; this.hasAuth = globalThis.hasAuth;
setTimeout(()=>{
this.initParamFlag=true
},3000)
initJudgeUdp() initJudgeUdp()
takePhotoFn(this.context) takePhotoFn(this.context)
clearInterval(this.interval) clearInterval(this.interval)
this.interval = setInterval(() => { this.interval = setInterval(() => {
console.log('kkkkmmm') console.log('kkkkmmm')
this.num++ this.num++
setliushuiNum(this.context) setliushuiNum()
getliushuiNum(this.context) // getliushuiNum(this.context)
if (this.num >= 3) { if (this.num >= 3) {
this.heartMsg() this.heartMsg()
} }

View File

@ -31,6 +31,7 @@ import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import SignDisplayCom from './compontents/signDisplayCom'; import SignDisplayCom from './compontents/signDisplayCom';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { voiceService } from '../common/service/voiceService';
@Entry @Entry
@Component @Component
@ -40,6 +41,8 @@ struct Index {
} }
async aboutToAppear() { async aboutToAppear() {
this.vocObj = new voiceService(async (status, val, next) => {
});
globalThis.windowClass.setWindowSystemBarEnable([]) globalThis.windowClass.setWindowSystemBarEnable([])
const time = await getCurrentTime() const time = await getCurrentTime()
@ -760,6 +763,10 @@ struct Index {
.height(118 * 0.95) .height(118 * 0.95)
.margin({ bottom: 8 }) .margin({ bottom: 8 })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
this.setManualProjectFn(index) this.setManualProjectFn(index)
}) })
}) })
@ -792,6 +799,10 @@ struct Index {
.alignItems(VerticalAlign.Center) .alignItems(VerticalAlign.Center)
.border({ width: 5, color: '#4D4136', radius: 30 }) .border({ width: 5, color: '#4D4136', radius: 30 })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
this.signDisplayComVisible = true this.signDisplayComVisible = true
}) })
@ -827,6 +838,10 @@ struct Index {
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 10 }) .margin({ bottom: 10 })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
this.isDeductedPopShow = true this.isDeductedPopShow = true
}) })
} }
@ -856,6 +871,10 @@ struct Index {
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat) .backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
if (this.judgeConfigObj['353'] == '0') { if (this.judgeConfigObj['353'] == '0') {
this.endPopupVisible = true this.endPopupVisible = true
} else { } else {
@ -919,6 +938,10 @@ struct Index {
.backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '33.33%', height: '33.33%' }) .backgroundImageSize({ width: '33.33%', height: '33.33%' })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
this.signDisplayComVisible = false this.signDisplayComVisible = false
}) })
}.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)')
@ -1334,6 +1357,7 @@ struct Index {
@State defaultTabIndex: number = 0; @State defaultTabIndex: number = 0;
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
public kfArrScroller: Scroller = new Scroller() public kfArrScroller: Scroller = new Scroller()
private vocObj = null;
//档位 //档位
@State dw: string = '' @State dw: string = ''
//速度 //速度

View File

@ -1,4 +1,5 @@
import router from '@ohos.router' import router from '@ohos.router'
import { voiceService } from '../common/service/voiceService'
import TopLogo from './compontents/TopLogo' import TopLogo from './compontents/TopLogo'
@Entry @Entry
@ -18,18 +19,30 @@ export default struct Index {
Column() { Column() {
Row() { Row() {
Image($r('app.media.setting_clzc')).width('30.5%').height('74%').onClick(() => { Image($r('app.media.setting_clzc')).width('30.5%').height('74%').onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
this.url = 'pages/Register' this.url = 'pages/Register'
router.pushUrl({ router.pushUrl({
url: this.url, url: this.url,
}, router.RouterMode.Single); }, router.RouterMode.Single);
}) })
Image($r('app.media.setting_spjk')).width('30.5%').height('74%').onClick(() => { Image($r('app.media.setting_spjk')).width('30.5%').height('74%').onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
this.url = 'pages/VideoConfig' this.url = 'pages/VideoConfig'
router.pushUrl({ router.pushUrl({
url: this.url, url: this.url,
}, router.RouterMode.Single); }, router.RouterMode.Single);
}) })
Image($r('app.media.setting_xtts')).width('30.5%').height('74%').onClick(() => { Image($r('app.media.setting_xtts')).width('30.5%').height('74%').onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
this.url = 'pages/TerminalInfos' this.url = 'pages/TerminalInfos'
router.pushUrl({ router.pushUrl({
url: this.url, url: this.url,
@ -74,6 +87,8 @@ export default struct Index {
} }
aboutToAppear() { aboutToAppear() {
this.vocObj = new voiceService(async (status, val, next) => {
});
this.carNum = globalThis.carInfo.plateNo; this.carNum = globalThis.carInfo.plateNo;
this.version = globalThis.version; this.version = globalThis.version;
this.hasAuth = globalThis.hasAuth; this.hasAuth = globalThis.hasAuth;

View File

@ -133,7 +133,6 @@ struct UserInfo {
this.updateTimeLimit = false this.updateTimeLimit = false
this.ksksLimit = false this.ksksLimit = false
this.currentUser=EmptyCandidateObject this.currentUser=EmptyCandidateObject
console.log('响应头地址响应头地址')
const mediaTest = new FilePhoto(this.context); const mediaTest = new FilePhoto(this.context);
this.filePhoto = new FilePhoto(this.context); this.filePhoto = new FilePhoto(this.context);
//语音功能on //语音功能on
@ -1042,9 +1041,11 @@ struct UserInfo {
.height(70 * this.ratio) .height(70 * this.ratio)
.margin({ left: 65 * this.ratio, right: 10 * this.ratio }) .margin({ left: 65 * this.ratio, right: 10 * this.ratio })
.onClick(() => { .onClick(() => {
// this.avPlayer.playAudio(['button_media.wav'])
this.prevClick() this.prevClick()
}) })
Image($r('app.media.dk_next')).width(90 * this.ratio).height(70 * this.ratio).onClick(() => { Image($r('app.media.dk_next')).width(90 * this.ratio).height(70 * this.ratio).onClick(() => {
this.avPlayer.playAudio(['button_media.wav'])
this.nextClick() this.nextClick()
}) })
}.margin({ top: 40 * this.ratio, bottom: 10 * this.ratio }) }.margin({ top: 40 * this.ratio, bottom: 10 * this.ratio })
@ -1095,6 +1096,7 @@ struct UserInfo {
Image($r('app.media.gx_btn')) Image($r('app.media.gx_btn'))
.commStyle() .commStyle()
.onClick(() => { .onClick(() => {
// this.avPlayer.playAudio(['button_media.wav'])
if (this.isExamStart && !globalThis.singlePlay) { if (this.isExamStart && !globalThis.singlePlay) {
return return
} }
@ -1105,6 +1107,7 @@ struct UserInfo {
Image($r('app.media.qk_btn')) Image($r('app.media.qk_btn'))
.commStyle() .commStyle()
.onClick(() => { .onClick(() => {
// this.avPlayer.playAudio(['button_media.wav'])
// 已开始考试不能缺考 已考过一次学员不能缺考 车上不能缺考 // 已开始考试不能缺考 已考过一次学员不能缺考 车上不能缺考
if (this.ksksLimit||(this.systemParam.Param352Str=='1'&&this.currentUser.kssycs=='1')||this.systemParam.Param770Str=='1') { if (this.ksksLimit||(this.systemParam.Param352Str=='1'&&this.currentUser.kssycs=='1')||this.systemParam.Param770Str=='1') {
return return
@ -1128,7 +1131,6 @@ struct UserInfo {
if(this.systemParam.Param612Str=='1'){ if(this.systemParam.Param612Str=='1'){
return return
} }
await this.prePareExam() await this.prePareExam()
}) })
} }
@ -1157,6 +1159,7 @@ struct UserInfo {
} }
.commStyle() .commStyle()
.onClick(() => { .onClick(() => {
this.avPlayer.playAudio(['button_media.wav'])
this.ksksLimit = false this.ksksLimit = false
this.qkFlag = false this.qkFlag = false
}) })
@ -1166,6 +1169,7 @@ struct UserInfo {
} }
.commStyle() .commStyle()
.onClick(() => { .onClick(() => {
this.avPlayer.playAudio(['button_media.wav'])
this.qkFn() this.qkFn()
}) })
}.position({ y: 265 * this.ratio, x: 115 * this.ratio }) }.position({ y: 265 * this.ratio, x: 115 * this.ratio })

View File

@ -1,5 +1,6 @@
import router from '@ohos.router'; import router from '@ohos.router';
import { getCurrentTime } from '../../common/service/timeService'; import { getCurrentTime } from '../../common/service/timeService';
import { voiceService } from '../../common/service/voiceService';
@Component @Component
export default struct TopLogo { export default struct TopLogo {
@ -7,6 +8,7 @@ export default struct TopLogo {
@State timeText: string = ''; @State timeText: string = '';
@Link outFlag: boolean; //返回按钮触发 @Link outFlag: boolean; //返回按钮触发
private timer: any = null; private timer: any = null;
private vocObj = null;
constructor() { constructor() {
super() super()
@ -34,6 +36,10 @@ export default struct TopLogo {
Image($r('app.media.topB_back')).width('16.7%').height('12.2%') Image($r('app.media.topB_back')).width('16.7%').height('12.2%')
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
router.back() router.back()
this.outFlag = true this.outFlag = true
}) })
@ -47,6 +53,8 @@ export default struct TopLogo {
async aboutToAppear() { async aboutToAppear() {
console.log('jiangsong: topLogo aboutToAppear1111') console.log('jiangsong: topLogo aboutToAppear1111')
this.vocObj = new voiceService(async (status, val, next) => {
});
this.timeText = await getCurrentTime(); this.timeText = await getCurrentTime();
this.timer = setInterval(async () => { this.timer = setInterval(async () => {
this.timeText = await getCurrentTime(); this.timeText = await getCurrentTime();

View File

@ -28,7 +28,7 @@ export default class FileModel{
// 存储zip文件并解压 // 存储zip文件并解压
public storingFiles = async (str) => { public storingFiles = async (str) => {
const {fileUtil,folderPath} = this; const {fileUtil,folderPath} = this;
await fileUtil.editFile(`${folderPath}/model.zip`,str,'overWrite') await fileUtil.editFile(`${folderPath}/model.zip`,str)
let options = { let options = {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION,

View File

@ -15,7 +15,7 @@ export const judgeConfig = {
// 本地模型地址 // 本地模型地址
modelPath: 'models/model_enc', modelPath: 'models/model_enc',
// 济南科目三 // 济南科目三
trajectoryPath: 'logs/2024_12_20/2024_12_20_15_10_30_9999920215968_355757250887519616_段士婕/judge_exam_data.txt', trajectoryPath: 'logs/2024_12_26/2024_12_26_14_12_51_2412505941910_370125200404041910_赵宇/judge_exam_data.txt',
//四合一画面配置 //四合一画面配置
fourInOneScreen:{ fourInOneScreen:{
//gps位数 //gps位数

View File

@ -152,7 +152,7 @@ class AVPlayer {
let fileResult = await mediaLib.getFileAssets(fetchOp); let fileResult = await mediaLib.getFileAssets(fetchOp);
let retCount = fileResult.getCount(); let retCount = fileResult.getCount();
if (retCount > 0) { if (retCount > 0) {
ret = fileResult.getFirstObject(); ret = await fileResult.getFirstObject();
return resolve(ret); return resolve(ret);
}else{ }else{
return reject(false); return reject(false);