get-app-authorize-setting.uvue 2.8 KB
Newer Older
1
<template>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
2 3 4 5 6 7
  <page-head :title="title"></page-head>
  <view class="uni-common-mt">
    <view class="uni-list">
      <view class="uni-list-cell">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">是否授权使用摄像头</view>
H
hdx 已提交
8
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
9
        <view class="uni-list-cell-db">
10
          <input type="text" :disabled="true" placeholder="未获取" :value="cameraAuthorized" />
H
hdx 已提交
11
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
12 13 14 15 16 17
      </view>
      <view class="uni-list-cell">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">是否授权使用定位</view>
        </view>
        <view class="uni-list-cell-db">
18
          <input type="text" :disabled="true" placeholder="未获取" :value="locationAuthorized" />
H
hdx 已提交
19
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
20 21 22 23
      </view>
      <view class="uni-list-cell">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">定位准确度</view>
H
hdx 已提交
24
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
25
        <view class="uni-list-cell-db">
26
          <input type="text" :disabled="true" placeholder="未获取" :value="locationAccuracy" />
H
hdx 已提交
27 28
        </view>
      </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
29 30 31
      <view class="uni-list-cell">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">是否授权使用麦克风</view>
H
hdx 已提交
32
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
33
        <view class="uni-list-cell-db">
34
          <input type="text" :disabled="true" placeholder="未获取" :value="microphoneAuthorized" />
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
35 36 37 38 39 40 41
        </view>
      </view>
      <view class="uni-list-cell">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">是否授权通知</view>
        </view>
        <view class="uni-list-cell-db">
42
          <input type="text" :disabled="true" placeholder="未获取" :value="notificationAuthorized" />
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
43 44 45 46 47 48
        </view>
      </view>
    </view>
    <view class="uni-padding-wrap">
      <view class="uni-btn-v">
        <button type="primary" @tap="getAppAuthorizeSetting">获取App授权设置</button>
H
hdx 已提交
49 50 51
      </view>
    </view>
  </view>
52
</template>
H
hdx 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
<script>
  export default {
    data() {
      return {
        title: 'getAppAuthorizeSetting',
        cameraAuthorized: "",
        locationAuthorized: "",
        locationAccuracy: "",
        microphoneAuthorized: "",
        notificationAuthorized: ""
      }
    },
    onUnload: function () {
    },
    methods: {
      getAppAuthorizeSetting: function () {
        const res = uni.getAppAuthorizeSetting();
        this.cameraAuthorized = res.cameraAuthorized;
        this.locationAuthorized = res.locationAuthorized;
        this.locationAccuracy = res.locationAccuracy ?? "unsupported";
        this.microphoneAuthorized = res.microphoneAuthorized;
        this.notificationAuthorized = res.notificationAuthorized;
      }
    }
  }
78 79 80
</script>

<style>
H
hdx 已提交
81 82 83 84
  .uni-pd {
    padding-left: 15px;
  }
</style>