交流专区
服务市场
微信学堂
文档
小程序
  • 常用主页

    小程序

    小游戏

    企业微信

    微信支付

  • 服务市场
    微信学堂
    文档
登录
切换主页

暂无个人介绍

关注私信

正在关注

0

关注者

0

获得过 0 次赞
回答过的问题获得 0 次赞
分享过的文章/案例获得 0 次赞
评论与回复获得 0 次赞
文章 回答 1提问 收藏 关注问题
  • wx.getLocation()是获取用户地址信息,没授权就会弹出授权框; wx.getSetting()是获取用户授权状态; wx.openSetting()是跳转至授权页面。 你自己先搞清楚微信API的含义

    有没大佬帮忙看下代码

    sign: function () { var that = this const la1 = 31.991362 const lo1 = 118.737908 wx.getLocation({ type: 'gcj02', success: function (res) { const la2 = res.latitude const lo2 = res.longitude var La1 = la1 * Math.PI / 180.0; var La2 = la2 * Math.PI / 180.0; var La3 = La1 - La2; var Lb3 = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0; var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2) + Math.cos(La1) * Math.cos(La2) * Math.pow(Math.sin(Lb3 / 2), 2))); s = s * 6378.137;//地球半径 s = Math.round(s * 10000) / 10000; if (s > 0.2) { wx.showToast({ title: '距离不够' + s, icon: 'none' }) console.log("距离不够" + s) } else { wx.showToast({ title: '签到成功', icon: 'success' }) console.log("sssssssss===" + s) } } }) //判断是否获得了用户地理位置授权 wx.getSetting({ success: function(res){ if (!res.authSetting['scope.userLocation']){ wx.openSetting({ success: function (res) { if (res.authSetting["scope.userLocation"]) { wx.showToast({ title: '授权成功', icon: 'success', duration: 1000 }) } } }) } } }) }

    2018-09-27
关闭

选择需要上架的开放服务

  • 模板开发

    针对行业、场景的小程序代开发服务,帮助企业快速搭建小程序

    上架
  • 插件

    提供可被小程序直接使用、丰富小程序能力的功能模块

    上架
  • 小商店服务

    为小商店商家提供更多的能力,帮助商家经营好小商店

    上架
关闭

案例类型

  • 小程序
  • 插件
  • 关于腾讯
  • 运营规范
  • 文档中心
  • 辟谣中心
  • 客服中心
  • Copyright © 2012-2025 Tencent. All Rights Reserved.