zhangrl
zhangrl
  • 发布:2021-01-18 14:20
  • 更新:2021-01-18 14:20
  • 阅读:1364

【报Bug】h5 uni.getlocation 获取当前位置异常

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 10

HBuilderX类型: 正式

HBuilderX版本号: 3.0.5

浏览器平台: Chrome

浏览器版本: 87.0.4280.141(正式版本) (64 位)

项目创建方式: HBuilderX

App下载地址或H5⽹址: http://p.yiyiny.com/p2/

示例代码:
uni.getLocation({    
            // #ifdef APP-PLUS    
            type: 'gcj02',    
            geocode: true,    
            // #endif    
            success: function(r) {    
                uni.showModal({    
                    title: 'success提示',    
                    content: JSON.stringify(r),    
                    success: function (res) {    
                        if (res.confirm) {    
                            console.log('用户点击确定');    
                        } else if (res.cancel) {    
                            console.log('用户点击取消');    
                        }    
                    }    
                })    
                self._locationRefresh = false    
                ab_.debug && console.log('获取定位成功')    
                console.log(r)    
                // 定位缓存    
                self._location = r    
                res = r    

                if (!self._locationing) {    
                    // 10分钟刷新一次    
                    self._locationing = setInterval(function() {    
                        self.locationRefresh()    
                    }, 600000)    
                }    
            },    
            fail: function(e) {    
                uni.showModal({    
                    title: 'fail提示',    
                    content: JSON.stringify(e),    
                    success: function (res) {    
                        if (res.confirm) {    
                            console.log('用户点击确定');    
                        } else if (res.cancel) {    
                            console.log('用户点击取消');    
                        }    
                    }    
                })    
                ab_.debug && console.log('获取定位失败')    
                err = e    
            },    
            complete: complete,    
        })  

操作步骤:

1、运行项目到浏览器,默认获得当前位置

预期结果:

获取当前位置

实际结果:

返回数据异常

bug描述:

h5 运行代码到谷歌浏览器 uni.getlocation 获取当前位置异常,

1、刚开始定位是没有返回经纬度,在是success返回了{“errMsg”:"getLocation:ok","verticalAccuracy":0,"horizontalAccuracy":30},如图1

2、今天返回经纬度了,然后给了一个别的区的经纬度,根本不是当前位置,如图2

3、另在http和https下返回不一致

2021-01-18 14:20 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复