location.html 4.06 KB
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="author" content="fansabc@gmail.com">
	<meta name="format-detection" content="telephone=no" />
	<meta name="msapplication-tap-highlight" content="no" />
	<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
	<!-- <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> -->
	<meta content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" name="viewport"/>
	<title>选择市场</title>

	<link rel="stylesheet" href="../css/style/common.css">
	<link rel="stylesheet" href="../css/style/location.css">

</head>
<body>
	<div class="m-page">
		<header class="m-header">
			<div class="head">
				<a href="#" class="lt-bar m-icon icon-back white">返回</a>
				<h1>批发市场</h1>
				<a href="#" class="rt-bar m-icon icon-more white">更多</a>
			</div>
		</header>
		<section class="m-content">
			<h2>定位市场</h2>
			<ul class="m-table-view">
				<li class="cell">
					<a href="#">
						<span class="title"><i class="m-icon icon-location"></i>哈尔滨哈达批发市场</span>
					</a>
				</li>
			</ul>
			<!-- <ul class="list-view">
				<li>
					<a href="javascript:" class="as-block">
						<i class="icon-location"></i>
						<span id="now-location">哈尔滨哈达批发市场</span>
					</a>
				</li>
			</ul> -->
			<h2>市场选择</h2>


			<!-- <ul class="list-view">
				<li>
					<a href="javascript:" class="as-block">
						哈尔滨哈达批发市场
					</a>
				</li>
				<li>
					<a href="javascript:" class="as-block">
						牡丹江牡达批发市场
					</a>
				</li>
				<li>
					<a href="javascript:" class="as-block">
						齐齐哈尔哈达批发市场
					</a>
				</li>
				<li>
					<a href="javascript:" class="as-block">
						贵阳地利批发市场
					</a>
				</li>
				<li>
					<a href="javascript:" class="as-block">
						沈阳地利批发市场
					</a>
				</li>
				<li>
					<a href="javascript:" class="as-block">
						山东寿光农产品批发市场
					</a>
				</li>
			</ul> -->

			<ul class="m-table-view">
				<li class="cell">
					<a href="#">
						<span class="title">哈尔滨哈达批发市场</span>
					</a>
				</li>
				<li class="cell">
					<a href="#">
						<span class="title">牡丹江牡达批发市场</span>
					</a>
				</li>
				<li class="cell">
					<a href="#">
						<span class="title">齐齐哈尔哈达批发市场</span>
					</a>
				</li>
				<li class="cell">
					<a href="#">
						<span class="title">贵阳地利批发市场</span>
					</a>
				</li>
				<li class="cell">
					<a href="#">
						<span class="title">沈阳地利批发市场</span>
					</a>
				</li>
				<li class="cell">
					<a href="#">
						<span class="title">山东寿光农产品批发市场</span>
					</a>
				</li>
			</ul>
			
		</section>
	</div>


<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=bnPuEaT9YSqKBgB0rOd3nHWE"></script>

<div id="allmap" style="display:none;"></div>


<script type="text/javascript">

	getLocation();

	function getLocation(){
		// 百度地图API功能
		var map = new BMap.Map("allmap");
		//var point = new BMap.Point(116.331398,39.897445);
		// map.centerAndZoom(point,12);

		var geolocation = new BMap.Geolocation();
		geolocation.getCurrentPosition(function(r){
			if(this.getStatus() == BMAP_STATUS_SUCCESS){
				var mk = new BMap.Marker(r.point);
				map.addOverlay(mk);
				map.panTo(r.point);
				
				var gc = new BMap.Geocoder(); 
			    var pt = new BMap.Point(r.point.lng,r.point.lat);
				gc.getLocation(pt, function(rs){
					var addComp = rs.addressComponents;
					alert( addComp.province + ", " + addComp.city + ", " + addComp.district );
					console.log(  addComp.street + ", " + addComp.streetNumber );
				}); 
			}
			else {
				alert('failed'+this.getStatus());
			}        
		},{enableHighAccuracy: true})
	}

</script>

</body>
</html>