wen59024
wen59024
  • 发布:2020-05-14 23:57
  • 更新:2020-05-15 11:14
  • 阅读:578

【报Bug】H5 API 关于操作通讯录的无法获取到通讯录的photos信息

分类:HTML5+

产品分类: HTML5+

HBuilderX版本号: 2.7.2

手机系统: Android

手机系统版本号: Android 9.0

手机厂商: 华为

手机机型: 荣耀9

打包方式: 云端

示例代码:

<template>
<view>
<button type="primary" @tap="getContacts">获取联系人</button>
<h2>查询到:{{list.length}}</h2>
<scroll-view v-for="item in list" :key="item.id" scroll-x="true">
<view @tap="clickme">
{{item.displayName}}{{item.phoneNumbers[0].value}}{{item.photos[0].value}}
</view>
</scroll-view>
</view>
</template>

<script>
// #ifdef APP-PLUS
var Contacts
export default {
data() {
return {
list: []
}
},
onShow() {
uni.setNavigationBarTitle({
title: '通讯录'
});
},
methods: {
getContacts() {
console.log("直线防范...........")
var that = this
// 获取通讯录对象
plus.contacts.getAddressBook( plus.contacts.ADDRESSBOOK_PHONE, function( addressbook ) {
uni.showToast({
title: '获取通讯录对象成功',
duration: 2000
})
// console.log('获取通讯录对象成功---------------------')
// console.log(addressbook)
// var contact = addressbook.create();
// contact.name = {displayName:"王安"};
// contact.phoneNumbers = [{type:"手机",value:"88888888",preferred:true}];
// contact.photos =[{"type":"头像",value="static/logo.png",preferred:true}]
// contact.save();
// console.log('添加通讯录对象成功---------------------')

                // 查找联系人    
                addressbook.find(["displayName","phoneNumbers"],function(contacts){    
                    uni.showToast({    
                        title: '获取联系人成功',    
                        duration: 2000    
                    })    
                    console.log('获取联系人成功')    

                    console.log(JSON.stringify(contacts))    
                    that.list = contacts    
                }, function () {    
                    uni.showToast({    
                        title: '获取联系人失败',    
                        duration: 2000    
                    })    
                },{multiple:true});    
            }, function ( e ) {    
                uni.showToast({    
                    title: '获取通讯录对象失败:' + e.message,    
                    duration: 2000    
                })    
            });    
        },  
          clickme:function(){  
              uni.showModal({  
                title: '提示',    
                content: '是否退出uni-app?',    
              })  
          }  
    }    
}    
// #endif  

</script>

<style>

</style>

操作步骤:

必现

预期结果:

返回结果中photos应该有值

实际结果:

{"id":1,"rawId":null,"target":0,"displayName":"张艳","name":null,"nickname":null,"phoneNumbers":[{"id":"2","pref":false,"value":"183 xxxx1378","type":"mobile"}],"emails":null,"addresses":null,"ims":null,"organizations":null,"birthday":null,"note":null,"photos":null,"categories":null,"urls":null}

bug描述:

操作步骤:
plus.contacts.getAddressBook( plus.contacts.ADDRESSBOOK_PHONE, function( addressbook ) 获取通讯录信息
预期结果:
返回结果中photos应该有值
实际结果:
{"id":1,"rawId":null,"target":0,"displayName":"张艳","name":null,"nickname":null,"phoneNumbers":[{"id":"2","pref":false,"value":"183 xxxx1378","type":"mobile"}],"emails":null,"addresses":null,"ims":null,"organizations":null,"birthday":null,"note":null,"photos":null,"categories":null,"urls":null}
出现频率:
必现
环境:
win10、Hbuilder2.0.16、华为荣耀9模拟调试

2020-05-14 23:57 负责人:无 分享
已邀请:
wen59024

wen59024 (作者)

没人关注呀 这社区感觉人很少啊

该问题目前已经被锁定, 无法添加新回复