- 微信小程序wx.getLocation之前好好的,突然今天就都失败了?
onLoad: function(options) { console.log(options) this.setData({ realName: options.realName, carrierName: options.carrierName, toCompany: options.toCompany, id: options.id, companyCode: options.companyCode, alreadySign: options.driverCheckIn == 'Y' ? true : false, }) let that = this wx.getSetting({ success(res0) { console.log('查看是否吊起过授权', res0) // 查看是否吊起过授权 if (!Object.keys(res0.authSetting).includes('scope.userLocation')) { that.getAddress() return } // 已经吊起过授权并且拒绝授权 if (!res0.authSetting['scope.userLocation']) { wx.showModal({ title: '您未开启地理位置授权', content: '为了给您提供更好的服务,请您授权地理位置,谢谢', success: res2 => { if (res2.confirm) { wx.openSetting({ success(res3) { console.log('吊起过授权---并且拒绝--重新设置授权',res3) // 成功授权地理位置 if (res3.authSetting['scope.userLocation']) { that.getAddress() } else { // 未授权地理位置,默认显示 console.log('重新授权---未允许,默认显示') that.getAddress() } } }) } else { console.log('拒绝授权地理位置,默认显示') that.getAddress() } } }) } else { that.getAddress() } } }) }, rad(d) { return d * Math.PI / 180.00 }, getAddress(){ let that = this; wx.getLocation({ type: 'wgs84', success(res) { let x = that.rad(res.longitude) let y = that.rad(res.latitude) that.setData({ longitude: res.longitude, latitude: res.latitude }) // 苏宝化坐标 let x1 = that.rad(120.474476) let y1 = that.rad(31.410634) let w = x - x1 let h = y - y1 let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(w / 2), 2) + Math.cos(x) * Math .cos(x1) * Math.pow(Math.sin(h / 2), 2))) s = s * 6378137.0 s = Math.round(s * 10000) / 10000 console.log(s) if (s > 5000) { that.setData({ canSign: false, signAddressRange: s, }) }else{ that.setData({ canSign: true, signAddressRange: s, }) } that.driverCheckInDataHandler(); }, fail(res) { that.setData({ canSign: false, signAddressRange: 'ssss', }) console.log(res) wx.showModal({ title: '提示', content: '获取定位失败', showCancel: false }) }, complete(res) {} }) }, 今天开始,进来页面wx.getLocation都会走到fail中
09-10 - 手机基础库版本2.30.2,真机调试时bindinput事件不响应?
手机微信版本:8.0.32 手机基础库版本:2.30.2 小程序真机调试的时候,bindinput事件不响应怎么办
2023-02-28 - 小程序能否能否点击按钮直接跳出小程序跳转到公众号的某个文章内?
小程序能否能否点击按钮直接跳出小程序,跳转到公众号的某个文章内?
2020-11-26 - web-view内嵌的h5页面内能否写个分享触发小程序原生的分享功能?
我想问下,web-view内嵌的h5页面内能否写个分享按钮,点击之后触发小程序原生的分享功能
2020-11-17