Compare commits

...

2 Commits

Author SHA1 Message Date
Surenjun
c8bfacb9af Merge remote-tracking branch 'origin/api10' into api10 2025-03-26 14:58:47 +08:00
Surenjun
d55643fd87 feat:filePhoto.ets修改 2025-03-26 14:58:38 +08:00
2 changed files with 18 additions and 28 deletions

View File

@ -65,10 +65,10 @@ export interface VideoConfig {
dolt?: string, dolt?: string,
fontSize?: string fontSize?: string
rlls?: string, rlls?: string,
spzd4: boolean, spzd4?: boolean,
spzd3: boolean, spzd3?: boolean,
spzd2: boolean, spzd2?: boolean,
spzd1: boolean, spzd1?: boolean,
zdyz?: string, zdyz?: string,
} }

View File

@ -1,29 +1,20 @@
import { takePhoto } from '../../../service/videoService'; import { takePhoto } from '../../../utils/Video';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { judgeConfig } from './judgeConfig'; import { judgeConfig } from './judgeConfig';
import FileUtils from '../../../utils/FileUtils'; import FileUtils from '../../../utils/FileUtils';
import {VideoConfig} from '../../../model/Common'
interface Params { import common from '@ohos.app.ability.common';
userName: string
pwd: string
ip: string
port: string
rlls: string
pztd: string
}
export default class FilePhoto { export default class FilePhoto {
public mediaTest private params: VideoConfig
private params: Params private context:common.UIAbilityContext
private context: any
public getPhoto = async () => { public getPhoto = async () => {
const { params } = this;
if (!judgeConfig.isPhotoOpen) { if (!judgeConfig.isPhotoOpen) {
return '' return ''
} else { } else {
try { try {
console.info('surenjun', '拍照开始') console.info('surenjun', '拍照开始')
const res = await takePhoto(params, this.context, 'pz/', 2); const res = await takePhoto(this.params, this.context, 'pz/', 2);
console.info('surenjun', '拍照结束' + JSON.stringify(res)) console.info('surenjun', '拍照结束' + JSON.stringify(res))
return res.base64 return res.base64
} catch (e) { } catch (e) {
@ -38,21 +29,20 @@ export default class FilePhoto {
} }
private fileUtil: FileUtils private fileUtil: FileUtils
constructor(context) { constructor(context:common.UIAbilityContext) {
(async () => { (async () => {
//TODO 309参数 获取拍照摄像头拍照通道 //TODO 309参数 获取拍照摄像头拍照通道
const fileUtil = new FileUtils(context) const fileUtil = new FileUtils(context)
const strConfig = const strConfig =
await fileUtil.readFile('/mnt/hmdfs/100/account/device_view/local/files/duolun/config/config3.txt'); await fileUtil.readFile('/mnt/hmdfs/100/account/device_view/local/files/duolun/config/config3.txt');
const config = JSON.parse(strConfig) const config: VideoConfig = JSON.parse(strConfig as string)
const { userName, ip, pwd, port, rlls, pztd } = config
this.params = { this.params = {
userName, userName:config.userName,
pwd, pwd:config.pwd,
ip, ip:config.ip,
port, port:config.port,
rlls, rlls:config.rlls,
pztd pztd:config.pztd,
} }
this.context = context this.context = context
this.fileUtil = fileUtil this.fileUtil = fileUtil