Options
All
  • Public
  • Public/Protected
  • All
Menu

Module service/resource

Index

Type aliases

AnalyticsRet

AnalyticsRet: Record<string, { prePv: string; preUv: string; pv: string; uv: string }>

观看数据

AnalyticsType

AnalyticsType: "video"

资源类型

DocumentConfig

DocumentConfig: { config?: { accessType?: DocumentAccess; maxPage?: number; pageTitle: string; showDownload?: boolean; showMail?: boolean; showShare?: boolean; type: "book" | "fullPage"; wmOptions?: Partial<{ content: string; enabled: boolean; font: { color: string; lineHeight?: number; size: number; style: string; weight: string }; img: { placement: "tl" | "tr" | "center" | "bl" | "br"; width: number }; multi: boolean; opacity: number; rotate: number; type?: "img" | "text" }> }; documentConfigDto?: { detail: { accessType: DocumentAccess; actions: { icon: string; id: number | string; showText: boolean; text: string; visible: boolean }[]; buttonIcons: { height: number; position: { x: { key: string; value: number }; y: { key: string; value: number } }; spacing: number; toggleFalseIcon: string; toggleTrueIcon: string; width: number }; maxPage: number; type: "vertical" | "horizontal" }; isByDefault: boolean }; downloadUrl: string; hashId: string; name: string; pdfInfo?: { at: string; pageSize: number; pages: string[]; status: number; totalSize: string }; pdfShare?: wx.ShareToUserConfig; source: string }

Type declaration

  • Optional config?: { accessType?: DocumentAccess; maxPage?: number; pageTitle: string; showDownload?: boolean; showMail?: boolean; showShare?: boolean; type: "book" | "fullPage"; wmOptions?: Partial<{ content: string; enabled: boolean; font: { color: string; lineHeight?: number; size: number; style: string; weight: string }; img: { placement: "tl" | "tr" | "center" | "bl" | "br"; width: number }; multi: boolean; opacity: number; rotate: number; type?: "img" | "text" }> }
    • Optional accessType?: DocumentAccess
    • Optional maxPage?: number
    • pageTitle: string
    • Optional showDownload?: boolean
    • Optional showMail?: boolean
    • Optional showShare?: boolean
    • type: "book" | "fullPage"
    • Optional wmOptions?: Partial<{ content: string; enabled: boolean; font: { color: string; lineHeight?: number; size: number; style: string; weight: string }; img: { placement: "tl" | "tr" | "center" | "bl" | "br"; width: number }; multi: boolean; opacity: number; rotate: number; type?: "img" | "text" }>
  • Optional documentConfigDto?: { detail: { accessType: DocumentAccess; actions: { icon: string; id: number | string; showText: boolean; text: string; visible: boolean }[]; buttonIcons: { height: number; position: { x: { key: string; value: number }; y: { key: string; value: number } }; spacing: number; toggleFalseIcon: string; toggleTrueIcon: string; width: number }; maxPage: number; type: "vertical" | "horizontal" }; isByDefault: boolean }
    • detail: { accessType: DocumentAccess; actions: { icon: string; id: number | string; showText: boolean; text: string; visible: boolean }[]; buttonIcons: { height: number; position: { x: { key: string; value: number }; y: { key: string; value: number } }; spacing: number; toggleFalseIcon: string; toggleTrueIcon: string; width: number }; maxPage: number; type: "vertical" | "horizontal" }
      • accessType: DocumentAccess
      • actions: { icon: string; id: number | string; showText: boolean; text: string; visible: boolean }[]
      • buttonIcons: { height: number; position: { x: { key: string; value: number }; y: { key: string; value: number } }; spacing: number; toggleFalseIcon: string; toggleTrueIcon: string; width: number }
        • height: number
        • position: { x: { key: string; value: number }; y: { key: string; value: number } }
          • x: { key: string; value: number }
            • key: string
            • value: number
          • y: { key: string; value: number }
            • key: string
            • value: number
        • spacing: number
        • toggleFalseIcon: string
        • toggleTrueIcon: string
        • width: number
      • maxPage: number
      • type: "vertical" | "horizontal"
    • isByDefault: boolean
  • downloadUrl: string
  • hashId: string
  • name: string
  • Optional pdfInfo?: { at: string; pageSize: number; pages: string[]; status: number; totalSize: string }
    • at: string
    • pageSize: number
    • pages: string[]
    • status: number
    • totalSize: string
  • Optional pdfShare?: wx.ShareToUserConfig
  • source: string

UploadParams

UploadParams: { callback: string; key: string; ossAccessKeyId: string; policy: string; requestUri: string; signature: string; success_action_status: string }

上传到oss的参数

Type declaration

  • callback: string
  • key: string
  • ossAccessKeyId: string
  • policy: string
  • requestUri: string
  • signature: string
  • success_action_status: string

VideoConfig

VideoConfig: { code: ReturnCode; config?: { accessType: VideoAccessType; cover: string; pageTitle?: string; previewTimestamp: string | null; shareInfo?: wx.ShareToUserConfig; size?: { videoHeight: string; videoWidth: string }; watermark?: WmImgOptions }; downloadUrl: string; name: string }

视频信息

Type declaration

  • code: ReturnCode
  • Optional config?: { accessType: VideoAccessType; cover: string; pageTitle?: string; previewTimestamp: string | null; shareInfo?: wx.ShareToUserConfig; size?: { videoHeight: string; videoWidth: string }; watermark?: WmImgOptions }
    • accessType: VideoAccessType
    • cover: string

      封面

      description

      截帧的图片需要替换后面的oss参数

    • Optional pageTitle?: string
    • previewTimestamp: string | null

      试看时间

    • Optional shareInfo?: wx.ShareToUserConfig

      微信分享信息

    • Optional size?: { videoHeight: string; videoWidth: string }

      视频的原始比例

      • videoHeight: string
      • videoWidth: string
    • Optional watermark?: WmImgOptions
  • downloadUrl: string

    源链接

  • name: string

Functions

getDocumentConfig

  • 获取文档资源config

    Parameters

    • hashId: string = config.uaId

    Returns Promise<DocumentConfig>

getJson

  • getJson(file: string): Promise<unknown[]>
  • deprecated

    使用cms存储数据 获取指定json

    Parameters

    • file: string

    Returns Promise<unknown[]>

getResourceAnalytics

  • 批量查询视频观看次数

    Parameters

    • ids: string[]
    • type: "video"

    Returns Promise<{ ret: AnalyticsRet; statusCode: ReturnCode }>

getResourceDetail

  • getResourceDetail(type: "video" | "document", ids: string): Promise<Record<string, { name: string; remark: string; size: string; uploatAt: string }>>
  • 获取资源上传信息

    Parameters

    • type: "video" | "document"
    • ids: string

    Returns Promise<Record<string, { name: string; remark: string; size: string; uploatAt: string }>>

getSignatureUrl

  • getSignatureUrl(file: string): Promise<string>
  • 获取资源授权后的签名地址

    Parameters

    • file: string

    Returns Promise<string>

getVideoConfig

  • 获取视频资源config

    Parameters

    • hashId: string = config.uaId

    Returns Promise<VideoConfig>

getVideoProgress

  • getVideoProgress(hashId?: string): Promise<{ code: ReturnCode; progress: string }>
  • 查询视频观看进度

    Parameters

    • hashId: string = config.uaId

    Returns Promise<{ code: ReturnCode; progress: string }>

resourceApi

  • resourceApi(target: string, data?: any, freeLogin?: 0 | 1): Promise<any>
  • 资源管理 的代理接口

    description

    系统资源管理模块的暴露接口

    export

    Parameters

    • target: string

      请求路由

    • Optional data: any
    • Optional freeLogin: 0 | 1

    Returns Promise<any>

saveVideoProgress

  • saveVideoProgress(progress: number, hashId?: string): Promise<void>
  • 保存视频观看进度

    Parameters

    • progress: number
    • hashId: string = config.uaId

    Returns Promise<void>

sendDoc2Mail

  • sendDoc2Mail(resourceIds: string[], email: string, freeLogin?: undefined | 0 | 1): Promise<void>
  • 指定文档发送到指定邮箱

    Parameters

    • resourceIds: string[]
    • email: string
    • freeLogin: undefined | 0 | 1 = 1

    Returns Promise<void>

Const upload2Oss

  • upload2Oss(signature: UploadParams, file: File): Promise<{ filename: string; id?: string; url?: string }>
  • 图片上传

    description

    调用获取参数后,使用直传接口上传资源

    Parameters

    Returns Promise<{ filename: string; id?: string; url?: string }>

Generated using TypeDoc