...
|
...
|
@@ -41,6 +41,31 @@ |
|
|
<script type="text/plain" id="content" name="content"></script>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<th width="100">活动地点<span class="form-required">*</span></th>
|
|
|
<td>
|
|
|
<input class="form-control" type="text" name="address_name"
|
|
|
id="address_name" value="{$data.address_name|default=''}" placeholder="请输入标题"/>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<th width="100">经度<span class="form-required">*</span></th>
|
|
|
<td>
|
|
|
<input class="form-control" type="text" name="long"
|
|
|
type="text" id="lng" value="{$data.long|default=''}" placeholder="请输入"/>
|
|
|
<text id="selectBtn">点击地图选择坐标</text>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th width="100">纬度<span class="form-required">*</span></th>
|
|
|
<td>
|
|
|
<input class="form-control" type="text" name="lat"
|
|
|
type="text" id="lat" value="{$data.lat|default=''}" placeholder="请输入"/>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<!--<tr>-->
|
|
|
<!--<th>相册</th>-->
|
|
|
<!--<td>-->
|
...
|
...
|
@@ -177,5 +202,184 @@ |
|
|
|
|
|
});
|
|
|
</script>
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
$('.btn-cancel-thumbnail').click(function () {
|
|
|
$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
|
|
|
$('#thumbnail').val('');
|
|
|
});
|
|
|
$('.btn-cancel-thumbnail2').click(function () {
|
|
|
$('#thumbnail2-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
|
|
|
$('#thumbnail2').val('');
|
|
|
});
|
|
|
$('.btn-cancel-thumbnail3').click(function () {
|
|
|
$('#thumbnail3-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
|
|
|
$('#thumbnail3').val('');
|
|
|
});
|
|
|
|
|
|
// 百度地图API功能
|
|
|
var center = new BMap.Point({$data.long|default='116.404'}, {$data.lat|default='39.915'});
|
|
|
|
|
|
var map = new BMap.Map("allmap");
|
|
|
map.centerAndZoom(new BMap.Point(116.404, 39.915), 8);
|
|
|
map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用
|
|
|
map.enableContinuousZoom();
|
|
|
|
|
|
var map_ac = new BMap.Autocomplete( //建立一个自动完成的对象
|
|
|
{
|
|
|
"input": "aaa",
|
|
|
"location": map
|
|
|
});
|
|
|
|
|
|
var marker = new BMap.Marker(center); // 创建标注
|
|
|
map.addOverlay(marker); // 将标注添加到地图中
|
|
|
marker.enableDragging(); //可拖拽
|
|
|
//marker.setAnimation(BMAP_ANIMATION_BOUNCE);
|
|
|
|
|
|
map_ac.addEventListener("onconfirm", function (e) { //鼠标点击下拉列表后的事件
|
|
|
var _value = e.item.value;
|
|
|
|
|
|
function myFun() {
|
|
|
var pp = local.getResults().getPoi(0).point; //获取第一个智能搜索的结果
|
|
|
map.centerAndZoom(pp, 8);
|
|
|
marker.setPosition(pp);
|
|
|
mgetLocation(pp);
|
|
|
}
|
|
|
|
|
|
myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
|
|
|
var local = new BMap.LocalSearch(map, { //智能搜索
|
|
|
onSearchComplete: myFun
|
|
|
});
|
|
|
local.search(myValue);
|
|
|
});
|
|
|
|
|
|
|
|
|
var opts = {
|
|
|
width: 200, // 信息窗口宽度
|
|
|
height: 30, // 信息窗口高度
|
|
|
title: "", // 信息窗口标题
|
|
|
enableMessage: false,//设置允许信息窗发送短息
|
|
|
|
|
|
}
|
|
|
var infoWindow = new BMap.InfoWindow("拖动我设置你的位置", opts); // 创建信息窗口对象
|
|
|
marker.openInfoWindow(infoWindow);
|
|
|
|
|
|
var gc = new BMap.Geocoder();
|
|
|
|
|
|
function msetpoint(e) {
|
|
|
document.getElementById("lng_input").value = e.point.lng;
|
|
|
document.getElementById("lat_input").value = e.point.lat;
|
|
|
marker.setPosition(new BMap.Point(e.point.lng, e.point.lat));
|
|
|
mgetLocation(e.point);
|
|
|
}
|
|
|
|
|
|
function mgetLocation(point) {
|
|
|
gc.getLocation(point, function (rs) {
|
|
|
console.log(rs);
|
|
|
var addComp = rs.addressComponents;
|
|
|
marker.openInfoWindow(new BMap.InfoWindow(rs.address, opts));
|
|
|
document.getElementById("address_input").value = rs.address;
|
|
|
document.getElementById("city_input").value = addComp.city;
|
|
|
document.getElementById("province_input").value = addComp.province;
|
|
|
document.getElementById("district_input").value = addComp.district;
|
|
|
document.getElementById("lng_input").value = rs.point.lng;
|
|
|
document.getElementById("lat_input").value = rs.point.lat;
|
|
|
//alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
|
|
|
});
|
|
|
}
|
|
|
marker.addEventListener("dragend", msetpoint)
|
|
|
|
|
|
map.addEventListener("click", msetpoint);
|
|
|
|
|
|
|
|
|
function tilesloaded() {
|
|
|
map.setCenter(center); //设置地图中心点。center除了可以为坐标点以外,还支持城市名
|
|
|
mgetLocation(center);
|
|
|
// map.setZoom(8); //将视图切换到指定的缩放等级,中心点坐标不变
|
|
|
map.removeEventListener("tilesloaded", tilesloaded);
|
|
|
}
|
|
|
map.addEventListener("tilesloaded", tilesloaded);
|
|
|
|
|
|
|
|
|
function confirm() {
|
|
|
var data = {};
|
|
|
data.lng = document.getElementById("lng_input").value;
|
|
|
data.lat = document.getElementById("lat_input").value;
|
|
|
data.address = document.getElementById("address_input").value;
|
|
|
data.city = document.getElementById("city_input").value;
|
|
|
data.province = document.getElementById("province_input").value;
|
|
|
data.district = document.getElementById("district_input").value;
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
//编辑器路径定义
|
|
|
var editorURL = GV.WEB_ROOT;
|
|
|
|
|
|
|
|
|
|
|
|
var SelectLocation = {
|
|
|
|
|
|
init:function(config){
|
|
|
var eleId = config.id;
|
|
|
var mapUrl = config.url;
|
|
|
var winHeight = config.height || 800;
|
|
|
var winWidth = config.width || 1024;
|
|
|
var winTop = config.top || 50;
|
|
|
var winLeft = config.left || 100;
|
|
|
this.callbackFun = config.callback;
|
|
|
|
|
|
if(!eleId){
|
|
|
alert('元素id不能为空');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(!mapUrl){
|
|
|
alert('地图url不能为空');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var ele = document.getElementById(eleId);
|
|
|
ele.addEventListener('click',function(){
|
|
|
window.open(mapUrl,'selectLocation','fullscreen=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,' +
|
|
|
'height='+winHeight+',width='+winWidth+',top='+winTop+',left='+winLeft+'');
|
|
|
});
|
|
|
},
|
|
|
|
|
|
callbackFun:null,
|
|
|
|
|
|
selectCallback:function(selectedLocation){
|
|
|
console.log('12121212');
|
|
|
if(this.callbackFun){
|
|
|
this.callbackFun(selectedLocation);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
SelectLocation.init({
|
|
|
id:'selectBtn', //打开地图窗口按钮的ID
|
|
|
url:'/txmap.html', //地图页面的地址
|
|
|
// width:'1024', //打开地图窗口的宽度,可不传
|
|
|
// height:'800', //打开地图窗口的高度,可不传
|
|
|
// top:'50', //打开地图窗口距显示器顶部的距离,可不传
|
|
|
// left:'100', //打开地图窗口显示器左边的距离,可不传
|
|
|
callback:function(selectedLocation){
|
|
|
var lat = document.getElementById('lat');
|
|
|
var lng = document.getElementById('lng');
|
|
|
console.log(selectedLocation);
|
|
|
var gps=selectedLocation.location.split(",");
|
|
|
if (gps==''){
|
|
|
return false;
|
|
|
}
|
|
|
console.log(gps)
|
|
|
lat.value =gps['1'];
|
|
|
lng.value =gps['0'];
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |
...
|
...
|
|