dev #63
@ -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,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 today = new Date(); // 当前日期
|
||||||
const target = new Date(date); // 需要判断的日期
|
const target = new Date(date); // 需要判断的日期
|
||||||
console.info("listFile succeed1", JSON.stringify(target));
|
console.info("listFile succeed1", JSON.stringify(target));
|
||||||
@ -95,58 +74,50 @@ function isSevenDaysAgo(date,saveDays?) {
|
|||||||
const diffDays = diff / (1000 * 60 * 60 * 24); // 将毫秒转换为天数
|
const diffDays = diff / (1000 * 60 * 60 * 24); // 将毫秒转换为天数
|
||||||
console.info("listFile succeed2", (diffDays));
|
console.info("listFile succeed2", (diffDays));
|
||||||
// 如果差异天数正好是2,则原日期是当前日期的前2天
|
// 如果差异天数正好是2,则原日期是当前日期的前2天
|
||||||
return diffDays > (saveDays||2);
|
return diffDays > (saveDays || 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
|
||||||
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))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//配置流水号
|
||||||
|
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('拍照失败')
|
console.log('拍照失败')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('takePhototakePhoto',JSON.stringify(data))
|
console.log('takePhototakePhoto', JSON.stringify(data))
|
||||||
const zdyz=globalThis.param854Str?Number(globalThis.param854Str):Number(param.zdyz)
|
const zdyz = globalThis.param854Str ? Number(globalThis.param854Str) : Number(param.zdyz)
|
||||||
console.log('takePhototakePhoto',JSON.stringify(zdyz),)
|
console.log('takePhototakePhoto', JSON.stringify(zdyz),)
|
||||||
|
|
||||||
if (Number(data.fileSize) <= (zdyz * 1000)) {
|
if (Number(data.fileSize) <= (zdyz * 1000)) {
|
||||||
map[key1] = true
|
map[key1] = true
|
||||||
|
|||||||
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,8 @@ 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[]
|
||||||
private fileAccessHelper: fileAccess.FileAccessHelper
|
private fileAccessHelper: fileAccess.FileAccessHelper
|
||||||
@ -14,7 +15,7 @@ export default class FileUtil{
|
|||||||
//后续文件路径待替换
|
//后续文件路径待替换
|
||||||
private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files'
|
private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files'
|
||||||
|
|
||||||
public destFile:string
|
public destFile: string
|
||||||
|
|
||||||
constructor(wantInfos) {
|
constructor(wantInfos) {
|
||||||
const {requestPermission} = this;
|
const {requestPermission} = this;
|
||||||
@ -26,23 +27,23 @@ export default class FileUtil{
|
|||||||
* @desc 校验文件夹,文件夹不存在会创建,支持嵌套
|
* @desc 校验文件夹,文件夹不存在会创建,支持嵌套
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public initFolder = async (folderPath:string) => {
|
public initFolder = async (folderPath: string) => {
|
||||||
const {absolutePath} = this;
|
const {absolutePath} = this;
|
||||||
const folderList = folderPath.split('/').filter(folderName => folderName !== '');
|
const folderList = folderPath.split('/').filter(folderName => folderName !== '');
|
||||||
|
|
||||||
let path = absolutePath
|
let path = absolutePath
|
||||||
folderList.forEach((folderName=>{
|
folderList.forEach((folderName => {
|
||||||
path += `/${folderName}`;
|
path += `/${folderName}`;
|
||||||
try {
|
try {
|
||||||
const isExit = fs.accessSync(path);
|
const isExit = fs.accessSync(path);
|
||||||
if(!isExit){
|
if (!isExit) {
|
||||||
fs.mkdirSync(path)
|
fs.mkdirSync(path)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.info('初始化文件夹失败',path)
|
console.info('初始化文件夹失败', path)
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
message:`初始化文件夹失败`+JSON.stringify(e),
|
message: `初始化文件夹失败` + JSON.stringify(e),
|
||||||
duration:4000,
|
duration: 4000,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,62 +51,64 @@ 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);
|
||||||
//文件存在先删除
|
//文件存在先删除
|
||||||
if(isExit){
|
if (isExit) {
|
||||||
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public openFileSync=async(filePath)=>{
|
public openFileSync = async (filePath) => {
|
||||||
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode
|
const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
|
||||||
let file = fs.openSync(filePath, READ_WRITE | APPEND |CREATE);
|
let file = fs.openSync(filePath, READ_WRITE | APPEND | CREATE);
|
||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
|
|
||||||
public editFileWidthOutOpen(file,content){
|
public editFileWidthOutOpen(file, content) {
|
||||||
const newStr = content + '\n'
|
const newStr = content + '\n'
|
||||||
fs.writeSync(file.fd,newStr)
|
fs.writeSync(file.fd, newStr)
|
||||||
fs.closeSync(file)
|
fs.closeSync(file)
|
||||||
console.error(LOGTAG,'写入文件成功')
|
console.error(LOGTAG, '写入文件成功')
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @desc 创建或者编辑文件
|
* @desc 创建或者编辑文件
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public editFile = async (filePath:string,content:string,fd?:number)=>{
|
public editFile = async (filePath: string, content: string, fd?: number) => {
|
||||||
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode
|
const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
|
||||||
try {
|
try {
|
||||||
const newStr = content + '\n'
|
const newStr = content + '\n'
|
||||||
if(fd !== undefined){
|
if (fd !== undefined) {
|
||||||
fs.writeSync(fd,newStr)
|
fs.writeSync(fd, newStr)
|
||||||
return fd
|
return fd
|
||||||
}else{
|
} else {
|
||||||
let file = fs.openSync(filePath, READ_WRITE | APPEND |CREATE);
|
let file = fs.openSync(filePath, READ_WRITE | APPEND | CREATE);
|
||||||
fs.writeSync(file.fd,newStr)
|
fs.writeSync(file.fd, newStr)
|
||||||
return file.fd
|
return file.fd
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
console.error(LOGTAG,JSON.stringify(e))
|
console.error(LOGTAG, JSON.stringify(e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,12 +116,12 @@ export default class FileUtil{
|
|||||||
* @desc 读取文件
|
* @desc 读取文件
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
public readFile = async (filePath:string) => {
|
public readFile = async (filePath: string) => {
|
||||||
try{
|
try {
|
||||||
console.log('strrr',filePath)
|
console.log('strrr', filePath)
|
||||||
const str = await fs.readText(filePath);
|
const str = await fs.readText(filePath);
|
||||||
return str
|
return str
|
||||||
}catch (err){
|
} catch (err) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,9 +130,9 @@ export default class FileUtil{
|
|||||||
/*
|
/*
|
||||||
* @desc获取系统目录里的文件列表
|
* @desc获取系统目录里的文件列表
|
||||||
*/
|
*/
|
||||||
public getDeviceList = async (folderPath?:string)=>{
|
public getDeviceList = async (folderPath?: string) => {
|
||||||
const {absolutePath,getFilePathList} = this;
|
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:自定义目录下文件
|
* @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
|
const {getFilePathList,absolutePath} = this
|
||||||
if(type === 1){
|
if (type === 1) {
|
||||||
const fileList = await getFilePathList(`${absolutePath}/${path}`,false);
|
const fileList = await getFilePathList(`${absolutePath}/${path}`, false);
|
||||||
fileList.forEach(filePath =>{
|
fileList.forEach(filePath => {
|
||||||
fs.unlinkSync(`${absolutePath}/${path}/${filePath}`);
|
fs.unlinkSync(`${absolutePath}/${path}/${filePath}`);
|
||||||
})
|
})
|
||||||
fs.rmdirSync(`${absolutePath}/${path}`);
|
fs.rmdirSync(`${absolutePath}/${path}`);
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type === 2){
|
if (type === 2) {
|
||||||
fs.unlinkSync(`${absolutePath}/${path}`);
|
fs.unlinkSync(`${absolutePath}/${path}`);
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if(type === 3){
|
if (type === 3) {
|
||||||
fs.unlinkSync(`${path}`);
|
fs.unlinkSync(`${path}`);
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取系统文件绝对路径
|
// 获取系统文件绝对路径
|
||||||
public getAbsolutePath = () =>{
|
public getAbsolutePath = () => {
|
||||||
const {absolutePath} = this;
|
const {absolutePath} = this;
|
||||||
return absolutePath
|
return absolutePath
|
||||||
}
|
}
|
||||||
@ -169,7 +172,7 @@ export default class FileUtil{
|
|||||||
public getSdCardPathList = async () => {
|
public getSdCardPathList = async () => {
|
||||||
this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
|
this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
|
||||||
const {wantInfos,context} = this;
|
const {wantInfos,context} = this;
|
||||||
const fileAccessHelper = fileAccess.createFileAccessHelper(this.context,this.wantInfos);
|
const fileAccessHelper = fileAccess.createFileAccessHelper(this.context, this.wantInfos);
|
||||||
this.fileAccessHelper = fileAccessHelper;
|
this.fileAccessHelper = fileAccessHelper;
|
||||||
|
|
||||||
let isDone = false;
|
let isDone = false;
|
||||||
@ -185,48 +188,48 @@ export default class FileUtil{
|
|||||||
if (!isDone) {
|
if (!isDone) {
|
||||||
let deviceType = rootInfo.value.deviceType;
|
let deviceType = rootInfo.value.deviceType;
|
||||||
let displayName = rootInfo.value.displayName;
|
let displayName = rootInfo.value.displayName;
|
||||||
let uri:string = rootInfo.value.uri;
|
let uri: string = rootInfo.value.uri;
|
||||||
let deviceFlags = rootInfo.value.deviceFlags;
|
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){
|
// if('vol-8-1' ==displayName){
|
||||||
this.destFile = uri.split('ExternalFileManager')[1]+'/'
|
this.destFile = uri.split('ExternalFileManager')[1] + '/'
|
||||||
console.error(LOGTAG,`外置存储路径:`+this.destFile);
|
console.error(LOGTAG, `外置存储路径:` + this.destFile);
|
||||||
this.getFilePathList(this.destFile,true)
|
this.getFilePathList(this.destFile, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} 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 {absolutePath} = this;
|
||||||
const { READ_WRITE }= fs.OpenMode
|
const { READ_WRITE } = fs.OpenMode
|
||||||
const path = `${absolutePath}/${filePath}`
|
const path = `${absolutePath}/${filePath}`
|
||||||
const str = fs.readTextSync(path);
|
const str = fs.readTextSync(path);
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
private getFilePathList = async (filePath:string,isSdcard:boolean) => {
|
private getFilePathList = async (filePath: string, isSdcard: boolean) => {
|
||||||
let fileName = [],sdCardFileName = [];
|
let fileName = [], sdCardFileName = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filenames = await fs.listFile(filePath);
|
const filenames = await fs.listFile(filePath);
|
||||||
for (let i = 0; i < filenames.length; i++) {
|
for (let i = 0; i < filenames.length; i++) {
|
||||||
console.error(LOGTAG,`目录:${filePath}的子文件:${filenames[i]}`);
|
console.error(LOGTAG, `目录:${filePath}的子文件:${filenames[i]}`);
|
||||||
if(isSdcard){
|
if (isSdcard) {
|
||||||
sdCardFileName.push(filenames[i])
|
sdCardFileName.push(filenames[i])
|
||||||
}else{
|
} else {
|
||||||
fileName.push(filenames[i])
|
fileName.push(filenames[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isSdcard ? sdCardFileName : fileName
|
return isSdcard ? sdCardFileName : fileName
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
console.error(LOGTAG,JSON.stringify(e));
|
console.error(LOGTAG, JSON.stringify(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -240,17 +243,15 @@ export default class FileUtil{
|
|||||||
];
|
];
|
||||||
this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
|
this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
|
||||||
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
|
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]
|
const permissionRequest = result.authResults[0]
|
||||||
if(permissionRequest == -1){
|
if (permissionRequest == -1) {
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
message: "请先授权",
|
message: "请先授权",
|
||||||
duration:3000,
|
duration: 3000,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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}`);
|
||||||
|
|||||||
@ -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 = () => {
|
||||||
|
|||||||
@ -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]}&`), '?') || '';
|
||||||
|
|||||||
@ -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() {
|
||||||
|
|||||||
@ -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()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)')
|
||||||
@ -1329,6 +1352,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 = ''
|
||||||
//速度
|
//速度
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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 })
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -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位数
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user