jobqiangdan32/WebRoot/client/js/gaodemap.js

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/**
 * Created by ideabobo on 2016/12/25.
 */
var gdmap = null;
var geolocation = null;
function initGdMap(){
    var map = new AMap.Map('container', {
        center: [117.000923, 36.675807],
        zoom: 15
    });
    map.plugin(["AMap.ToolBar"], function() {
        map.addControl(new AMap.ToolBar());
    });
    gdmap = map;

    gdmap.plugin('AMap.Geolocation', function () {
        geolocation = new AMap.Geolocation({
            enableHighAccuracy: true,//是否使用高精度定位,默认:true
            timeout: 10000,          //超过10秒后停止定位,默认:无穷大
            maximumAge: 0,           //定位结果缓存0毫秒,默认:0
            convert: true,           //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
            showButton: true,        //显示定位按钮,默认:true
            buttonPosition: 'LB',    //定位按钮停靠位置,默认:'LB',左下角
            buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
            showMarker: true,        //定位成功后在定位到的位置显示点标记,默认:true
            showCircle: true,        //定位成功后用圆圈表示定位精度范围,默认:true
            panToLocation: true,     //定位成功后将定位到的位置作为地图中心点,默认:true
            zoomToAccuracy:true      //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
        });
        gdmap.addControl(geolocation);
        showLoader("正在定位...");
        geolocation.getCurrentPosition(function (status,data){
            hideLoader();
            if(status=="complete"){
                latitude = data.position.lat;
                longitude = data.position.lng;

                var uinfo = localStorage['userinfo'];
                if(uinfo && $.trim(uinfo)!=""){
                    uinfo  = JSON.parse(uinfo);
                    $("#lusername").val(uinfo.username);
                    $("#lpasswd").val(uinfo.passwd);
                    uinfo.remember = "1";
                    if(uinfo.roletype=="2"){
                        login(uinfo);
                    }

                }else{
                    toLogin();
                }
            }else{
                alert("定位失败!");
            }

        });
        /*AMap.event.addListener(geolocation, 'complete', function (data){
            alert(data);
        });//返回定位信息
        AMap.event.addListener(geolocation, 'error', function (ed){
            alert(ed);
后面还有 78 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。