zoukankan      html  css  js  c++  java
  • H5 通过腾讯地图api定点位置

    uniapp版本

    selectPosition(e) {
                uni.setStorageSync("b_page_index", e); // 存入当前选择
                let _latitude = "";
                let _longitude = "";
    			console.log("111");
                uni.getLocation({
                    type: "wgs84",
                    success: (res) => {
    					console.log(res);
                        _longitude = res.longitude;
                        _latitude = res.latitude;
                        let url = "https://apis.map.qq.com/tools/locpicker?";
                        url =
                            url +
                            "type=0&backurl=" +
                            encodeURIComponent(
                                window.location.protocol +
                                    "//" +
                                    window.location.host +
                                    "/h5/#/pages/index/book-car-service"
                            ); // 选择类型及拼接回跳地址
                        url = url + "&coord=" + _latitude + "," + _longitude; // 经纬度
                        url = url + "&key=" + this.key + "&referer=myapp"; // 开发密钥及应用名称
    					console.log(url)
    
                        window.location.href = url; // 跳转腾讯地图选点组件
                    },
                });
            },
    

     

     let url = "https://apis.map.qq.com/tools/locpicker?";
                url =
                    url +
                    "type=0&backurl=" +
                    encodeURIComponent(
                        window.location.protocol +
                            "//" +
                            window.location.host +
                            "/h5/#/pages/customer/home"
                    ); // 选择类型及拼接回跳地址
                url = url + "&coord=" + _latitude + "," + _longitude; // 经纬度
                url = url + "&key=" + this.key + "&referer=myapp"; // 开发密钥及应用名称
    
                // console.log('url :>> ', url);
    
    
                window.location.href = url; // 跳转腾讯地图选点组件
    

    地图选址的组件:

    https://lbs.qq.com/webApi/component/componentGuide/componentPicker

  • 相关阅读:
    Entropy
    MonkeyEatsPeach
    python中使用可选参数
    java中二元数组的构建
    静态语言和动态语言
    开胃菜
    python 工具箱
    python处理多层嵌套列表
    小球落体
    LoadRunner:Error 27796
  • 原文地址:https://www.cnblogs.com/xqschool/p/14595593.html
Copyright © 2011-2022 走看看