addclock.html
12.5 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('index')}">打卡列表</a></li>
<li class="active">
<a href="{:url('add')}">打卡添加</a>
</li>
</ul>
<form action="{:url('addPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
<div class="col-md-9">
<table class="table table-bordered">
<tr>
<th width="100">名称(限20字)<span class="form-required">*</span></th>
<td>
<input class="form-control" type="text" name="activity_name" required
id="title" value="{$data.activity_name}" placeholder="请输入活动名称"/>
<input type="hidden" name="activity_id" value="{$data.activity_id}">
<input type="hidden" name="user_id" value="{$data.user_id}">
<input type="hidden" name="activity_name" value="{$data.activity_name}">
</td>
</tr>
<tr>
<th width="100">名称(限20字)<span class="form-required">*</span></th>
<td>
<input required class="form-control" type="text" name="activity_name"
id="title" value="{$data.activity_name}" placeholder="请输入活动名称"/>
</td>
</tr>
<tr>
<th width="100">活动日期<span class="form-required">*</span></th>
<td>
<input required class="form-control js-date" type="text" name="date"
type="time" id="title" value="{:date('Y-m-d',$data.start_time)}" placeholder="请输入"/>
</td>
</tr>
<tr>
<th width="100">地址名称<span class="form-required">*</span></th>
<td>
<input required class="form-control" type="text" name="address"
type="time" id="address_name" value="" 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 required class="form-control" type="text" name="lat"
type="text" id="lat" value="{$data.lat|default=''}" placeholder="请输入"/>
</td>
</tr>
<tr>
<th width="100">开始打卡时间<span class="form-required">*</span></th>
<td>
<input class="form-control" type="time" name="start_clock_time"
type="time" id="title" value="" placeholder="请输入"/>
</td>
</tr>
<tr>
<th width="100">结束打卡时间<span class="form-required">*</span></th>
<td>
<input class="form-control date-time" type="time" name="end_clock_time"
type="time" value="" placeholder="请输入"/>
</td>
</tr>
<tr>
<th width="100">工作时长<span class="form-required">*</span></th>
<td>
<input required class="form-control date-time" type="number" name="work_time"
type="time" value="" placeholder="请输入"/>
</td>
</tr>
</table>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
</div>
</div>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></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 src="__TMPL__/public/assets/js/selectLocation.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function () {
editorcontent = new baidu.editor.ui.Editor();
editorcontent.render('content');
try {
editorcontent.sync();
} catch (err) {
}
$('.btn-cancel-thumbnail').click(function () {
$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnail').val('');
});
$('.btn-cancel-thumbnail1').click(function () {
$('#thumbnail-preview1').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnail1').val('');
});
});
</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">
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');
var address_name = document.getElementById('address_name');
console.log(selectedLocation);
var gps=selectedLocation.latlng;
if (gps==''){
return false;
}
console.log(gps)
lat.value =gps.lat;
lng.value =gps.lng;
address_name.value=selectedLocation.poiaddress+selectedLocation.poiname
}
});
</script>
</body>
</html>