map_frm.html
2.6 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<title>title</title>
<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
<link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
<link rel="stylesheet" type="text/css" href="../../css/utils/map.css"/>
<style>
html,
body{
background: #FFFFFF;
}
</style>
</head>
<body>
<div class="search-area">
<input id="gzdl" class="aui-input" placeholder="搜索地点" type="text" style="height:100%;width:100%;text-align:center;font-family:DINPro-Medium;font-weight:500;color:rgba(91,127,248,1);font-size:16px;" >
</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
var bmap;
apiready = function(){
bmap = api.require('bMap');
initMap();
};
//searchInBounds //56px
function initMap() {
console.log();
if ($api.getStorage('SYSTEMTYPE') == 'ios') {
bmap.initMapSDK(function(ret) {
if (ret.status) {
// alert('地图初始化成功,可以从百度地图服务器检索信息了!');
}
});
}
// bmap.getLocationServices(function(ret, err) {
// if (ret.enable) {
// alert(JSON.stringify(ret));
// } else {
// alert("未开启定位功能!");
// }
// });
bmap.getLocation({
accuracy: '100m',
autoStop: true,
filter: 1
}, function(ret1, err) {
// console.log(ret1 + ':' + err);
alert(ret1 + ':' + err);
if (ret1.status) {
bmap.open({
rect: {
x: 0,
y: 56,
w: api.winWidth,
h: api.winWidth/1.6
},
center: {
lon: ret1.lon,
lat: ret1.lat
},
zoomLevel: 10,
showUserLocation: true,
fixedOn: api.frameName,
fixed: true
}, function(ret) {
if (ret.status) {
console.log('地图打开成功');
}
});
} else {
alert(err.code);
}
});
}
</script>
</html>