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 FileUtil from '../../common/utils/File'
import { takePhoto, deleteAllFileByPiC } from '../../common/service/videoService'
import { VideoConfigData } from '../../mock';
// import { VideoConfigData } from '../../mock';
import {
delSyncTable,
@ -19,27 +19,25 @@ import fs from '@ohos.file.fs';
let num = 0
export async function getliushuiNum(context) {
console.log('getLiushuihao')
const fileUtil = new FileUtil(context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/liushui.txt');
if (data === '' || data === undefined) {
async function getliushuiNum(data) {
// let data = AppStorage.get('liushuiNo')
if (data) {
num = Number(data) + 1
let str = num.toString()
for (let i = 0; str.length <= 5; i++) {
str = '0' + str
}
globalThis.lshNo = str
} else {
num = 0
let str = num.toString()
for (let i = 0; str.length <= 5; i++) {
str = '0' + 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) {
@ -67,27 +65,8 @@ 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 target = new Date(date); // 需要判断的日期
console.info("listFile succeed1", JSON.stringify(target));
@ -95,58 +74,50 @@ function isSevenDaysAgo(date,saveDays?) {
const diffDays = diff / (1000 * 60 * 60 * 24); // 将毫秒转换为天数
console.info("listFile succeed2", (diffDays));
// 如果差异天数正好是2则原日期是当前日期的前2天
return diffDays > (saveDays||2);
return diffDays > (saveDays || 2);
}
export async function setVideoParam() {
return
const fileUtil = new FileUtil(context)
console.log('configconfig',)
try{
const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
}catch(error){
const param: VideoConfig = VideoConfigData
const folderPath = await fileUtil.initFolder(`/config`);
fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(param))
}
// return
// const fileUtil = new FileUtil(context)
// console.log('configconfig',)
// try {
// const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
//
// } catch (error) {
// const param: VideoConfig = VideoConfigData
// const folderPath = await fileUtil.initFolder(`/config`);
// fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(param))
// }
}
//配置流水号
export async function setliushuiNum(context) {
const fileUtil = new FileUtil(context)
try {
const fileData = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/liushui.txt');
const date = new Date()
const time1 = JSON.parse(fileData).date.split(' ')[0]
const time2 = dateFormat(date).split(' ')[0]
if (time1 == time2) {
const param = {
date: dateFormat(date),
value: Number(JSON.parse(fileData).value) + 1
}
const folderPath = await fileUtil.initFolder(`/config`);
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 param = {
date: dateFormat(date),
value: 0
}
const folderPath = await fileUtil.initFolder(`/config`);
fileUtil.addFile(`${folderPath}/liushui.txt`, JSON.stringify(param))
}
let fileFd
//配置流水号
export async function setliushuiNum() {
const data = AppStorage.get('liushuiNo')
const liushuiDate = AppStorage.get('liushuiDate')
console.log('liushuiNo',data,'liushuiDate',liushuiDate)
getliushuiNum(data)
if (data&&liushuiDate) {
const date = new Date()
const time1 = liushuiDate.split(' ')[0]
const time2 = dateFormat(date).split(' ')[0]
if (time1 != time2) {
AppStorage.setOrCreate('liushuiDate', dateFormat(date));
AppStorage.setOrCreate('liushuiNo', '0');
}else{
AppStorage.setOrCreate('liushuiNo', Number(data) + 1);
}
} else {
const date = new Date()
// PersistentStorage.PersistProp('liushuiNo', 0);
// PersistentStorage.PersistProp('liushuiDate', dateFormat(date));
AppStorage.setOrCreate('liushuiNo', '0');
AppStorage.setOrCreate('liushuiDate', dateFormat(date));
}
}
//双中心表
@ -287,9 +258,9 @@ export async function takePhotoFn(context) {
console.log('拍照失败')
return
}
console.log('takePhototakePhoto',JSON.stringify(data))
const zdyz=globalThis.param854Str?Number(globalThis.param854Str):Number(param.zdyz)
console.log('takePhototakePhoto',JSON.stringify(zdyz),)
console.log('takePhototakePhoto', JSON.stringify(data))
const zdyz = globalThis.param854Str ? Number(globalThis.param854Str) : Number(param.zdyz)
console.log('takePhototakePhoto', JSON.stringify(zdyz),)
if (Number(data.fileSize) <= (zdyz * 1000)) {
map[key1] = true

View File

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

View File

@ -6,7 +6,8 @@ import common from '@ohos.app.ability.common'
import fs from '@ohos.file.fs'
const LOGTAG = 'LOGTAG'
export default class FileUtil{
export default class FileUtil {
private context: common.UIAbilityContext
private wantInfos: Want[]
private fileAccessHelper: fileAccess.FileAccessHelper
@ -14,7 +15,7 @@ export default class FileUtil{
//后续文件路径待替换
private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files'
public destFile:string
public destFile: string
constructor(wantInfos) {
const {requestPermission} = this;
@ -26,23 +27,23 @@ export default class FileUtil{
* @desc
*
*/
public initFolder = async (folderPath:string) => {
public initFolder = async (folderPath: string) => {
const {absolutePath} = this;
const folderList = folderPath.split('/').filter(folderName => folderName !== '');
let path = absolutePath
folderList.forEach((folderName=>{
folderList.forEach((folderName => {
path += `/${folderName}`;
try {
const isExit = fs.accessSync(path);
if(!isExit){
if (!isExit) {
fs.mkdirSync(path)
}
} catch (e) {
console.info('初始化文件夹失败',path)
console.info('初始化文件夹失败', path)
promptAction.showToast({
message:`初始化文件夹失败`+JSON.stringify(e),
duration:4000,
message: `初始化文件夹失败` + JSON.stringify(e),
duration: 4000,
})
}
@ -50,62 +51,64 @@ export default class FileUtil{
}));
return path;
}
/*
* @desc
*
*/
public addFile = async (filePath:string,content:string,type?:string)=>{
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode
public addFile = async (filePath: string, content: string, type?: string, fd?) => {
const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
const isExit = fs.accessSync(filePath);
//文件存在先删除
if(isExit){
if (isExit) {
fs.unlinkSync(filePath);
}
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)
console.error(LOGTAG,'写入文件成功')
return true
return file.fd
}catch (e){
console.error(LOGTAG,'写入失败',JSON.stringify(e))
} catch (e) {
console.error(LOGTAG, '写入失败', JSON.stringify(e))
}
}
public openFileSync=async(filePath)=>{
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode
let file = fs.openSync(filePath, READ_WRITE | APPEND |CREATE);
public openFileSync = async (filePath) => {
const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
let file = fs.openSync(filePath, READ_WRITE | APPEND | CREATE);
return file
}
public editFileWidthOutOpen(file,content){
const newStr = content + '\n'
fs.writeSync(file.fd,newStr)
public editFileWidthOutOpen(file, content) {
const newStr = content + '\n'
fs.writeSync(file.fd, newStr)
fs.closeSync(file)
console.error(LOGTAG,'写入文件成功')
console.error(LOGTAG, '写入文件成功')
}
/*
* @desc
*
*/
public editFile = async (filePath:string,content:string,fd?:number)=>{
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode
public editFile = async (filePath: string, content: string, fd?: number) => {
const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
try {
const newStr = content + '\n'
if(fd !== undefined){
fs.writeSync(fd,newStr)
const newStr = content + '\n'
if (fd !== undefined) {
fs.writeSync(fd, newStr)
return fd
}else{
let file = fs.openSync(filePath, READ_WRITE | APPEND |CREATE);
fs.writeSync(file.fd,newStr)
} else {
let file = fs.openSync(filePath, READ_WRITE | APPEND | CREATE);
fs.writeSync(file.fd, newStr)
return file.fd
}
}catch (e){
console.error(LOGTAG,JSON.stringify(e))
} catch (e) {
console.error(LOGTAG, JSON.stringify(e))
}
}
@ -113,12 +116,12 @@ export default class FileUtil{
* @desc
*
**/
public readFile = async (filePath:string) => {
try{
console.log('strrr',filePath)
public readFile = async (filePath: string) => {
try {
console.log('strrr', filePath)
const str = await fs.readText(filePath);
return str
}catch (err){
} catch (err) {
return ''
}
@ -127,9 +130,9 @@ export default class FileUtil{
/*
* @desc获取系统目录里的文件列表
*/
public getDeviceList = async (folderPath?:string)=>{
public getDeviceList = async (folderPath?: string) => {
const {absolutePath,getFilePathList} = this;
return getFilePathList(`${absolutePath}/${folderPath}`,false)
return getFilePathList(`${absolutePath}/${folderPath}`, false)
};
// 删除文件夹或者文件
@ -138,29 +141,29 @@ export default class FileUtil{
* @param{{type}} 1:文件夹 2 3
**/
public deleteF = async (path:string,type: 1 | 2 | 3) => {
public deleteF = async (path: string, type: 1 | 2 | 3) => {
const {getFilePathList,absolutePath} = this
if(type === 1){
const fileList = await getFilePathList(`${absolutePath}/${path}`,false);
fileList.forEach(filePath =>{
if (type === 1) {
const fileList = await getFilePathList(`${absolutePath}/${path}`, false);
fileList.forEach(filePath => {
fs.unlinkSync(`${absolutePath}/${path}/${filePath}`);
})
fs.rmdirSync(`${absolutePath}/${path}`);
return true
}
if(type === 2){
if (type === 2) {
fs.unlinkSync(`${absolutePath}/${path}`);
return true
}
if(type === 3){
if (type === 3) {
fs.unlinkSync(`${path}`);
return true
}
}
// 获取系统文件绝对路径
public getAbsolutePath = () =>{
public getAbsolutePath = () => {
const {absolutePath} = this;
return absolutePath
}
@ -169,7 +172,7 @@ export default class FileUtil{
public getSdCardPathList = async () => {
this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
const {wantInfos,context} = this;
const fileAccessHelper = fileAccess.createFileAccessHelper(this.context,this.wantInfos);
const fileAccessHelper = fileAccess.createFileAccessHelper(this.context, this.wantInfos);
this.fileAccessHelper = fileAccessHelper;
let isDone = false;
@ -185,48 +188,48 @@ export default class FileUtil{
if (!isDone) {
let deviceType = rootInfo.value.deviceType;
let displayName = rootInfo.value.displayName;
let uri:string = rootInfo.value.uri;
let uri: string = rootInfo.value.uri;
let deviceFlags = rootInfo.value.deviceFlags;
console.error(LOGTAG,`设备类型:${deviceType},设备名称:${displayName}设备根目录Uri${uri},设备支持的能力:${deviceFlags}`);
console.error(LOGTAG, `设备类型:${deviceType},设备名称:${displayName}设备根目录Uri${uri},设备支持的能力:${deviceFlags}`);
if(uri.indexOf('/mnt/external/')>0){
if (uri.indexOf('/mnt/external/') > 0) {
// if('vol-8-1' ==displayName){
this.destFile = uri.split('ExternalFileManager')[1]+'/'
console.error(LOGTAG,`外置存储路径:`+this.destFile);
this.getFilePathList(this.destFile,true)
this.destFile = uri.split('ExternalFileManager')[1] + '/'
console.error(LOGTAG, `外置存储路径:` + this.destFile);
this.getFilePathList(this.destFile, true)
}
}
}
} catch (error) {
console.error(LOGTAG,"getRoots failed, errCode:" + error.code + ", errMessage:" + error.message);
console.error(LOGTAG, "getRoots failed, errCode:" + error.code + ", errMessage:" + error.message);
}
}
public getFileContent = (filePath:string) => {
public getFileContent = (filePath: string) => {
const {absolutePath} = this;
const { READ_WRITE }= fs.OpenMode
const { READ_WRITE } = fs.OpenMode
const path = `${absolutePath}/${filePath}`
const str = fs.readTextSync(path);
return str
}
private getFilePathList = async (filePath:string,isSdcard:boolean) => {
let fileName = [],sdCardFileName = [];
private getFilePathList = async (filePath: string, isSdcard: boolean) => {
let fileName = [], sdCardFileName = [];
try {
const filenames = await fs.listFile(filePath);
for (let i = 0; i < filenames.length; i++) {
console.error(LOGTAG,`目录:${filePath}的子文件:${filenames[i]}`);
if(isSdcard){
console.error(LOGTAG, `目录:${filePath}的子文件:${filenames[i]}`);
if (isSdcard) {
sdCardFileName.push(filenames[i])
}else{
} else {
fileName.push(filenames[i])
}
}
return isSdcard ? sdCardFileName : fileName
}catch (e){
console.error(LOGTAG,JSON.stringify(e));
} catch (e) {
console.error(LOGTAG, JSON.stringify(e));
}
}
@ -240,17 +243,15 @@ export default class FileUtil{
];
this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
atManager.requestPermissionsFromUser(context, permissions , async (code, result) => {
atManager.requestPermissionsFromUser(context, permissions, async (code, result) => {
const permissionRequest = result.authResults[0]
if(permissionRequest == -1){
if (permissionRequest == -1) {
promptAction.showToast({
message: "请先授权",
duration:3000,
duration: 3000,
})
return
}
})
}
}

View File

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

View File

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

View File

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

View File

@ -30,7 +30,8 @@ export default async function request(req: any) {
header: {
'Content-Type': xml ? 'text/xml' : 'application/json'
},
extraData: xml ? data : JSON.stringify(data)
extraData: xml ? data : JSON.stringify(data),
connectTimeout:120000,
}
//params转url拼接参数
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 promptAction from '@ohos.promptAction';
import errorMsgDialog from './compontents/errorMsgDialog'
import { voiceService } from '../common/service/voiceService';
@Entry
@Component
@ -72,7 +73,6 @@ export default struct Index {
ForEach(this.imgArr1, (item: Resource, index: number) => {
if (index === this.imgArr1.length - 1) {
Image(item).width('38%').height('24%').onClick(() => {
if (this.inputTextArr[0].trim() == '' || this.inputTextArr[1].trim() == '') {
promptAction.showToast({
message: '请输入用户名和密码',
@ -132,10 +132,10 @@ export default struct Index {
})
} else {
Image(item).width('18%').height('24%').onClick(() => {
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
this.vocObj.playAudio({
type: 1,
name: 'media_button.wav'
})
this.url = ''
if (index < 9) {
this.inputTextArr[this.currentInputIndex] += (index + 1).toString()
@ -182,6 +182,8 @@ export default struct Index {
}
onPageShow() {
this.vocObj = new voiceService(async (status, val, next) => {
});
}
outClick() {

View File

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

View File

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

View File

@ -1,4 +1,5 @@
import router from '@ohos.router'
import { voiceService } from '../common/service/voiceService'
import TopLogo from './compontents/TopLogo'
@Entry
@ -18,18 +19,30 @@ export default struct Index {
Column() {
Row() {
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'
router.pushUrl({
url: this.url,
}, router.RouterMode.Single);
})
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'
router.pushUrl({
url: this.url,
}, router.RouterMode.Single);
})
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'
router.pushUrl({
url: this.url,
@ -74,6 +87,8 @@ export default struct Index {
}
aboutToAppear() {
this.vocObj = new voiceService(async (status, val, next) => {
});
this.carNum = globalThis.carInfo.plateNo;
this.version = globalThis.version;
this.hasAuth = globalThis.hasAuth;

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@ export const judgeConfig = {
// 本地模型地址
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:{
//gps位数

View File

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