Skip to content
文档目录

Class: QysUKeySdk

SDK 类,通过 QysUKeySdk 进行 sdk 实例创建

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new QysUKeySdk(params?)

Parameters

NameType
paramsPartial<QysUKeySdkConfig>

Properties

bus

bus: Emitter<QYS_SDK_INNER_EVENTS>

事件总线:一般在应用内部使用,参考 QYS_SDK_INNER_EVENTS 事件列表,标为内部调用的不建议通过 SDK 进行调用


config

config: QysUKeySdkConfig

QysUKeySdk 配置项


container

container: null | Element = null

签章页面所挂载的根元素:可以用来判断当前页面是否挂载


store

Private store: null | RematchStore<RootModel, Record<string, never>> = null

签章页面 store, 内部使用


storeSnapShoot

Private storeSnapShoot: null | RematchRootState<RootModel, Record<string, never>> = null

签章页面 store 快照, 用于一些数据对比,内部使用


uiReady

Private uiReady: boolean = false

签章页面组件是否完成挂载


version

Static version: string = version

当前版本号

Methods

addFile

addFile(file): void

添加单个或多个文件

Parameters

NameType
fileundefined | CustomFileData | File | FileList | CustomFileData[]

Returns

void


addStamper

addStamper(type?): void

向当前PDF页面添加印章(仅H5生效)

Parameters

NameTypeDefault value
typeStamperType'SEAL_CORPORATE'

Returns

void


close

close(): void

卸载页面,unmount 的别名

Returns

void


doSwitchDocument

doSwitchDocument(docId): void

根据文件 id 切换文件

Parameters

NameTypeDescription
docIdstring文件 id,一般通过 getDocuments() 获取到文件列表,选择切换的文件传入其 id

Returns

void


downloadCurrentFile

downloadCurrentFile(): void

如果当前文件存在,则下载当前文件

Returns

void


downloadFile

downloadFile(file): void

指定下载文件

Parameters

NameTypeDescription
fileFileDescriptor参数 file 可以通过 getDocuments 获取到的结果指定

Returns

void


execAfterUiReady

Private execAfterUiReady(cb, args?): void

在页面 React 组件挂载完成后进行执行,内部调用

Parameters

NameTypeDefault value
cb(...args: any) => anyundefined
argsany[][]

Returns

void


getCurrentDocument

getCurrentDocument(): null | FileDescriptor

返回当前文件描述信息对象

Returns

null | FileDescriptor


getDocuments

getDocuments(): FileDescriptor[]

返回已添加的文件描述信息列表

Returns

FileDescriptor[]


getUI

getUI(style?): HTMLDivElement

渲染单体签章页面并返回应用挂载的 dom 容器

Parameters

NameTypeDescription
stylePartial<CSSStyleDeclaration>返回的 dom 容器的 css 样式

Returns

HTMLDivElement


getVerifyResult

getVerifyResult(): Signature[]

获取当前文件的所有验签信息

Returns

Signature[]


hideThirdBtnFn

hideThirdBtnFn(): void

Returns

void


isNeedSave

isNeedSave(): boolean

当前是否需要进行保存签名

Returns

boolean


isNoAp

isNoAp(): boolean

当前是否为无外观印章

Returns

boolean


removeDocument

removeDocument(id): void

从当前文件列表中移除指定文件

Parameters

NameTypeDescription
idstringid 为文件描述信息中的 id 字段

Returns

void


render

render(container): void

将单体签章页面渲染到指定容器上

Parameters

NameType
containerElement

Returns

void


setConfig

Private setConfig(config): void

设置当前 sdk 配置项,内部调用

Parameters

NameType
configQysUKeySdkConfig

Returns

void


showSeal

showSeal(): void

控制左侧签章工具面版的展示

Returns

void


showThirdBtnFn

showThirdBtnFn(): void

Returns

void


showVerifyContent

showVerifyContent(): void

控制左侧验签工具栏展示

Returns

void


signPdf

signPdf(): void

签署需要保存的pdf文件

Returns

void


unmount

unmount(): boolean

卸载单体签章页面

Returns

boolean


updateConfig

updateConfig(config): void

更新当前配置信息

Parameters

NameType
configPartial<QysUKeySdkConfig>

Returns

void