get-app-authorize-setting.uvue 5.2 KB
Newer Older
1
<template>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
2 3
  <page-head :title="title"></page-head>
  <view class="uni-common-mt">
DCloud-WZF's avatar
DCloud-WZF 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    <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 type="text" :disabled="true" placeholder="未获取" :value="albumAuthorized" />
        </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 type="text" :disabled="true" placeholder="未获取" :value="bluetoothAuthorized" />
        </view>
      </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
21 22 23
      <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="cameraAuthorized" />
H
hdx 已提交
27
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
28 29 30 31 32 33
      </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">
34
          <input type="text" :disabled="true" placeholder="未获取" :value="locationAuthorized" />
H
hdx 已提交
35
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
36 37 38 39
      </view>
      <view class="uni-list-cell">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">定位准确度</view>
H
hdx 已提交
40
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
41
        <view class="uni-list-cell-db">
42
          <input type="text" :disabled="true" placeholder="未获取" :value="locationAccuracy" />
H
hdx 已提交
43 44
        </view>
      </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
45 46 47
      <view class="uni-list-cell">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">是否授权使用麦克风</view>
H
hdx 已提交
48
        </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
49
        <view class="uni-list-cell-db">
50
          <input type="text" :disabled="true" placeholder="未获取" :value="microphoneAuthorized" />
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
51
        </view>
DCloud-WZF's avatar
DCloud-WZF 已提交
52
      </view>
53

DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
54 55 56 57 58
      <view class="uni-list-cell">
        <view class="uni-pd">
          <view class="uni-label" style="width:180px;">是否授权通知</view>
        </view>
        <view class="uni-list-cell-db">
59
          <input type="text" :disabled="true" placeholder="未获取" :value="notificationAuthorized" />
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
60
        </view>
DCloud-WZF's avatar
DCloud-WZF 已提交
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
      </view>
      <!-- #ifdef APP-IOS -->
      <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 type="text" :disabled="true" placeholder="未获取" :value="notificationAlertAuthorized" />
        </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 type="text" :disabled="true" placeholder="未获取" :value="notificationBadgeAuthorized" />
        </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 type="text" :disabled="true" placeholder="未获取" :value="notificationSoundAuthorized" />
        </view>
      </view>
      <!-- #endif -->
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
89 90 91 92
    </view>
    <view class="uni-padding-wrap">
      <view class="uni-btn-v">
        <button type="primary" @tap="getAppAuthorizeSetting">获取App授权设置</button>
H
hdx 已提交
93 94 95
      </view>
    </view>
  </view>
96
</template>
H
hdx 已提交
97 98 99 100 101
<script>
  export default {
    data() {
      return {
        title: 'getAppAuthorizeSetting',
DCloud-WZF's avatar
DCloud-WZF 已提交
102
        cameraAuthorized: "",
103
        albumAuthorized: "",
H
hdx 已提交
104 105
        locationAuthorized: "",
        locationAccuracy: "",
DCloud-WZF's avatar
DCloud-WZF 已提交
106
        microphoneAuthorized: "",
107
        bluetoothAuthorized: "",
DCloud-WZF's avatar
DCloud-WZF 已提交
108 109 110
        notificationAuthorized: "",
        notificationAlertAuthorized: "",
        notificationBadgeAuthorized: "",
111
        notificationSoundAuthorized: ""
H
hdx 已提交
112 113 114 115 116 117
      }
    },
    onUnload: function () {
    },
    methods: {
      getAppAuthorizeSetting: function () {
DCloud-WZF's avatar
DCloud-WZF 已提交
118 119
        const res = uni.getAppAuthorizeSetting();
        this.albumAuthorized = res.albumAuthorized;
120
        this.bluetoothAuthorized = res.bluetoothAuthorized;
H
hdx 已提交
121 122 123 124
        this.cameraAuthorized = res.cameraAuthorized;
        this.locationAuthorized = res.locationAuthorized;
        this.locationAccuracy = res.locationAccuracy ?? "unsupported";
        this.microphoneAuthorized = res.microphoneAuthorized;
DCloud-WZF's avatar
DCloud-WZF 已提交
125 126 127 128 129 130
        this.notificationAuthorized = res.notificationAuthorized;
        // #ifdef APP-IOS
        this.notificationAlertAuthorized = res.notificationAlertAuthorized;
        this.notificationBadgeAuthorized = res.notificationBadgeAuthorized;
        this.notificationSoundAuthorized = res.notificationSoundAuthorized;
        // #endif
131

H
hdx 已提交
132 133 134
      }
    }
  }
135 136 137
</script>

<style>
H
hdx 已提交
138 139 140 141
  .uni-pd {
    padding-left: 15px;
  }
</style>