51 lines
1.6 KiB
Markdown
51 lines
1.6 KiB
Markdown
|
第一步:引入js
|
|||
|
|
|||
|
import permision from "@/jsFile/permission/permission.js";
|
|||
|
|
|||
|
第二步:使用js里的方法
|
|||
|
|
|||
|
let permisionID = '';
|
|||
|
|
|||
|
ios系统:
|
|||
|
|
|||
|
permisionID:可取以下值
|
|||
|
location:位置权限
|
|||
|
camera:摄像头权限
|
|||
|
photoLibrary:相册权限
|
|||
|
record:麦克风权限
|
|||
|
push:推送权限
|
|||
|
contact:通讯录权限
|
|||
|
calendar:日历权限
|
|||
|
memo:备忘录权限
|
|||
|
|
|||
|
Android系统:
|
|||
|
|
|||
|
permisionID:可取以下值
|
|||
|
android.permission.ACCESS_FINE_LOCATION:位置权限
|
|||
|
android.permission.ACCESS_COARSE_LOCATION:模糊位置权限(蓝牙\ble依赖)
|
|||
|
android.permission.CAMERA:摄像头权限
|
|||
|
android.permission.READ_EXTERNAL_STORAGE:外部存储(含相册)读取权限
|
|||
|
android.permission.WRITE_EXTERNAL_STORAGE:外部存储(含相册)写入权限
|
|||
|
android.permission.RECORD_AUDIO:麦克风权限
|
|||
|
android.permission.READ_CONTACTS:通讯录读取权限
|
|||
|
android.permission.WRITE_CONTACTS:通讯录写入权限
|
|||
|
android.permission.READ_CALENDAR:日历读取权限
|
|||
|
android.permission.WRITE_CALENDAR:日历写入权限
|
|||
|
android.permission.READ_SMS:短信读取权限
|
|||
|
android.permission.SEND_SMS:短信发送权限
|
|||
|
android.permission.RECEIVE_SMS:接收新短信权限
|
|||
|
android.permission.READ_PHONE_STATE:获取手机识别码等信息的权限
|
|||
|
android.permission.CALL_PHONE:拨打电话权限
|
|||
|
android.permission.READ_CALL_LOG:获取通话记录权限
|
|||
|
|
|||
|
|
|||
|
let result = permision.judgeIosPermission(permisionID);
|
|||
|
if(!result) {
|
|||
|
//未开启权限,并前往应用设置
|
|||
|
permision.gotoAppPermissionSetting()
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|