# setDailogInfo 调用全局弹窗
● 接口说明
根据特定的入参来调用特定样式的全局弹窗,并根据点击弹窗的按钮拿到特定的返回值
● Typescript 类型参考
type ReqBody = {
type?: string, //'success' | 'info' | 'warning' | 'error',默认是info
title?: string, //标题,默认是'提示'
content?: string, //内容,默认是'提示内容'
showClose?: boolean,//是否显示右上角关闭按钮,默认是false
showCancel?: boolean,//是否显示取消按钮,默认是true
showConfirm?: boolean,//是否显示取消按钮,默认是true
cancelText?: string,//取消按钮的文本内容 ,默认是'取消'
confirmText?: string,//确定按钮的文本内容,默认是'确定'
}
type ResBody = {
confirm: ReqBody,
result:boolean
}
setDailogInfo(data: ReqBody, callback?: (res: ResBody)=>void): Promise<ResBody>
● 返回数据
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.confirm | Object | 是 | 返回调用弹窗接口的入参 |
res.result | Boolean | 是 | 返回点击弹窗的按钮结果 |
● 示例
zwexplorer["__native"]["setDailogInfo"]({}, (res) => {});
# getAllPluginsInstalled 获取已安装插件信息
● 接口说明
获取所有已安装插件信息
● Typescript 类型参考
type ResBody = {
[appName: string]: {
version: string,
pluginName:string,
name:string,
__legalized:boolean,
arch:string,
platform:string
},
}
getAllPluginsInstalled(callback?: (res: ResBody)=>void): Promise<ResBody>
● 返回数据
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
data[appName] | Object | 否 | res.resultCode===0 时,返回已安装插件信息 |
data[appName].version | String | 是 | res.resultCode===0 时,返回已安装插件版本号 |
data[appName].pluginName | String | 是 | res.resultCode===0 时,返回已安装插件名 |
data[appName].name | String | 是 | res.resultCode===0 时,返回已安装插件模块类型 |
data[appName].legalized | String | 是 | res.resultCode===0 时,返回已安装插件是否已激活 |
data[appName].arch | String | 是 | res.resultCode===0 时,返回已安装插件的芯片架构, 目前有 arm64, x64, loong64 |
data[appName].platform | String | 是 | res.resultCode===0 时,返回已安装插件的平台,目前有 win32(windows),kylin(银河麒麟),uos(统信) |
● 示例
zwexplorer["__native"]["getAllPluginsInstalled"]((res) => {
});
# installPluginsFromNetwork 批量安装插件
● 接口说明
批量安装插件和动态库
● Typescript 类型参考
type DeviceInfo = {
appName: string, //插件ID
name: string, //插件中文名
version: string, //版本号
arch: string, //芯片架构
platform: string, //操作系统
publisher:string, //发行厂商
installStatu: number, //插件安装状态,1为已进行过安装,0为未安装
activationStatu: number, //插件激活状态,1为已进行过激活,0为未激活过
driveState: number //-1为没有驱动库,1为有驱动库且已进行过安装,0为有驱动库但未进行过安装
installTime: number //安装时间戳
activationTime: number //激活时间戳
}
type ReqBody = Array<{DeviceInfo}>
installPluginsFromNetwork(data: ReqBody, callback?: (res: ResBody)=>void): Promise<ResBody>
● 参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
data.installBuffer | Array | 是 | 多个安装 zip 包的组成一个 Zip 包的流 |
● 返回数据
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.data | Array | 是 | 返回安装的插件或驱动列表信息 |
res.data[index].appName | string | 是 | index 为数组下标,appName 为插件的 ID |
res.data[index].version | string | 是 | index 为数组下标,version 为插件版本号 |
res.data[index].name | string | 是 | index 为数组下标,name 为插件的中文名 |
res.data[index].arch | string | 是 | index 为数组下标,arch 为插件芯片架构 目前有 arm64, x64, loong64 |
res.data[index].platform | string | 是 | index 为数组下标,platform 为插件操作系统 目前有 win32 和 linux |
res.data[index].publisher | string | 是 | index 为数组下标,publisher 为插件 linux 发行厂商 目前有 Microsoft,kylin,Deepin,uos |
res.data[index].installStatu | number | 是 | index 为数组下标,installStatu 为插件安装状态 1 为已进行过安装 0 为未进行过安装 |
res.data[index].activationStatu | number | 是 | index 为数组下标,activationStatu 为插件激活状态 1 为已进行过激活 0 为未进行过激活 |
res.data[index].driveState | number | 是 | index 为数组下标,driveState 为插件驱动状态 1 为已进行过驱动安装 0 为未进行过驱动安装 |
res.data[index].activationTime | number | 是 | index 为数组下标,activationTime 为插件激活时间戳 |
res.data[index].installTime | number | 是 | index 为数组下标,installTime 为插件安装时间戳 |
● 示例
// window api
const data = {
installBuffers: "0x20c0012a8040"(ArrayBuffer),
};
zwexplorer["installPluginsFromNetwork"](data, (res) => {});
# getDeviceInfo 获取本地设备信息
● 接口说明
获取本地设备信息
● Typescript 类型参考
type ResBody = {
// 设备ID
deviceCode: string,
// 当前浏览器模式
browserMode: string,
// 当前浏览器版本
browserVersion: string,
// 平台
platform: string,
// 架构
arch: string,
//发行厂商
publisher: string
}
getDeviceInfo( callback: (res: ResBody)=>void): Promise<ResBody>
● 返回数据
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.deviceCode | string | 是 | 返回当前设备的设备 ID |
res.browserMode | string | 是 | 返回当前设备的浏览器模式 |
res.browserVersion | string | 是 | 返回当前设备的浏览器版本 |
res.platform | string | 是 | 返回当前设备的平台 |
res.arch | string | 是 | 返回当前设备的架构 |
res.publisher | string | 是 | 返回当前设备的发行厂商 |
● 示例
zwexplorer["__native"]["getDeviceInfo"]({}, (res) => {});
# downloadPlugin 官网插件单个下载并安装
● 接口说明
官网插件单个下载并安装
● Typescript 类型参考
type ReqBody = {
// 插件下载地址
url: string,
info:{
// 插件名
pluginName:string,
// 插件版本
version:string
}
}
type ResBody= string
downloadPlugin( callback: (res: ResBody)=>void): Promise<ResBody>
● 返回数据
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res | string | 是 | 返回"插件安装成功",否则弹出报错框 |
● 示例
zwexplorer["__native"]["downloadPlugin"](ReqBody, (res) => {});
# authentication 校验自助模式密码
● 接口说明
根据特定的入参来调用特定样式的全局弹窗,并根据点击弹窗的按钮拿到特定的返回值
● Typescript 类型参考
type ReqBody = {
password: string, //密码
}
type ResBody = {
resultCode: number,
resultMessage: string
}
setDailogInfo(data: ReqBody, callback?: (res: ResBody)=>void): Promise<ResBody>
● 返回数据
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.resultCode | number | 是 | 0 则校验成功,-1 则校验失败 |
res.resultMessage | string | 是 | 成功或失败的中文提示 |
● 示例
zwexplorer["__native"]["authentication"](ReqBody, (res) => {});