Marker = [];
let QQMapWX = require( '../../pages/libs/qqmap-wx-jssdk.min.js' );
var wxMarkerData = [];
var arr = [];
Page({
data: {
date: '2019-08-13' ,
height: 'auto' ,
markers: [],
latitude: '' ,
longitude: '' ,
centerX: "" ,
centerY: "" ,
text: '' ,
timer: "" ,
plain: true ,
polyline: [{
points: [],
color: "#FF0000DD" ,
width: 5,
dottedLine: false
}],
points: [],
pointsInfo: [],
playIndex: 0,
flag: false ,
speed: 500,
flag: false ,
enableSatellite: false ,
startTime: '08 : 40' ,
endTime: '08 : 50'
},
btnclick: function (e) {
var that = this ;
wx.getLocation({
success: function (res) {
console.log(res)
},
})
},
timeTrack: function (e) {
console.log(e)
wx.navigateTo({
url: '../pickTime/pickTime' ,
})
},
regionchange(e) {
},
markertap(e) {
},
controltap(e) {
},
onReady: function () {
let that = this ;
this .mapCtx = wx.createMapContext( 'myMap' );
},
onLoad: function (options) {
var that = this ;
let qqMap = new QQMapWX({
key: "'"
})
wx.getSystemInfo({
success: function (res) {
that.setData({
height: res.windowHeight
})
},
});
wx.request({
url: 'http:
method: 'POST ',
header: {
' content-type ': ' application/x-www-form-urlencoded '
}, // 默认值
data: {
startTime: ' 2019-07-08 19:10:00 ',
endTime: ' 2019-07-08 19:11:00 ',
},
success: function(res) {
//清洗数据
console.log(res);
for (let i = 0; i < res.data.data.length; i++) {
let obj = {};
obj.latitude = res.data.data[i].lat;
obj.longitude = res.data.data[i].lon;
that.data.points.push(obj);
}
// console.log(that.data.points);
that.setData({
// swiper: json,
markers: [{
iconPath: "/images/car.png",
id: 0,
callout: {
content: "测试\n 时间:11:20 \n速度:180km/h",
fontSize: ' 32 ',
padding: true,
color: ' #444',
display: 'ALWAYS ',
textAlign: ' center ',
borderRadius: 15
},
latitude: that.data.points[that.data.points.length - 1].latitude,
longitude: that.data.points[that.data.points.length - 1].longitude,
width: 30,
height: 30
}],
polyline: [{
// pointsInfo: "测试",
points: that.data.points,
color: "red",
width: 10,
dottedLine: true
}],
latitude: that.data.points[that.data.points.length - 1].latitude,
longitude: that.data.points[that.data.points.length - 1].longitude,
});
// console.log(that.data.polyline)
},
fail: function(res) {
console.log("获取数据失败")
console.log(res)
}
});
},
getmarkers: function(markerArr) {
let arr = [];
for (let i = 0; i < markerArr.length; i++) {
let location = this.createMarkert(markerArr[i]);
arr.push(location);
}
return arr
},
/**
* 构造可使用数据
*/
createMarkert: function(marker) {
var lat = marker.lat;
var lon = marker.lon;
var point = {
iconPath: "../../images/marker_red.png",
id: marker.sn || 0,
callout: {
content: marker.title,
fontSize: ' 32 ',
padding: true,
color: ' #444',
display: 'ALWAYS ',
textAlign: ' center',
borderRadius: 15
},
latitude: lat,
longitude: lon,
width: 15,
height: 15
}
return point;
},
})
|
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)