wx.getLocation({success: res =>{console.log(res);},fail: e =>{console.log(e);// 判断用户是否拒绝了授权wx.getSetting({success: res =>{if(typeof(res.authSetting['scope.userLocation'])!='undefined'&&!res.authSetting['scope.userLocation']){// 用户拒绝了授权wx.showModal({title:'提示',content:'您拒绝了定位权限,将无法使用XX功能',success: res =>{if(res.confirm){// 跳转设置页面wx.openSetting({success: res =>{if(res.authSetting['scope.userLocation']){// 授权成功,重新定位wx.getLocation({success: res =>{}});}else{// 没有允许定位权限wx.showToast({title:'您拒绝了定位权限,将无法使用XX功能',icon:'none'});}}});}}});}}});}})