zengh
2022-02-22 fa6eb4e94b2496773a281b0fac5582871e7d7b7a
反馈问题修复
2 files modified
268 ■■■■ changed files
public/grabOrdersMap/js/getPosition.js 145 ●●●● patch | view | raw | blame | history
public/grabOrdersMap/js/vueMain.js 123 ●●●● patch | view | raw | blame | history
public/grabOrdersMap/js/getPosition.js
@@ -1,3 +1,4 @@
class $getPositions {
    constructor(arg) {
        this.id = arg.id || 0; //任务id
@@ -115,50 +116,114 @@
                }
            };
        outit();
        let success = function(position) {
            // console.log(position);
            var lat = position.coords.longitude;//经度
            var lon = position.coords.latitude;//纬度
            // console.log("成功返回经纬度信息");
            // console.log(lon, lat, "成功");
            that.onceNowPosition = [lat, lon];
        //qq定位
        var geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
        var options = {
            // timeout: 1000
        };
        function showPosition(position) {
            let lat = position.lat; //
            let lng = position.lng; //火星坐标 //TODO 实现业务代码逻辑
            that.onceNowPosition = [lng, lat];
            // console.log(that.onceNowPosition)
            that.state = false;
            ok = true;
            outit();
        }
        function showErr(data) {
            console.log(data)
            that.onceNowPosition = data;
            that.state = false;
            ok = true;
            outit();
        };
        let error = function(error) {
            // console.log(error, "失败");
            let msg = "none";
            switch (error.code) {
                case error.PERMISSION_DENIED:
                    msg = "User denied the request for Geolocation.";
                    break;
                case error.POSITION_UNAVAILABLE:
                    msg = "Location information is unavailable.";
                    break;
                case error.TIMEOUT:
                    msg = "The request to get user location timed out.";
                    break;
                case error.UNKNOWN_ERROR:
                    msg = "An unknown error occurred.";
                    break;
            }
            that.onceNowPosition = msg;
            that.state = false;
            ok = false;
            outit();
        };
        let options = {
            enableHighAccuracy: true,
            // timeout: 5000,
            timeout: Infinity,
            maximumAge: 0,
        };
        this.getOnceSPosition = navigator.geolocation.getCurrentPosition(
            success,
            error,
            options
        );
        geolocation.getLocation(showPosition, showErr, options);
        // 高德定位
        // console.log(AMap)
        // AMap.plugin("AMap.Geolocation", function() {
        //     var geolocation = new AMap.Geolocation({
        //         // 是否使用高精度定位,默认:true
        //         enableHighAccuracy: true,
        //         // 设置定位超时时间,默认:无穷大
        //         timeout: 10000,
        //         // 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20)
        //         // buttonOffset: new AMap.Pixel(10, 20),
        //         //  定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
        //         // zoomToAccuracy: true,
        //         //  定位按钮的排放位置,  RB表示右下
        //         // buttonPosition: "RB",
        //     });
        //     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;
        //         that.onceNowPosition = [lat, lon];
        //         that.state = false;
        //         ok = true;
        //         outit();
        //     }
        //     function onError(data) {
        //         // 定位出错
        //         console.log(data);
        //         that.onceNowPosition = data.message;
        //         that.state = false;
        //         ok = false;
        //         outit();
        //     }
        // });
        // return
        // let success = function(position) {
        //     // console.log(position);
        //     var lat = position.coords.longitude; //经度
        //     var lon = position.coords.latitude; //纬度
        //     // console.log("成功返回经纬度信息");
        //     // console.log(lon, lat, "成功");
        //     that.onceNowPosition = [lat, lon];
        //     that.state = false;
        //     ok = true;
        //     outit();
        // };
        // let error = function(error) {
        //     // console.log(error, "失败");
        //     let msg = "none";
        //     switch (error.code) {
        //         case error.PERMISSION_DENIED:
        //             msg = "User denied the request for Geolocation.";
        //             break;
        //         case error.POSITION_UNAVAILABLE:
        //             msg = "Location information is unavailable.";
        //             break;
        //         case error.TIMEOUT:
        //             msg = "The request to get user location timed out.";
        //             break;
        //         case error.UNKNOWN_ERROR:
        //             msg = "An unknown error occurred.";
        //             break;
        //     }
        //     that.onceNowPosition = msg;
        //     that.state = false;
        //     ok = false;
        //     outit();
        // };
        // let options = {
        //     enableHighAccuracy: true,
        //     // timeout: 5000,
        //     timeout: Infinity,
        //     maximumAge: 0,
        // };
        // this.getOnceSPosition = navigator.geolocation.getCurrentPosition(
        //     success,
        //     error,
        //     options
        // );
    }
    //结束获取
    outInit() {
public/grabOrdersMap/js/vueMain.js
@@ -97,7 +97,10 @@
            if (type != 1) {
                if (that.data.butCT == "beginUp") {
                    // 反馈
                    uni.navigateTo({
                    if(that.onPosition){
                        that.onPosition.overContinued();
                    }
                    uni.redirectTo({
                        url: '/pages/grabOrders/feedback?data=' + JSON.stringify(this.data) +
                            '&other="11111"'
                    });
@@ -142,6 +145,18 @@
                                let out = res.intlat;
                                if (typeof out != "string") {
                                    that.addIcon([out[1], out[0]]);
                                    //坐标输出
                                    let d = {
                                        uid: that.data.myid,
                                        rid: rid,
                                        jd: out[0],
                                        wd: out[1],
                                    }
                                    // console.log(d)
                                    axios.post(that.data.appenUrl + "trar/submit", d)
                                        .then(res => {
                                            // console.log('res=>', res);
                                        })
                                } else {
                                    console.log("获取定位失败")
                                }
@@ -193,34 +208,81 @@
        },
        beginCome() {
            var data = {
                appenUrl: "http://192.168.0.108:83/",
                butCT: "begin",
                buttype: 0,
                captain: "我",
                city: "南昌市",
                content: "测试",
                district: "西湖区",
                id: 37,
                integral: "222",
                iscation: "1",
                jnum: 3,
                line: "LINESTRING(115.8995839881188 28.687205773173343,115.89391916267935 28.678966027079593,115.90404718391959 28.673644524394046,115.91211526863638 28.681369286356936)",
                num: 1,
                nums: 0,
                province: "江西省",
                publisher: "管理",
                raddress: null,
                rname: "测试1",
                rtype: "0",
                serid: "1123598821738675201,",
                team: "你,他,它",
                time: "2022-02-18 14:15:52",
                type: "2",
                url: "http://223.82.109.183:2081/zhba/upload/20220218/67f0c8bf3e7b5024c64133691f265072.ico",
            }
                    appenUrl: "http://192.168.0.108:83/",
                    butCT: "begin",
                    buttype: 0,
                    captain: "我",
                    city: "南昌市",
                    content: "测试",
                    district: "西湖区",
                    id: 37,
                    integral: "222",
                    iscation: "1",
                    jnum: 3,
                    line: "LINESTRING(115.8995839881188 28.687205773173343,115.89391916267935 28.678966027079593,115.90404718391959 28.673644524394046,115.91211526863638 28.681369286356936)",
                    num: 1,
                    nums: 0,
                    province: "江西省",
                    publisher: "管理",
                    raddress: null,
                    rname: "测试1",
                    rtype: "0",
                    serid: "1123598821738675201,",
                    team: "你,他,它",
                    time: "2022-02-18 14:15:52",
                    type: "2",
                    url: "http://223.82.109.183:2081/zhba/upload/20220218/67f0c8bf3e7b5024c64133691f265072.ico",
                },
                that = this;
            //url解码
            this.data = this.getQueryVariable('data') || data;
            console.log(this.data)
            // console.log(this.data)
            if (typeof this.data == "string") {
                this.data = JSON.parse(this.data)
            }
            // console.log(this.data)
            if (this.data.isOn) {
                //队长开启任务
                let rid = that.data.id;
                that.onPosition = new $getPositions({
                    id: rid,
                    fn: function(res) {
                        // console.log(res);
                        // state.isOnTaskValue[id] = {
                        //     id: id,
                        //     intlat: res.intlat
                        // }
                        // state.changes = !state.changes;
                        // console.log(state.isOnTaskValue)
                        // $store.commit("setMsg", {
                        //     id: id,
                        //     intlat: res.intlat
                        // })
                        let out = res.intlat;
                        if (typeof out != "string") {
                            that.addIcon([out[1], out[0]]);
                            //坐标输出
                            let d = {
                                uid: that.data.myid,
                                rid: rid,
                                jd: out[0],
                                wd: out[1],
                            }
                            // console.log(d)
                            axios.post(that.data.appenUrl + "trar/submit", d)
                                .then(res => {
                                    // console.log('res=>', res);
                                })
                        } else {
                            console.log("获取定位失败")
                        }
                    }
                })
                that.onPosition.continuedTime();
                that.data.butCT = "beginUp";
                that.data.rtype = '0';
                that.data.type = "0";
            }
            if (typeof this.data.team === "string") {
                this.data.team = this.data.team.split(',');
            }
@@ -230,6 +292,7 @@
            // return
            this.map = this.beginMap(this.map, position); //创建并接受map
            this.map.invalidateSize(true); //应用地图高度
            console.log("完成数据")
        },
        changeDom(data) {
            // console.log(data, 'changeDom');
@@ -707,7 +770,11 @@
        //map适应任务详情高度
        // console.log(document.getElementById("map"))
        //因为按钮使用v-if所以在识别高度时候,but还没渲染所以手动添加 56px 不会变
        let UmainHeight = document.getElementById("Umain").clientHeight + 56;
        console.log("应用数据")
        let UmainHeight = document.getElementById("Umain").clientHeight;
        if (this.data.iscation == "1") {
            UmainHeight += 56;
        }
        let h = document.getElementById("mapVue").clientHeight;
        this.checkDomHeight({
            domName: "getElementById",