123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- import { Platform } from '@ionic/angular';
- import Parse from "parse";
- import { Diagnostic } from '@awesome-cordova-plugins/diagnostic/ngx';
- /**
- * MediaCapture插件
- * @private
- * @description
- * 依赖:File
- * npm i -S cordova-plugin-file @awesome-cordova-plugins/file
- */
- import { MediaFile } from "@awesome-cordova-plugins/media-capture";
- import * as i0 from "@angular/core";
- /**
- * NovaFile 文件类型
- * @public
- */
- export interface NovaFile {
- id: string;
- key: string;
- url: string;
- name: string;
- type: string;
- size: number;
- md5?: string;
- }
- /**
- * NovaUploadService 上传服务
- * @public
- */
- export declare class NovaUploadService {
- private platform;
- private diagnostic;
- company: string;
- uptoken: string;
- qiniuConf: any;
- domain: string;
- constructor(platform: Platform, diagnostic: Diagnostic);
- /**
- * 全端通用上传方法
- * @params file:File 待上传文件
- * @params onProgress:Function 上传进度回调函数
- * @returns
- * progressData {
- "total": {
- "size": 8491,
- "loaded": 8490,
- "percent": 99.98822282416675
- }
- }
- * novafileData {
- "id":"xxxxxxxxxx" // Attachment.objectId
- "hash": "FoYHjpyTif1t8uOMv6N6sVIeGTvq",
- "key": "E4KpGvTEto/20230901/053605467.jpg",
- "url": "https://file-cloud.fmode.cn/E4KpGvTEto/20230901/053605467.jpg",
- "name": "20230901173605.jpg",
- "type": "image/jpg",
- "size": 7853
- }
- */
- upload(file: File, onProgress?: Function): Promise<NovaFile>;
- /**
- * 移动端上传专用方法
- * @returns
- */
- isCapacitor(): boolean;
- requestPermission(): Promise<void>;
- requestStoagePermission(): Promise<void>;
- requestCameraPermission(): Promise<void>;
- /**
- * 上传Token获取方法
- * @returns
- */
- getUptoken(refresh?: boolean): Promise<void>;
- /**
- * 生成文件上传Key值:<公司id>/<yyyymmdd>/<file.id><hhMMss>.<ext>
- * @desc 用于对象存储含全路径的文件名称
- */
- genFileKey(file: {
- id: string;
- name: string;
- }, company?: any): string;
- /**
- * 获取当前登录用户公司ID
- * @returns 公司ID
- */
- getCompanyId(): string;
- qiniuDomain: string;
- queryDomain(): Promise<void>;
- /**
- * 保存上传信息至附件表 Attachment
- * @param file 附件信息
- * @returns attachment Parse.Object
- */
- saveAttachment(file: NovaFile | {
- url: string;
- size: string;
- name: string;
- type: string;
- md5?: string;
- }, domain: any, cateId?: any, company?: any): Promise<Parse.Object>;
- /**
- * 录像并上传
- */
- captureVideo(conf: any): Promise<any>;
- cameraCaptureVideoFile(): Promise<MediaFile | any | null>;
- getMediaFileDataString(mediafile: any): Promise<Blob>;
- /**
- * 拍照并上传
- * @returns -- {hash?:string,url:string,name:string,size:number,key:stirng}
- */
- takePicture(conf: any): Promise<any>;
- cameraTakePictureDataUrl(): Promise<import("@capacitor/camera").Photo>;
- maxSize: number;
- /**
- * 七牛上传函数:无需前端组件
- * @param imageBlob: Blob
- * @param format: string
- */
- saveQiniuImageFile(imageBlob: Blob, format: string, company?: string, onProgress?: Function): Promise<NovaFile | any>;
- saveQiniuMediaFile(mediafile: any, fileBlob: Blob, company?: string, onProgress?: Function): Promise<NovaFile | any>;
- base64ToBlobType(string: any, type: any): Promise<Blob>;
- base64ToBlob(base64Img: string): Promise<Blob>;
- fileToBlob(file: File): Blob;
- genMd5(inputString: string): string;
- static ɵfac: i0.ɵɵFactoryDeclaration<NovaUploadService, never>;
- static ɵprov: i0.ɵɵInjectableDeclaration<NovaUploadService>;
- }
|