ok.sysAuthorize(authKey)

基础库1.4.1开始支持

请求系统授权。

参数

参数名 类型 默认值 必填 说明
authKey string 权限类型

authKey 的合法值

属性 类型 说明
record string 录音功能
camera string 摄像头
writeAlbum string 保存到相册
location string 地理位置
calendar string 系统日历

接口返回值 Object res 的属性

属性名 类型 说明
code number 响应状态码
data object 成功响应结果
  result string 授权结果
msg string 响应信息

result 的合法值

属性 类型 说明
0 string 暂无使用权限
1 string 有使用权限
2 string 去设置

示例代码

ok.sysAuthorize('record').then(res=>{
console.log('设置授权结果', res.data.result);
// 0 暂无使用权限(用户点击了取消或者拒绝)
// 1 有使用权限(用户首次点击允许)
// 2 设置权限中(用户已手动跳转设置页开启权限,权限开启状态未知)
}).catch(err =>{
console.log("接口调用异常",err);
});;
  1. 1. ok.sysAuthorize(authKey)
    1. 1.1. 参数
      1. 1.1.1. authKey 的合法值
    2. 1.2. 接口返回值 Object res 的属性
      1. 1.2.1. result 的合法值
    3. 1.3. 示例代码