<!-- 一键报警 -->
<view id="callPolice" bindtap="makePhoneCall">
报警
</view>
/* 一键报警 */
#callPolice{
width:80rpx;
height: 80rpx;
background: #e07959;
position: fixed;
right: 0;
top: 50%;
text-align: center;
line-height: 80rpx;
}
//报警
makePhoneCall(e){
wx.showModal({
title: '警告',
content: '恶意报警需承担法律责任,您确实需要报警吗?',
success: function (sm) {
// console.log('sm...',sm); // {errMsg: "showModal:ok", cancel: true, confirm: false}
if (sm.confirm) {
wx.makePhoneCall({
phoneNumber: '12345678910', //hst大警长的电话号码!!!
success: function () {
console.log("报警喽!!!!")
},
fail: function () {
console.log("oops,打不了!")
}
})
}else if (sm.cancel) {
console.log("好吧,你取消了");
}
}
})
},