天天看点

智能名片小程序名片详情页功能实现关键代码

智能名片小程序

名片详情页功能实现关键代码

一键复制信息功能

复制到剪贴板

wx.getClipboardData({
  success (res){
    console.log(res.data)
  }
})      

一键拨号功能

拨打电话

wx.makePhoneCall({
  phoneNumber: '1340000' //仅为示例,并非真实的电话号码
})      

定位导航功能

使用微信内置地图查看位置

wx.getLocation({
 type: 'gcj02', //返回可以用于wx.openLocation的经纬度
 success (res) {
   const latitude = res.latitude
   const longitude = res.longitude
   wx.openLocation({
     latitude,
     longitude,
     scale: 18
   })
 }
})      

存入手机通讯录功能

添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。

wx.addPhoneContact({
        firstName: ifirstName,
        mobilePhoneNumber: mobilePhoneNumber,
        weChatNumber: weChatNumber,
        organization: organization,
        title: title,
        addressStreet: addressStreet,
        email: email
      });      

转发分享功能

onShareAppMessage: function () {
    // return custom share data when user share.
  },