1、判断用户是否授权定位
checkLocationAuth() {
let that = this
wx.getSetting({
success: (res) => {
let authSetting = res.authSetting
if (authSetting['scope.userLocation']) {
that.getCurrentLocation()
} else if (authSetting['scope.userLocation'] === false) {
wx.showModal({
title: '您未开启地理位置授权',
content: '请在系统设置中打开位置授权,以便我们为您提供更好的服务',
success: (res) => {
if (res.confirm) {
wx.openSetting()
}
}
})
} else {
wx.authorize({
scope: 'scope.userLocation',
success: () => {
that.getCurrentLocation()
},
fail: () => {
wx.showModal({
title: '您未开启地理位置授权',
content: '请在系统设置中打开位置授权,以便我们为您提供更好的服务',
success: (res) => {