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

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

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