<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320" />
<title>Hello H5+</title>
<link rel="stylesheet" href="../css/mui.min.css">
<script src="../js/mui.min.js"></script>
<script src="../js/app.js"></script>
<script type="text/javascript" src="../js/j/hdj.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript">
var ws = null;
var em = null,
lat = 39.906016,
lng = 116.3977,
map = null;
var arrayMaker = [];
// H5 plus事件处理
function plusReady() {
if (!em || ws) {
return
};
if (plus.storage.getItem(hdjIni.session.lat)) {
lat = plus.storage.getItem(hdjIni.session.lat);
lng = plus.storage.getItem(hdjIni.session.lng);
}
// 获取窗口对象
ws = plus.webview.currentWebview();
setTimeout(function() {
map = new plus.maps.Map("map");
map.centerAndZoom(new plus.maps.Point(lng, lat), 14);
map.showUserLocation(true);
//createMarker(lng, lat);
// 创建子窗口
//createSubview();
}, 300); // 显示页面并关闭等待框
ws.show("slide-in-right", 300);
window.addEventListener("getPosintion", getCoordsData);
}
if (window.plus) {
plusReady();
} else {
document.addEventListener("plusready", plusReady, false);
}
// DOMContentloaded事件处理
document.addEventListener("DOMContentLoaded", function() {
em = document.getElementById("map");
window.plus && plusReady();
}, false);
function userLocation() {
//map.clearOverlays();
//删除标记
if (arrayMaker) {
for (i in arrayMaker) {
map.removeOverlay(arrayMaker[i]);
}
arrayMaker.length = 0;
}
map.showUserLocation(true);
map.getUserLocation(function(state, pos) {
if (0 == state) {
map.setCenter(pos);
lat = pos.getLat();
lng = pos.getLng();
//getCoordsData();
} else {
mui.toast("请在设置里打开本程序定位功能");
}
});
}
/**
* 显示明细数据
*/
function fDetail(JobId) {
console.log(JobId);
//var w = plus.webview.getWebviewById("jobDetail.html");
plus.storage.setItem(hdjIni.tempdata, "" + JobId);
console.log(plus.storage.getItem(hdjIni.tempdata));
mui.openWindow({
url: 'jobDetail.html',
id: 'jobDetail.html',
styles: {
top: 0,
bottom: 0
},
show: {
aniShow: 'slide-in-right',
duration: 100
},
waiting: {
autoShow: true, //自动显示等待框
title: '', //等待对话框上显示的提示内容
}
});
}
function createMarker(lng, lat, content, jobId) {
console.log(lng);
var marker = new plus.maps.Marker(new plus.maps.Point(lng, lat));
marker.setIcon("../img/point.gif");
//marker.setLabel("HBuilder");
var bubble = new plus.maps.Bubble(content);
marker.setBubble(bubble);
bubble.onclick = function(marker) {
fDetail(jobId);
}
arrayMaker.push(marker);
map.addOverlay(marker);
}
function createSubview() {
if ('Android' != plus.os.name) {
return;
}
var wsub = plus.webview.create('maps_map_sub.html', 'sub', {
top: '44px',
height: '60px',
position: 'absolute',
scrollIndicator: 'none',
background: 'transparent'
});
ws.append(wsub);
}
//取得坐标数据
function getCoordsData() {
console.log("lat:" + lat);
console.log("lng:" + lng);
plus.storage.setItem(hdjIni.session.lat, "" + lat);
plus.storage.setItem(hdjIni.session.lng, "" + lng);
//return '[{"lat":"' + (lat - 0.01) + '","lng":"' + (lng - 0.01) + '","addr":"公司甲公司甲公司甲"},{"lat":"' + (lat + 0.01) + '","lng":"' + (lng + 0.01) + '","addr":"公司乙"}]';
//Get
var url = hdjIni.jobserver + "resultA";
var getData = {
"companylongitude": lng,
"companylatitude": lat
};
hdjIni.fGetJson(url, getData, function(data) {
plus.storage.setItem(hdjIni.session.joblist, JSON.stringify(data));
markerCustom(data);
});
}
function markerCustom(point) {
console.log(JSON.stringify(point));
var points = eval(point);
for (var index = 0; index < points.length; index++) {
(function(n) {
createMarker(points[n].companylongitude, points[n].companylatitude, points[n].title + " " + points[n].job_payment_name, points[n].id);
})(index);
}
}
function fCheck() {
//getCoordsData();
//map.centerAndZoom(new plus.maps.Point(116.3977, 39.906016), 12);
if (!plus.webview.getWebviewById("map_check.html")) {
mui.openWindow({
url: 'map_check.html',
id: 'map_check.html',
styles: {
right: 0,
bottom: 50,
width: 300,
height: 400
},
show: {
aniShow: 'slide-in-right',
duration: 100
},
waiting: {
autoShow: true, //自动显示等待框
title: '', //等待对话框上显示的提示内容
}
});
} else {
plus.webview.getWebviewById("map_check.html").show();
}
}
function fList() {
mui.openWindow({
url: 'contact.html',
id: 'contact.html',
styles: {
top: 0,
bottom: 0
},
show: {
aniShow: 'slide-in-right',
duration: 100
},
waiting: {
autoShow: true, //自动显示等待框
title: '', //等待对话框上显示的提示内容
}
});
}
</script>
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
<style type="text/css">
#map {
width: 100%;
position: fixed;
top: 1px;
bottom: 40px;
line-height: 200px;
text-align: center;
background: #FFFFFF;
}
.ipos {
background: no-repeat center center url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAsCAYAAAAn4+taAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNC8wMS8xNExYUU4AAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAACTklEQVRoge2YO2gUURSGv7PjEkULO4UoFooIFgtzprAPWMiWKewSTadgYWEhBjHCloGUQtYHaGEjGAQtUmgnZO9YpsqC2NgYIwjRInMscoPrYkzhGTIs8zdnzoP578ewM/eumBmjoMZ+L8BLNUjVVINUTTVI1VSDVE0jA3KgjJuGEE6LyI2iKC6JyBkzWxORF8ADVV0rw1O891ohhCngPnDyL+1PZjabZdkTV1OcQUIIV4CHMf0JvAK+A0eANjAWe1dV9ZGbMY6/kTzPzwHzMV0VkZaqTgLTqjopIi1gNfbnQwhnvbzBEcTMbgFHgXURaRdFsRFCWAa+hhCWi6LYEJE2sB7nbnp5g+9b62KMIU3Tvoh0gQm2Fz0hIt00TftAADCztqO3K8h4jJsAZnZ+sDmQ/wAQkXEc5QnyJcZjACLybLApIk/j5YmheRd5gryLMev1elOqesfMrpvZczO7pqqzvV5vGmgNzbvIDUREXsbLRES6IYTbzWZzMcuyy0mSPA4h3BWRxR3PgXkff6/vSJ7nx83sPXBqoLwJFEACHByofxSRC2mafnYxx/GJxEW9GSofAg7zJwTAa08I8N80doG9HrHx++vvJlcQVV0xs6V/zZjZkqquePpCOdv4OWBrl96WiNwrwdMfJMuyHFjYpb2gqh+8PaG8g9Uc0B+q9WO9FJUCoqrfgBm2X73EOBPrpai0o66qvgU6Me3EvDSVctTdUZIknaIoxhqNRmfv6f+T+1F3vzQy/6LUIFVTDVI11SBVUw1SNdUgVdPIgPwCtt+2JPQRVicAAAAASUVORK5CYII=);
background-size: 50px 44px;
}
#location {
position: absolute;
right: 5px;
bottom: 0px;
}
#check {
position: absolute;
right: 210px;
bottom: 0px;
}
#list {
position: absolute;
right: 120px;
bottom: 0px;
}
</style>
</head>
<body>
<div id="map">地图加载中...</div>
<div class="mui-content">
<div id="location">
<a class="mui-btn mui-btn-negative" onclick="userLocation()">
<span class="mui-icon mui-icon-location"></span> 重新定位
</a>
</div>
<div id="check">
<a class="mui-btn mui-btn-negative" href="#checkmarkempty" onclick="fCheck()">
<span class="mui-icon mui-icon-checkmarkempty"></span> 筛选
</a>
</div>
<div id="list">
<a class="mui-btn mui-btn-negative" href="#checkmarkempty" onclick="fList()">
<span class="mui-icon mui-icon-list"></span> 列表
</a>
</div>
</div>
</body>
</html>
10 个回复
DCloud_IOS_XTY
你是如何写的
forrestgan (作者)
<!DOCTYPE HTML>
<html>
</html>
forrestgan (作者)
Andriod下完全没问题
DCloud_IOS_XTY
你的问题是标记没出来,还是出来了图标不对?
forrestgan (作者)
标记没出来
DCloud_IOS_XTY
你把页面发给我吧,这个看起来太费劲
forrestgan (作者)
好的,明天吧。
forrestgan (作者)
附件是页面文件
forrestgan (作者)
这个问题解决了,有两个问题需要修改
昵称都被用了
IOS地图怎么配置的??