调整定位权限丢失小程序无法运行问题-修改定位方法为模糊定位
This commit is contained in:
@@ -275,6 +275,7 @@ Page({
|
||||
this.setData({
|
||||
isShowAuth: false
|
||||
})
|
||||
this.onCancel()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -311,7 +312,7 @@ Page({
|
||||
includePoints: list,
|
||||
})
|
||||
let that = this;
|
||||
wx.getLocation({
|
||||
wx.getFuzzyLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
that.setData({
|
||||
@@ -325,6 +326,7 @@ Page({
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
console.log(res)
|
||||
that.setData({
|
||||
latitude: 31.2336800000,
|
||||
longitude: 121.4715700000,
|
||||
@@ -334,11 +336,6 @@ Page({
|
||||
longitude: that.data.longitude,
|
||||
zoom: 1
|
||||
});
|
||||
if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') {
|
||||
// that.setData({
|
||||
// isShowAuth: true
|
||||
// })
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
@@ -491,7 +488,7 @@ Page({
|
||||
// 由原来的回到开始改为定位
|
||||
goFrist() {
|
||||
let that = this;
|
||||
wx.getLocation({
|
||||
wx.getFuzzyLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
that.setData({
|
||||
@@ -504,17 +501,17 @@ Page({
|
||||
zoom: 1
|
||||
});
|
||||
let list = [{
|
||||
longitude: this.data.longitude,
|
||||
latitude: this.data.latitude
|
||||
longitude: that.data.longitude,
|
||||
latitude: that.data.latitude
|
||||
}];
|
||||
// this.data.includePoints
|
||||
this.setData({
|
||||
that.setData({
|
||||
includePoints: list
|
||||
})
|
||||
},
|
||||
fail: function(res) {
|
||||
console.log(res.errMsg)
|
||||
if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') {
|
||||
if (res.errMsg == 'getFuzzyLocation:fail auth deny' || res.errMsg == 'getFuzzyLocation:fail:auth denied' || res.errMsg == 'getFuzzyLocation:fail no permission') {
|
||||
that.setData({
|
||||
isShowAuth: true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user