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

  • 相关阅读:
    .net core之log4net和过滤器
    记录待掌握的.net组件或框架或技术
    Spring 注释 @Autowired 和@Resource
    Java——Cookie与Session
    Hadoop
    分布式系统!
    mybatis 学习!
    Java动态代理一Proxy
    JavaWeb学习--Servlet认识
    Angular.JS
  • 原文地址:https://www.cnblogs.com/xqschool/p/14595593.html
Copyright © 2011-2022 走看看