var that = this
plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, (addressbook) => {
console.info('获取通信录对象成功')
// console.info(addressbook)
plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, (addressbook) => {
// 向通讯录中添加联系人
var contact = addressbook.create()
console.info(that.shuju.length)
for (let i = 0; i < that.shuju.length; i++) {
console.info(i)
contact.name = {
givenName: that.shuju[i].company
}
// for(let i1=0;i1<that.that.shuju[i].telphone;i1++){
contact.phoneNumbers = [{
type: '手机',
value: that.shuju[i].mobile[0],
preferred: true
}]
// }
contact.save((res4) => {
console.log()
uni.$showMsg('导入成功', 'success')
uni.$showMsg(res4)
this.$refs.popup2.hide()
this.duxuan = true
that.api.msg("导入成功", 1)
})
}
})
})
评论