get_my_point: function () { wx.getLocation({ type: 'gcj02', success: function (res) { console.log(res); wx.setStorageSync('my_point', res); //var latitude = res.latitude //var longitude = res.longitude //var speed = res.speed //var accuracy = res.accuracy } }) }, get_quanxian:function() { var that=this; wx.getSetting({ success: (res) => { // res.authSetting['scope.userLocation'] == undefined 表示 初始化进入该页面 // res.authSetting['scope.userLocation'] == false 表示 非初始化进入该页面,且未授权 // res.authSetting['scope.userLocation'] == true 表示 地理位置授权 //console.log("oooo" + res.authSetting['scope.userLocation']); if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) { //未授权 wx.showModal({ title: '请求授权当前位置', content: '需要获取您的地理位置,请确认授权', success: function (res) { if (res.cancel) { //取消授权 wx.showToast({ title: '拒绝授权', icon: 'none', duration: 1000 }) } else if (res.confirm) { //确定授权,通过wx.openSetting发起授权请求 wx.openSetting({ success: function (res) { if (res.authSetting["scope.userLocation"] == true) { wx.showToast({ title: '授权成功', icon: 'success', duration: 1000 }) //再次授权,调用wx.getLocation的API that.get_my_point(); } else { wx.showToast({ title: '授权失败', icon: 'none', duration: 1000 }) } } }) } } }) } else { console.log("111"); that.get_my_point(); } } }) }
开发者工具获取位置错误获取的位置一直是北京,但是我不在北京,而且昨天还能正常获取
2019-04-11。。。
关于腾讯地图api的输入提示回填input会将变量赋值undefined[图片][图片] [图片]
2019-04-10