...
|
...
|
@@ -199,12 +199,13 @@ |
|
|
</div>
|
|
|
</body>
|
|
|
</html>
|
|
|
<script type="text/javascript" src = 'https://webapi.amap.com/maps?v=1.4.4&test=true&key=ef53760bd959a4df08b7d4587280e642&&plugin=AMap.ToolBar,AMap.IndoorMap'></script>
|
|
|
<script type="text/javascript" src="../../assets/js/api.js"></script>
|
|
|
<script type="text/javascript" src="../../assets/js/swiper-3.4.2.min.js"></script>
|
|
|
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
|
|
|
<script type="text/javascript" src="../../assets/js/public.js"></script>
|
|
|
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
|
|
|
<script type="text/javascript" src = 'https://webapi.amap.com/maps?v=1.4.4&test=true&key=ef53760bd959a4df08b7d4587280e642&&plugin=AMap.ToolBar,AMap.IndoorMap'></script>
|
|
|
|
|
|
<script>
|
|
|
new FastClick(document.body);
|
|
|
</script>
|
...
|
...
|
@@ -288,31 +289,65 @@ |
|
|
})
|
|
|
},
|
|
|
// 定位当前城市
|
|
|
get_city: function () {
|
|
|
app.map = new AMap.Map('container', {});
|
|
|
app.map.plugin('AMap.Geolocation', function () {
|
|
|
var geolocation = new AMap.Geolocation({
|
|
|
// 是否使用高精度定位,默认:
|
|
|
enableHighAccuracy: true,
|
|
|
// 设置定位超时时间,默认:无穷大
|
|
|
timeout: 10000,
|
|
|
});
|
|
|
geolocation.getCurrentPosition();
|
|
|
AMap.event.addListener(geolocation, 'complete', onComplete)
|
|
|
AMap.event.addListener(geolocation, 'error', onError)
|
|
|
get_city: function() {
|
|
|
var app = this ;
|
|
|
map = new AMap.Map('container', {});
|
|
|
map.plugin('AMap.Geolocation', function() {
|
|
|
var geolocation = new AMap.Geolocation({
|
|
|
// 是否使用高精度定位,默认:true
|
|
|
enableHighAccuracy: true,
|
|
|
// 设置定位超时时间,默认:无穷大
|
|
|
timeout: 10000
|
|
|
});
|
|
|
geolocation.getCurrentPosition();
|
|
|
AMap.event.addListener(geolocation, 'complete', onComplete)
|
|
|
AMap.event.addListener(geolocation, 'error', onError)
|
|
|
function onComplete(data) {
|
|
|
// app.cityname = data.addressComponent.province;
|
|
|
console.log(app.cityname);
|
|
|
app.lng = data.position.lng;
|
|
|
app.lat = data.position.lat;
|
|
|
app.street = data.addressComponent.street;
|
|
|
// console.log(app.lng);
|
|
|
// console.log(app.lat);
|
|
|
//
|
|
|
// // 获取附近地址
|
|
|
// app.map = new AMap.Map('container', {});
|
|
|
// AMap.service(["AMap.PlaceSearch"], function() {
|
|
|
// var placeSearch = new AMap.PlaceSearch({
|
|
|
// pageSize: 10, // 每页10条
|
|
|
// pageIndex: 1, // 获取第一页
|
|
|
// city: app.cityname // 指定城市名(如果你获取不到城市名称,这个参数也可以不传,注释掉)
|
|
|
// });
|
|
|
//
|
|
|
// // 第一个参数是关键字,这里传入的空表示不需要根据关键字过滤
|
|
|
// // 第二个参数是经纬度,数组类型
|
|
|
// // 第三个参数是半径,周边的范围
|
|
|
// // 第四个参数为回调函数
|
|
|
//
|
|
|
// placeSearch.searchNearBy(app.cityname, [app.lng, app.lat], 1000, function(status, result) {
|
|
|
//
|
|
|
// console.log(JSON.stringify(status))
|
|
|
// if(result.info === 'OK') {
|
|
|
// var locationList = result.poiList.pois; // 周边地标建筑列表
|
|
|
// console.log(locationList)
|
|
|
// app.nearList = locationList // 生成地址列表html
|
|
|
// // createLocationHtml(locationList);
|
|
|
// } else {
|
|
|
// console.log('获取位置信息失败!');
|
|
|
// }
|
|
|
// });
|
|
|
// });
|
|
|
}
|
|
|
|
|
|
function onComplete(data) {
|
|
|
console.log(JSON.stringify(data))
|
|
|
app.cityname = data.addressComponent.province
|
|
|
// data是具体的定位信息
|
|
|
}
|
|
|
function onError(erro) {
|
|
|
console.log(erro)
|
|
|
// 定位出错
|
|
|
toastMsg('请开启定位功能')
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
function onError(erro) {
|
|
|
// 定位出错
|
|
|
toastMsg('请开启定位功能')
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 切换底部导航
|
|
|
changeTab: function (res) {
|
|
|
//跳转页面
|
...
|
...
|
|