hdw
2018-12-12 76279b72a0dd16b50d0d37a926c111b92aedd511
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en" class="full-height">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>百度地图</title>
    <link rel="stylesheet" href="css/basic.css">
    <link rel="stylesheet" href="src/css/layui.css">
    <link rel="stylesheet" href="app/css/common.css">
    <link rel="stylesheet" href="app/css/map.css">
    <link rel="stylesheet" href="font-awesome-4.7.0/css/font-awesome.css">
    <!-- 导入百度地图API -->
    <link rel="stylesheet" href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css" />
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=QAerSFEiGDCx1oHPB7Z5XYcBHI6R3qwx"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
</head>
<body class="full-height">
    <div class="abs">
        <div class="rel-full">
            <div class="page-header bg-gay3">
                <div class="layui-row h40">
                    <div class="layui-col-xs3 layui-col-md1 full-height">
                        <button class="layui-btn layui-btn-primary layui-btn-sm mrt5 mrl8"><i class="fa fa-reply mrr4"></i>返回</button>
                    </div>
                    <div class="layui-col-xs6 layui-col-md10 full-height line-height40">机房定位</div>
                    <div class="layui-col-xs3 layui-col-md1 full-height line-height40 t-align-right t-align-right">
                        <button class="layui-btn layui-btn-primary layui-btn-sm mrr8" id="homeInfo"><i class="fa fa fa-bars mrr4"></i>功能</button>
                    </div>
                </div>
            </div>
            <div class="page-content abs abs-top40">
                <div class="rel-full">
                    <div id="map" class="full-height"></div>
                    <div id="mapSearch" class="map-search-container">
                        <div class="layui-form layui-form-pane" action="">
                            <div class="layui-form-item">
                                <label class="layui-form-label"><i class="fa fa-search"></i></label>
                                <div class="layui-input-block">
                                    <input type="text" name="title" id="searchInput" autocomplete="off" placeholder="机房搜索" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div id="mapLocationLogo" class="map-location-logo"></div>
                </div>
            </div>
        </div>
    </div>
    <script src="js/jquery-1.8.3.js"></script>
    <script src="src/layui.js"></script>
    <script>
        //  百度地图模块
        var map = new BMap.Map('map');
        var point = new BMap.Point(125.3192,43.8090);
        map.centerAndZoom(point, 11);    // 用城市名设置地图中心点
        map.enableScrollWheelZoom();
        map.disableDoubleClickZoom();
        // 给地图添加工具条(地图-卫星-三维)和比例尺控件
        map.addControl(new BMap.MapTypeControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT}));
 
        // 添加定位控件
        var geolocationControl = new BMap.GeolocationControl();
        map.addControl(geolocationControl);
 
        // layui模块
        layui.use(['layer'], function() {
            var layer = layui.layer;      // 获取layer模块
            var iframePopup;
            
            // 点击筛选弹出内容
            $('#homeInfo').click(function() {
                iframePopup = layer.open({
                    type: 2
                    ,closeBtn: 0
                    ,title: false
                    ,area: ['100%', '100%']
                    ,full: true
                    ,anim: 4
                    ,content: 'iframe/homeinfo.html'
                });
            });
 
            // 搜索机房获取焦点
            $('#searchInput').on('focus', function() {
                $(this).blur();
                iframePopup = layer.open({
                    type: 2
                    ,closeBtn: 0
                    ,title: false
                    ,area: ['100%', '100%']
                    ,full: true
                    ,anim: 5
                    ,content: 'iframe/searchHome.html'
                });
            });
 
        });
 
        //拦截安卓回退按钮
        history.pushState(null, null, location.href);
        window.addEventListener('popstate', function(event) {
            history.pushState(null, null, location.href );
            //此处加入回退时你要执行的代码
        });
    </script>
</body>
</html>