|
|
- //var islogout = wx.getStorageSync('islogout');
- // 查看用户已授权的权限
- wx.getSetting({
- success(res) {
- //console.log(res)
- //检查是否授权获取用户信息
- if (res.authSetting['scope.userLocation']) {
- //已经授权,可以直接调用 getLocation 获取用户位置
- wx.getLocation({
- type: 'gcj02',
- success: function(res) {
- //console.log(res)
- //将定位经纬度存入本地缓存
- wx.setStorageSync('lat', res.latitude);
- wx.setStorageSync('lng', res.longitude);
- }
- })
- }
- }
- })
复制代码
|
|