<image @tap.stop="call(item.shop.mobile)" style="width: 80rpx;height: 80rpx;"
src="../../static/call.png" mode=""></image>
// 拨打电话
call(phone) {
console.log('传入的电话', phone);
const res = uni.getSystemInfoSync();
// ios系统默认有个模态框
if (res.platform == 'ios') {
uni.makePhoneCall({
phoneNumber: phone,
success() {
console.log('拨打成功了');
},
fail() {
console.log('拨打失败了');
}
})
} else {
//安卓手机手动设置一个showActionSheet
uni.showActionSheet({
itemList: [phone, '呼叫'],
success: function(res) {
console.log(res);
if (res.tapIndex == 1) {
uni.makePhoneCall({
phoneNumber: phone,
})
}
}
})
}
},