W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
解釋: 獲取用戶的當(dāng)前設(shè)置
Object object
屬性名 | 類型 | 必填 | 默認(rèn)值 | 說明 |
---|---|---|---|---|
success | Function | 否 | 接口調(diào)用成功的回調(diào)函數(shù) | |
fail | Function | 否 | 接口調(diào)用失敗的回調(diào)函數(shù) | |
complete | Function | 否 | 接口調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會執(zhí)行) |
參數(shù) | 類型 | 說明 |
---|---|---|
authSetting | Object | 用戶授權(quán)結(jié)果,其中 key 為 scope 值,value 為 Bool 值,表示用戶是否允許授權(quán)。 |
<view class="wrap">
<view class="card-area">
<view class="list-area border-bottom">
<view class="list-item-key-4">用戶信息</view>
<icon s-if="{{setting['scope.userInfo']}}" class="icon-small" type="success_no_circle" size="23"></icon>
</view>
<view class="list-area border-bottom">
<view class="list-item-key-4">地理位置</view>
<icon s-if="{{setting['scope.userLocation']}}" class="icon-small" type="success_no_circle" size="23"></icon>
</view>
<view class="list-area border-bottom">
<view class="list-item-key-4">通訊地址</view>
<icon s-if="{{setting['scope.address']}}" class="icon-small" type="success_no_circle" size="23"></icon>
</view>
<view class="list-area border-bottom">
<view class="list-item-key-4">發(fā)票抬頭</view>
<icon s-if="{{setting['scope.invoiceTitle']}}" class="icon-small" type="success_no_circle" size="23"></icon>
</view>
<view class="list-area border-bottom">
<view class="list-item-key-4">錄音功能</view>
<icon s-if="{{setting['scope.record']}}" class="icon-small" type="success_no_circle" size="23"></icon>
</view>
<view class="list-area border-bottom">
<view class="list-item-key-4">保存到相冊</view>
<icon s-if="{{setting['scope.writePhotosAlbum']}}" class="icon-small" type="success_no_circle" size="23"></icon>
</view>
<view class="list-area border-bottom">
<view class="list-item-key-4">攝像頭</view>
<icon s-if="{{setting['scope.camera']}}" class="icon-small" type="success_no_circle" size="23"></icon>
</view>
<view class="btn-area">
<button type="primary" bindtap="getSetting">獲取小程序設(shè)置</button>
<button bindtap="openSetting" type="default">打開設(shè)置頁面</button>
</view>
</view>
</view>
Page({
getSetting() {
swan.getSetting({
success: (res) => {
console.log('getSetting success', res);
this.setData({
setting: res.authSetting
});
}
});
},
openSetting() {
swan.openSetting({
success: res => {
console.log('openSetting success', res.authSetting);
},
fail: err => {
console.log('openSetting fail', err);
}
});
}
});
錯誤碼 | 說明 |
---|---|
201 | 解析失敗,請檢查調(diào)起協(xié)議是否合法 |
1001 | 執(zhí)行失敗 |
錯誤碼 | 說明 |
---|---|
202 | 解析失敗,請檢查參數(shù)是否正確 |
10001 | 內(nèi)部錯誤 |
10002 | 網(wǎng)絡(luò)請求失敗 |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: