get-app-authorize-setting.uvue 3.1 KB
Newer Older
1
<template>
H
hdx 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
  <view>
    <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>
          </view>
          <view class="uni-list-cell-db">
            <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="cameraAuthorized" />
          </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">
            <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="locationAuthorized" />
          </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">
            <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="locationAccuracy" />
          </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">
            <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="microphoneAuthorized" />
          </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">
            <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="notificationAuthorized" />
          </view>
        </view>
      </view>
      <view class="uni-padding-wrap">
        <view class="uni-btn-v">
          <button type="primary" @tap="getAppAuthorizeSetting">获取App授权设置</button>
        </view>
      </view>
    </view>
  </view>
54
</template>
H
hdx 已提交
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
<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;
      }
    }
  }
80 81 82
</script>

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