调整定位权限丢失小程序无法运行问题-修改定位方法为模糊定位
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// pages/sportsGroundList/index.js
|
||||
const app = getApp();
|
||||
let latitude = 0; // 纬度
|
||||
let longitude = 0; // 经度
|
||||
let latitude = 31.2336800000; // 纬度
|
||||
let longitude = 121.4715700000; // 经度
|
||||
let page = 1;
|
||||
Page({
|
||||
|
||||
@@ -24,7 +24,7 @@ Page({
|
||||
this.setData({
|
||||
state: options.state
|
||||
})
|
||||
this.getData();
|
||||
this.getLocationDistance();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -106,6 +106,21 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
getLocationDistance(){
|
||||
let that = this;
|
||||
wx.getFuzzyLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
latitude = res.latitude;
|
||||
longitude = res.longitude;
|
||||
that.getData()
|
||||
},
|
||||
fail: function(res) {
|
||||
that.getData()
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
getData(e) {
|
||||
wx.showLoading({
|
||||
|
||||
Reference in New Issue
Block a user