zengh
2022-02-21 6705f7d8f96eb6283ebc7b01dae0f9d1ba0ac93f
反馈问题修复
4 files modified
148 ■■■■ changed files
public/grabOrdersMap/js/getPosition.js 72 ●●●● patch | view | raw | blame | history
public/grabOrdersMap/js/vueMain.js 70 ●●●●● patch | view | raw | blame | history
public/map/widgets/task/task.js 3 ●●●●● patch | view | raw | blame | history
src/views/activitys/policeTracking.vue 3 ●●●●● patch | view | raw | blame | history
public/grabOrdersMap/js/getPosition.js
@@ -50,7 +50,7 @@
        //开始持续获取定位
        let that = this;
        if (val != 1) {
            console.log("开始持续定位")
            // console.log(that.id,"开始持续定位")
            this.isContinued = true;
            that.once(function(res) {
                if (res.state == false) {
@@ -59,7 +59,7 @@
                }
            })
            if (this.isContinuedTimeOut) {
                console.log("重复开始持续定位")
                // console.log("重复开始持续定位")
                return;
            }
        }
@@ -77,11 +77,11 @@
                    }
                }
            })
        }, 5000)
        }, 3000)
    }
    overContinued() {
        console.log("结束持续定位")
        // console.log("结束持续定位")
        let that = this;
        if (this.isContinued) {
            this.isContinued = false;
@@ -94,22 +94,15 @@
                this.isContinuedTimeOut = null;
            }
        }
        this.isContinued = false;
        that.outData('out');
    }
    // overContinued() {
    //     console.log("结束持续定位")
    //     let that = this;
    //     if (this.isContinued) {
    //         this.isContinued = false;
    //         clearInterval(that.isContinuedTimeInt);
    //         this.isContinuedTimeInt = null;
    //     }
    // }
    once(fn) {
        console.log("开始获取一次定位");
        // console.log("开始获取一次定位");
        this.state = true;
        let ok = true;
        let that = this,
            fns = fn,
            fns = fn || '',
            outit = function() {
                if (fns) {
                    fns({
@@ -124,8 +117,8 @@
        outit();
        let success = function(position) {
            // console.log(position);
            var lat = position.coords.latitude;
            var lon = position.coords.longitude;
            var lat = position.coords.longitude;//经度
            var lon = position.coords.latitude;//纬度
            // console.log("成功返回经纬度信息");
            // console.log(lon, lat, "成功");
            that.onceNowPosition = [lat, lon];
@@ -152,7 +145,7 @@
            }
            that.onceNowPosition = msg;
            that.state = false;
            ok = true;
            ok = false;
            outit();
        };
        let options = {
@@ -166,53 +159,22 @@
            error,
            options
        );
        //高德定位
        // console.log("开始获取一次定位");
        // this.state = true;
        // let that = this;
        // that.outData();
        // AMap.plugin("AMap.Geolocation", function() {
        //     var geolocation = new AMap.Geolocation({
        //         // 是否使用高精度定位,默认:true
        //         enableHighAccuracy: true,
        //         // 设置定位超时时间,默认:无穷大
        //         // timeout: 10000,
        //     });
        //     geolocation.getCurrentPosition();
        //     AMap.event.addListener(geolocation, "complete", onComplete);
        //     AMap.event.addListener(geolocation, "error", onError);
        //     function onComplete(data) {
        //         // data是具体的定位信息
        //         // console.log(data);
        //         var lat = data.position.lat;
        //         var lon = data.position.lng;
        //         // console.log("成功返回经纬度信息");
        //         // console.log(lon, lat, "成功");
        //         that.onceNowPosition = [lon, lat];
        //         this.state = false;
        //         that.outData();
        //     }
        //     function onError(data) {
        //         // 定位出错
        //         // console.log(data);
        //         that.onceNowPosition = data;
        //         this.state = false;
        //         that.outData();
        //     }
        // });
    }
    //结束获取
    outInit() {
    }
    //抛出数据
    outData() {
    outData(val) {
        let d = {
            state: this.state,
            intlat: this.onceNowPosition
        }
        if (val) {
            d[val] = val
        }
        this.fn(d)
    }
}
// export default $getPositions;
public/grabOrdersMap/js/vueMain.js
@@ -40,17 +40,7 @@
    },
    methods: {
        setUniAppMsg(data) {
            // console.log(data)
            // console.log(uni)
            uni.postMessage({
                data: {
                    action: 'message'
                }
            });
            uni.getEnv(function(res) {
                console.log('当前环境:' + JSON.stringify(res));
            });
            window.parent.hBackMsg(data)
        },
        openAPP(type) {
            // console.log(type)
@@ -59,13 +49,25 @@
                if (that.data.butCT == "beginUp") {
                    // 反馈
                    uni.navigateTo({
                        url: '/pages/grabOrders/feedback?data=' + JSON.stringify(this.data)
                        url: '/pages/grabOrders/feedback?data=' + JSON.stringify(this.data) +
                            '&other="11111"'
                    });
                } else if (that.data.butCT == "begin") {
                    // 开始任务
                    this.setUniAppMsg({
                        type: "begin",
                        data: that.data
                    that.setUniAppMsg({
                        type: "start",
                        data: {
                            id: that.data.id,
                            serid: that.data.serid
                        },
                        fn: function(val) {
                            if (val == "success") {
                                // console.log("成功开启任务")
                                that.data.butCT = "beginUp";
                                that.data.rtype = '0';
                                that.data.type = "0";
                            }
                        }
                    })
                }
            } else {
@@ -135,10 +137,10 @@
            }
            //url解码
            this.data = this.getQueryVariable('data') || data;
            if (this.data.team) {
            console.log(this.data)
            if (typeof this.data.team === "string") {
                this.data.team = this.data.team.split(',');
            }
            console.log(this.data)
            let lines = this.data.line
            let position = lines.slice(lines.indexOf("(") + 1, lines.indexOf(",")).split(" ");
            // console.log(position)
@@ -352,21 +354,30 @@
                this.oncePosition = new $getPositions({
                    id: 1,
                    fn: function(res) {
                        console.log(res);
                        // console.log(res);
                        that.mapPositionLoding = res.state;
                        if (!res.state) {
                            that.addIcon(res.intlat);
                            console.log(res)
                            if (typeof res.intlat === "string") {
                                window.parent.showTip("获取定位失败")
                            } else {
                                that.addIcon([res.intlat[1], res.intlat[0]]);
                            }
                        }
                    }
                }).init();
            }
            if (!this.onPosition) {
                this.oncePosition.continuedTime();
                this.onPosition = !this.onPosition;
                this.oncePosition.once();
            } else {
                this.oncePosition.overContinued();
                this.onPosition = !this.onPosition;
                this.oncePosition.once();
            }
            // if (!this.onPosition) {
            //     this.oncePosition.continuedTime();
            //     this.onPosition = !this.onPosition;
            // } else {
            //     this.oncePosition.overContinued();
            //     this.onPosition = !this.onPosition;
            // }
        },
        //添加图标
        addIcon(intlat) {
@@ -652,6 +663,15 @@
            },
        });
        this.domMove.init();
        // console.log(window.parent.setIntLat)
        window.parent.setIntLat({
            rid: this.data.id,
            fn: (out) => {
                // console.log(out,"1111");
                // that.addIcon(out);
                that.addIcon([out[1], out[0]]);
            }
        })
    },
    wacth: {}
})
public/map/widgets/task/task.js
@@ -200,6 +200,9 @@
        url: "/api/trar/selectLists?rid=" + ces.rwid + "&uid=" + ces.id,
        type: 'get',
        success: function (res) {
          if (res == "" || res == null){
            return;
          }
          var baid = res;
          var entityData = '';
          var entityArr = [];
src/views/activitys/policeTracking.vue
@@ -473,6 +473,9 @@
      getList() {
        var that = this;
        if (this.form.serid == "" || this.form.serid == null){
          return;
        }
        axios({
          method: "get",
          url: "/api/taskqd/queryReceiver",