调整定位权限丢失小程序无法运行问题

This commit is contained in:
2023-04-22 16:03:14 +08:00
parent ddd62ca041
commit 4aec6bf9ee
5 changed files with 59 additions and 63 deletions

View File

@@ -24,7 +24,7 @@ Page({
this.setData({
state: options.state
})
this.getLocation();
this.getData();
},
/**
@@ -144,35 +144,6 @@ Page({
isShowNewplot: true
})
})
},
}
// 活动当前坐标
getLocation() {
let that = this;
wx.getLocation({
type: 'gcj02',
success: function(res) {
latitude = res.latitude;
longitude = res.longitude;
that.getData()
},
fail: function(res) {
if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') {
that.setData({
isShowAuth: true
})
}
},
})
},
// 获取授权
setAuthSuccess(e) {
if (e.detail.authSetting['scope.userLocation']) {
this.getLocation();
this.setData({
isShowAuth: false
})
}
},
})
})