# getSystemInfo()
获取系统信息。
示例
this.$app.getSystemInfo().then(res => {
console.log(res.model);
console.log(res.pixelRatio);
console.log(res.windowWidth);
console.log(res.windowHeight);
console.log(res.language);
console.log(res.version);
console.log(res.platform);
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
language | String | 系统语言信息 |
name | String | 系统的名称 |
osvendor | String | 系统的供应商信息 |
version | String | 系统版本信息 |
height | Number | 屏幕高度物理分辨率 |
width | Number | 屏幕宽度物理分辨率 |
resolutionHeight | Number | 屏幕高度逻辑分辨率 |
resolutionWidth | Number | 屏幕宽度逻辑分辨率 |
scale | Number | 逻辑分辨率与物理分辨率的缩放比例 |
orientation | Number | 获取应用横竖屏状态 |
statusbarHeight | Number | 状态栏高度,单位px |
safeAreaInsets | Object | 应用的安全区域{"bottom" : 34,"top" : 44,"right" : 0,"left" : 0"isBottomBarShow":false},单位px,(isBottomBarShow底部软按键是否显示(此字段仅android支持,ios不返回此段),当bottom的值大于0 ,false不显示,true显示,当bottom的值等于0 ,此值无意义) |
vendor | String | 设备的生产厂商 |
model | String | 设备的型号 |
innerVersion | String | 客户端FOX运行环境的内部版本号 |
appid | String | 当前应用的APPID |
packageId | String | 当前应用包名 |
appName | String | 客户端的应用名称 |
versionCode | String | 客户端构建版本号 |
launcher | String | 应用启动来源 |
arguments | Object | 第三方程序调用时传递给程序的参数 |
carrier | String | 运营商名称 |
ip | String | ip地址 |
osType | String | 系统名称 |
imei | String | 手机序列号,仅限于Andriod |
isRoot | String | 设备是否root,仅限于Andriod |
# getBuild()
获取Build号。
示例
this.$app.getBuild().then(res => {
console.log(res);
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | String | Build号 |
# getAppversion()
获取版本号
示例
this.$app.getAppversion().then(res => {
console.log('app/getAppversion===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
versionName | String | app版本号 |
# getH5OffPkgsVersion()
获取本地离线包的版本号
示例
this.$app.getH5OffPkgsVersion().then(res => {
console.log('app/getH5OffPkgsVersion===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | Object | 返回信息 |
# getUUID()
获取UUID
示例
this.$app.getUUID().then(res => {
console.log('app/getUUID===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
uuid | String | 设备唯一标识别 |
# getVID()
获取VID
平台差异:适用于TMF
示例
this.$app.getVID().then(res => {
console.log('app/getVID===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
uuid | String | 设备唯一标识别 |
# getGUID()
获取GUID
平台差异:适用于TMF
示例
this.$app.getGUID().then(res => {
console.log('app/getGUID===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
uuid | String | 设备唯一标识别 |
# getLauncherPram()
获取app启动信息
示例
this.$app.getLauncherPram().then(res => {
console.log('app/getLauncherPram===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
launcher | String | 应用启动来源 |
arguments | Object | 传入的参数 |
# setClipboardData()
设置剪切板内容
示例
this.$app.setClipboardData(data).then(res => {
console.log('app/setClipboardData===', JSON.stringify(res));
})
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | String | 否 | 设置剪贴板得内容 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | String | '' |
# getClipboardData()
获取剪切板内容
示例
this.$app.getClipboardData().then(res => {
console.log('app/getClipboardData===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | String | 剪切板内容 |
# clearClipboardData()
移除剪切板内容
示例
this.$app.clearClipboardData().then(res => {
console.log('app/clearClipboardData===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | String | '' |
# openNativeSetting()
跳转到设置中心
示例
this.$app.openNativeSetting().then(res => {
console.log('app/openNativeSetting===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | Object | 调用结果信息{} |
# capture()
截屏
示例
this.$app.capture({ isLong: '0', path: '_downloads/test/test.png' }).then(res => {
console.log('app/capture===', JSON.stringify(res));
})
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | Object | 是 | 截屏参数 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
isLong | String | 可选 | 是否滚动截屏,"0":只截取webview当前可见区域(默认0),"1":滚动截屏,会把该webview底部和顶部滑动后可见的内容区域都截出来,拼成一个长图返回。只有ios支持滚动截屏。 |
path | String | 是 | 截图成功保存的文件路径(相对路劲),以暴露给前端的文件夹常量开头,以.png结尾,path必须在这些常量代表的文件夹之下: _www,_doc,_documents,_downloads |
top | Number | 可选 | 单位为px像素,截取区域距离当前可见区域顶部的距离,默认0 |
left | Number | 可选 | 单位为px像素,截取区域距离当前可见区域左侧边的距离,默认0 |
right | Number | 可选 | 单位为px像素,截取区域距离当前可见区域右侧边的高度,默认0 |
bottom | Number | 可选 | 单位为px像素,截取区域距离当前可见区域底部的距离,默认0 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | Object | 调用结果信息{} |
# setBadgeNumber()
设置应用桌面小红点数量,IOS手机需要开启应用允许通知
权限
示例
this.$app.setBadgeNumber({ number: '22', options: { title: '消息的标题', content: '消息的内容' } }).then(res => {
console.log('app/setBadgeNumber===', JSON.stringify(res));
})
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | Object | 是 | 角标数字设置参数 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
number | String | 是 | 角标数(任意非负数字符串,传入"0",表示移除角标 ) |
options | Object | 可选 | 小米手机显示角标需要在系统消息中心显示一条通知,此参数用于设置通知的标题(title)和内容(content) |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | Object | 回调结果 |
# getBadgeNumber()
获取应用桌面小红点数量
示例
this.$app.getBadgeNumber().then(res => {
console.log('app/getBadgeNumber===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
badge | String | 数量 |
# playSystemVoice()
震动
示例
this.$app.playSystemVoice({ duration: 1000 }).then(res => {
console.log('app/playSystemVoice===', JSON.stringify(res));
})
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | Object | 是 | 震动时长,系统原因,仅针对Android手机有效 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
duration | Number | 是 | 持续时间 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | Object | 回调结果 |
# setScreenBrightness()
设置屏幕亮度
示例
this.$app.setScreenBrightness(0.8).then(res => {
console.log('app/setScreenBrightness===', JSON.stringify(res));
})
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
value | Number | 否 | 设置屏幕亮度的值(0.0~1.0) |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | String | 无 |
# getScreenBrightness()
获取屏幕亮度
示例
this.$app.getScreenBrightness().then(res => {
console.log('app/getScreenBrightness===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
value | Number | 屏幕亮度的值(在0.0-1.0之间) |
# allowScreenShot()
允许系统截屏,仅支持Android
设备。
示例
this.$app.allowScreenShot().then(res => {
console.log('app/allowScreenShot===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | Object | 调用结果信息 |
# disableScreenShot()
禁止系统截屏,仅支持Android
设备。
示例
this.$app.disableScreenShot().then(res => {
console.log('app/disableScreenShot===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | Object | 调用结果信息 |
# getOrientation()
获取应用横竖屏状态
示例
this.$app.getOrientation().then(res => {
console.log('app/getOrientation===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
orientation | Number | 应用方向 0:未知; 1(头部向上),2(头部向下): 竖屏; 3(头部向右),4(头部向左): 横屏 |
# getSafeAreaInsets()
获取安全区域信息
示例
this.$app.getSafeAreaInsets().then(res => {
console.log('app/getSafeAreaInsets===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
right | Number | 右边距离 |
left | Number | 左边距离 |
top | Number | 顶部距离 |
bottom | Number | 底部距离 |
isBottomBarShow | Boolean | 底部软按键是否显示,仅android返回 |
# getWifiOpenStatus()
获取应用的wifi开启状态
示例
this.$app.getWifiOpenStatus().then(res => {
console.log('app/getWifiOpenStatus===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
wifiEnabled | Boolean | Wi-Fi开关是否打开 true:打开 |
# setKeepScreenOn()
设置是否保持常亮状态
示例
this.$app.setKeepScreenOn(true).then(res => {
console.log('app/setKeepScreenOn===', JSON.stringify(res));
})
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
keepScreenOn | Boolean | 是 | 设置屏幕常量的开关(true/false) |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | String | 无 |
# onUserCaptureScreen()
监听用户主动截屏事件
示例
CaptureScreenCB(res) { console.log('app/onUserCaptureScreen/offUserCaptureScreen===', JSON.stringify(res.payload)) },
this.$app.onUserCaptureScreen(this.CaptureScreenCB, 1)
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
CaptureScreenCB | Function | 是 | 请求完成回调函数,成功/失败都会触发 |
global | Number,Boolean | 可选 | 全局标识 0/true:为全局监听即所有webview都监听,1/false/默认:为当前webview监听 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object |
# offUserCaptureScreen()
移除截屏监听事件
示例
this.$app.offUserCaptureScreen(this.CaptureScreenCB);
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
CaptureScreenCB | Function | 是 | 请求完成回调函数,成功/失败都会触发 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object |
# scanCode()
二维码扫码
示例
this.$app.scanCode().then(res => {
console.log('app/scanCode===', JSON.stringify(res));
})
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
codeResult | String | 二维码扫描结果 |
# createQRCodeImage()
生成二维码
示例
this.$app.createQRCodeImage({
qrCodeImageInfo: {
content: '你好,宇信科技',
size: {
width: '200',
height: '200'
}
}
}).then(res => {
console.log('app/createQRCodeImage=====', res);
})
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | Object | 是 | 传入文字和生成图片大小 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
qrCodeImageInfo | Object | 是 | 传入信息 |
qrCodeImageInfo参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
content | String | 是 | 文字内容 |
size | Object | 是 | 图片宽高{"width":"200","height":"200"} |
success 返回参数说明:
参数名 | 类型 | 说明 | 备注 |
---|---|---|---|
qrCodeImagePath | String | 二维码图片相对路径地址 | 此文件为临时文件,APP会自动清理。若需要保存,请copy到您的永久目录 |
# showSoftKeybord()
显示系统键盘,IOS不支持
示例
this.$app.showSoftKeybord().then(res => {
console.log('app/showSoftKeybord====', JSON.stringify(res));
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object |
# hideSoftKeybord()
隐藏系统键盘
示例
this.$app.hideSoftKeybord().then(res => {
console.log('app/hideSoftKeybord====', JSON.stringify(res));
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object |
# sendWithSystem()
分享到微信
示例
this.$app
.sendWithSystem({
text: '分享测试',
url: 'https://www.baidu.com',
images: [],
type: 'text',
title: '',
provider: 'webchat',
sourceFileData: '',
sourceFileExtension: ''
})
.then(res => {
console.log('app/sendWithSystem====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | Object | 是 | 分享参数 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
provider | String | 是 | 分享平台webchat,目前仅支持微信 |
text | String | 必传 | 文本,所有分享类型都因该有此字段 |
images | Array | 必传 | 数组元素:图片url地址;分享图片时,音乐,视频,文件分享必传此参数,images取第一条值 |
url | String | 可选 | 网页url,音频视频url地址;网页,音频,视频,文件分享必传 |
title | String | 可选 | 网页分享时text和title至少传其一 |
type | YXShareContentType | 可选 | 分享类型 |
sourceFileData | String | 可选 | 文件分享,本地文件路径 |
sourceFileExtension | String | 可选 | 本地文件后缀(Android不支持) |
参数YXShareContentType分享类型枚举说明:
分享类型 | 枚举值 | 对应字段 |
---|---|---|
自动适配类型 | web | 0 |
文本 | text | 1 |
图片 | image | 2 |
网页 | href | 3 |
应用 | application | 4 |
音频 | music | 5 |
视屏 | video | 6 |
文件类型(暂时仅微信可用) | file | 7 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | string | 结果 |
# getshareservices()
获取分享服务
示例
this.$app.getshareservices({ sdkType: 'Mob' }).then(res => {
console.log('app/getshareservices====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | Object | 是 | 使用sdk平台(目前只支持Mob) |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
sdkType | String | 是 | "Mob",目前只支持Mob |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
channels | Array{Object} | app可分享到的平台渠道,Object={channel:'',name:''} |
# aes()
aes加解密
示例
this.$app
.aes({
// originData: 'uvLc/ut6JLCYsVj26Q3vWjL9bve07h8P0uqTkCJadoCG3onLWUWvqcCDUYWZNAjvrEgntO/Yk7aDpDr8sdpTI2xFzXqi9vM2u7VuGaTRa+E=',
originData: 'hbUo3ddl4GInOpNbKNzW7nRRz6r8ZWo7flHC3eoPGdQtLbnz1C5BZEpGA9aZX+3a7J0ErwKA1Mh9tPspP299CLWbihpCNVVl3YuLNiFG2EA5FuGc3N7ePr1GLtu9FZp+kznJljSIbgkdnOkU5LviFw==',
key: 'LxamMsdsX2Opsdsf',
encrypt: '0'
})
.then(res => {
console.log('app/aes====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | Object | 是 | 加解密参数 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
originData | String | 是 | 待加密的明文或待解密的密文 |
key | String | 是 | 加解密的原始密钥 |
encrypt | String | 是 | 指定加密或解密,"1"为加密 "0"为解密 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
resultData | String | 加解密的结果 |
# onKeyboardHeightChange()
监听系统键盘高度
示例
this.$app.onKeyboardHeightChange()
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object |
# offKeyboardHeightChange()
注销系统键盘高度的监听
示例
this.$app.offKeyboardHeightChange()
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object |
# showPwdkey()
显示安全键盘,使用“md5”,“aes”,“rsa”,“sm2”,“sm4”,"cfca"加密的密码键盘
示例
this.$app.showPwdkey().then(res => {
console.log('app/showPwdkey====', JSON.stringify(res));
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object |
# hidePwdkey()
隐藏密码键盘
示例
this.$app.hidePwdkey().then(res => {
console.log('app/hidePwdkey====', JSON.stringify(res));
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object |