提交 5b345817 编写于 作者: 张磊

修改权限申请页面,改为申请日历权限

上级 92f66c56
......@@ -4,10 +4,10 @@
<!-- #endif -->
<page-head title="权限申请监听"></page-head>
<view class="permission-alert" id="permission-alert" :style="{'transform':isPermissionAlertShow ? 'translateY(0)':'translateY(-110px)'}">
<text style="font-size: 20px;margin-bottom: 10px;margin-top: 5px;">手机状态权限申请说明:</text>
<text style="color: darkgray;">uni-app x正在申请手机状态权限,允许或拒绝均不会获取任何隐私信息。</text>
<text style="font-size: 20px;margin-bottom: 10px;margin-top: 5px;">日历权限申请说明:</text>
<text style="color: darkgray;">uni-app x正在申请日历权限,允许或拒绝均不会获取任何隐私信息。</text>
</view>
<button type="primary" style="margin: 10px;" @click="requestPermission">点击申请权限</button>
<button type="primary" style="margin: 10px;" @click="requestPermission">点击申请日历权限</button>
<!-- #ifdef APP -->
</scroll-view>
......@@ -48,14 +48,14 @@
},
requestPermission() {
// #ifdef APP-ANDROID
if (UTSAndroid.checkSystemPermissionGranted(UTSAndroid.getUniActivity()!, ["android.permission.READ_PHONE_STATE"])) {
if (UTSAndroid.checkSystemPermissionGranted(UTSAndroid.getUniActivity()!, ["android.permission.READ_CALENDAR"])) {
uni.showToast({
title: "权限已经同意了,不需要再申请",
position: "bottom"
})
return
}
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, ["android.permission.READ_PHONE_STATE"], (_ : boolean, p : string[]) => {
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, ["android.permission.READ_CALENDAR"], (_ : boolean, p : string[]) => {
console.log(p)
}, (_ : boolean, p : string[]) => {
uni.showToast({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册