(starRun ==
1) {
return; } starRun =
1; count_down(
this);
this.getLocation(); }, stopRun:
function () { starRun =
0; count_down(
this); }, updateTime:
function (time) { var data = http://www.netofthings.cn/JieJueFangAn/2017-01/
this.data; data.time = time;
this.data = http://www.netofthings.cn/JieJueFangAn/2017-01/data;"hljs-keyword">this.setData ({ time : time, }) }, getLocation:
function () { var that =
this wx.getLocation({ type:
'gcj02', success:
function(res){ console.log(
"res----------") console.log(res)
var newCover = { latitude: res.latitude, longitude: res.longitude, iconPath:
'/resources/redPoint.png', };
var oriCovers = that.data.covers; console.log(
"oriMeters----------") console.log(oriMeters);
var len = oriCovers.length;
var lastCover;
if (len ==
0) { oriCovers.push(newCover); } len = oriCovers.length;
var lastCover = oriCovers[len-
1]; console.log(
"oriCovers----------") console.log(oriCovers,len);
var newMeters = getDistance(lastCover.latitude,lastCover.longitude,res.latitude,res.longitude)/
1000;
if (newMeters <
0.0015){ newMeters =
0.0; } oriMeters = oriMeters + newMeters; console.log(
"newMeters----------") console.log(newMeters);
var meters =
new Number(oriMeters);
var showMeters = meters.toFixed(
2); oriCovers.push(newCover); that.setData({ latitude: res.latitude, longitude: res.longitude, markers: [], covers: oriCovers, meters:showMeters, }); }, }) }})
查看全部代码:weChatApp-Run。
5/5 首页 上一页 3 4 5