lin
2024-04-03 363e50e6b3a97a97134887ccc1199883199f39a9
定位代码优化
1 files modified
20 ■■■■ changed files
pages/home/index.vue 20 ●●●● patch | view | raw | blame | history
pages/home/index.vue
@@ -1392,9 +1392,8 @@
                    wx.onLocationChange((data) => {
                        console.log('onLocationChange***************', data)
                        //微信开发工具上面只能触发一次,真机上面是循环获取
                        //设置一个公共时间,原因是时间间隔太短,自己设置时间,然后去操作相应的逻辑
                        if (this.time == 10) {
                        //设置一个公共时间,原因是时间间隔太短,自己设置时间,然后去操作相应的逻辑,速度大于0
                        if (this.time == 10 && data.speed >= 0) {
                            // 调取实时位置
                            this.reportLocation(this.location);
                            this.time = 0;
@@ -1416,13 +1415,14 @@
                updateUserInfo(param).then(res => {
                    console.log(res)
                })
                let params = {
                    userId: uni.getStorageSync("userInfo").user_id,
                    deptId: uni.getStorageSync("userInfo").dept_id,
                    longitude: location.longitude,
                    latitude: location.latitude,
                }
                addPolicTrajectoryPoint(params).then(res => {
                // let params = {
                //     userId: uni.getStorageSync("userInfo").user_id,
                //     deptId: uni.getStorageSync("userInfo").dept_id,
                //     longitude: location.longitude,
                //     latitude: location.latitude,
                // }
                location.userId = uni.getStorageSync("userInfo").user_id
                addPolicTrajectoryPoint(location).then(res => {
                    console.log(res)
                })
            },