//打电话 还是 添加到联系人 或者复制联系方式
viewClick01: function (e) {
var phonenum = e.currentTarget.dataset.phonenum;
//显示“呼叫”、“添加联系人”弹窗
wx.showActionSheet({
itemList: ['呼叫', '添加联系人','复制联系方式'],
success: function (res) {
console.log("点击电话 res:", res)
if (res.tapIndex == 0) {//直接呼叫
wx.makePhoneCall({
phoneNumber: phonenum,
success: function (res_makephone) {
console.log("呼叫电话返回:", res_makephone)
}
})
} else if (res.tapIndex == 1) {//添加联系人
wx.addPhoneContact({
firstName: '',
mobilePhoneNumber: phonenum,
success: function (res_addphone) {
console.log("电话添加联系人返回:", res_addphone)
}
})
} else if (res.tapIndex == 2){
wx.setClipboardData({
data: phonenum,
success(res) {
wx.getClipboardData({
success(resx) {
wx.showToast({
title: '复制成功',
icon:'none'
})
console.log(resx)
}
})
}
})
}
}
})
},
wxml
<van-icon name="phone-o" class="flex_align_c" color="#9FC1F3" size="30px" bind:click="viewClick01" data-phonenum="{{emplist.phone}}" />