+
liuyg
2022-02-22 d4f5aeb6d7ec2a6c5f6b5800e34483cbc0efd330
+
1 files modified
166 ■■■■ changed files
pages/grabOrders/map.vue 166 ●●●● patch | view | raw | blame | history
pages/grabOrders/map.vue
@@ -126,11 +126,12 @@
                ourData: {},
                map: null,
                domMove: null,
                query :null,
            }
        },
        methods: {
            openAPP(val){
            openAPP(val) {
            },
            message(event) {
                let data = event.detail.data;
@@ -188,6 +189,7 @@
                var that = this
                uni.getLocation({
                    type: 'wgs84',
                    isHighAccuracy: true,
                    success(res) {
                        // console.log(res, "当前位置");
                        that.latitude = res.latitude
@@ -431,83 +433,95 @@
            //     }, 10000)
            // }
            const _this = this;
            // uni.getSystemInfo({
            //     success: (res) => {
            //         _this.mapHeight = res.screenHeight - res.statusBarHeight
            //         _this.mapHeight = _this.mapHeight
            //         console.log(res)
            //         let info = uni.createSelectorQuery().select("Umain");
            //         info.boundingClientRect(function(data) { //data - 各种参数
            //             console.log(data.width) // 获取元素宽度
            //         }).exec()
            //     }
            // })
            // console.log(document.getElementById("Umain"))
            this.checkDomHeightId({
                domName: "getElementById",
                name: "Umain",
                fn: function(dom) {
                    console.log(dom)
                    let UmainHeights = dom.clientHeight;
                    uni.getSystemInfo({
                        success: (res) => {
                            _this.mapHeight = res.screenHeight - res.statusBarHeight -
                                UmainHeights
                            _this.mapHeight = _this.mapHeight
                        }
                    })
                }
            })
            this.checkDomHeight({
                domName: "getElementsByClassName",
                name: "content",
                fn: function(dom) {
                    // console.log(dom[0])
                    // dom.style.height = h - UmainHeight + "px";
                    // document.getElementsByClassName("dingwei")[0].style.bottom =
                    //     UmainHeight + 10 + "px";
                    // that.map.invalidateSize(true);
            // this.checkDomHeightId({
            //     domName: "getElementById",
            //     name: "Umain",
            //     fn: function(dom) {
            //         console.log(dom)
            //         let UmainHeights = dom.clientHeight;
            //         uni.getSystemInfo({
            //             success: (res) => {
            //                 _this.mapHeight = res.screenHeight - res.statusBarHeight -
            //                     UmainHeights
            //                 _this.mapHeight = _this.mapHeight
            //             }
            //         })
            //     }
            // })
            // this.checkDomHeight({
            //     domName: "getElementsByClassName",
            //     name: "content",
            //     fn: function(dom) {
            //         // console.log(dom[0])
            //         // dom.style.height = h - UmainHeight + "px";
            //         // document.getElementsByClassName("dingwei")[0].style.bottom =
            //         //     UmainHeight + 10 + "px";
            //         // that.map.invalidateSize(true);
                    let h = dom[0].clientHeight;
                    //因为按钮使用v-if所以在识别高度时候,but还没渲染所以手动添加 56px 不会变
                    // console.log("应用数据")
                    let UmainHeight = document.getElementById("Umain").clientHeight;
                    // if (that.ourData.iscation == "1") {
                    //     UmainHeight += 56;
                    // }
                    //计算最小单位
                    let rows = document.getElementsByClassName("once"),
                        rowsHeight = 45;
                    for (let ri = 0; ri < 3; ri++) {
                        rowsHeight += rows[ri].clientHeight;
                    }
                    //适应高度
                    that.domMove = new $moveWindow({
                        id: "Umain",
                        minHeight: rowsHeight,
                        maxHeight: UmainHeight,
                        critical: (UmainHeight - rowsHeight) / 4,
                        openAnimation: false,
                        fn: function(res) {
                            // console.log(that.map.options)
            //         let h = dom[0].clientHeight;
            //         //因为按钮使用v-if所以在识别高度时候,but还没渲染所以手动添加 56px 不会变
            //         // console.log("应用数据")
            //         let UmainHeight = document.getElementById("Umain").clientHeight;
            //         // if (that.ourData.iscation == "1") {
            //         //     UmainHeight += 56;
            //         // }
            //         //计算最小单位
            //         let rows = document.getElementsByClassName("once"),
            //             rowsHeight = 45;
            //         for (let ri = 0; ri < 3; ri++) {
            //             rowsHeight += rows[ri].clientHeight;
            //         }
            //         //适应高度
            //         that.domMove = new $moveWindow({
            //             id: "Umain",
            //             minHeight: rowsHeight,
            //             maxHeight: UmainHeight,
            //             critical: (UmainHeight - rowsHeight) / 4,
            //             openAnimation: false,
            //             fn: function(res) {
            //                 // console.log(that.map.options)
                            // document.getElementById("myMap").style.height = h - res.height + "px";
                            // console.log(h, res.height)
                            // uni.getSystemInfo({
                            //     success: (res) => {
                            //         _this.mapHeight = h - res.height
                            //         _this.mapHeight = _this.mapHeight
                            //     }
                            // })
                            // that.map.setView([that.map.options.center[0], +that.map.options.center[1] + 0.002], that.map
                            //     .options.zoom);
                            // console.log(h - res.height)
                            if (res.state === true || res.state === false) {
                                //     that.map.invalidateSize(true);
                                // _this.mapHeight = h - res.height;
                                // _this.map.moveToLocation({
                                //     latitude: _this.latitude,
                                //     longitude: _this.longitude
                                // });
                                document.getElementById("myMap").style.height = h - res
                                    .height + "px";
                            }
                            // document.getElementsByClassName("dingwei")[0].style.bottom = res.height +
                            //     10 + "px";
                        },
                    });
                    that.domMove.init();
                }
            })
            //                 // document.getElementById("myMap").style.height = h - res.height + "px";
            //                 // console.log(h, res.height)
            //                 // uni.getSystemInfo({
            //                 //     success: (res) => {
            //                 //         _this.mapHeight = h - res.height
            //                 //         _this.mapHeight = _this.mapHeight
            //                 //     }
            //                 // })
            //                 // that.map.setView([that.map.options.center[0], +that.map.options.center[1] + 0.002], that.map
            //                 //     .options.zoom);
            //                 // console.log(h - res.height)
            //                 if (res.state === true || res.state === false) {
            //                     //     that.map.invalidateSize(true);
            //                     // _this.mapHeight = h - res.height;
            //                     // _this.map.moveToLocation({
            //                     //     latitude: _this.latitude,
            //                     //     longitude: _this.longitude
            //                     // });
            //                     document.getElementById("myMap").style.height = h - res
            //                         .height + "px";
            //                 }
            //                 // document.getElementsByClassName("dingwei")[0].style.bottom = res.height +
            //                 //     10 + "px";
            //             },
            //         });
            //         that.domMove.init();
            //     }
            // })
            //画线