| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- // packageA/pages/historicalTrackDetailMap/historicalTrackDetailMap.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- latitude: null,
- longitude: null,
- polyline: [],
- arrLine: [],
- arrLine1: [
- { latitude: "31.22115", longitude: "121.54407" },
- { latitude: "31.22114", longitude: "121.54409" },
- { latitude: "31.22112", longitude: "121.54410" },
- ],
- remark: "",
- markers: "",
- imagesTU: "",
- points: [],
- },
- onLoad: function (options) {
- console.log("options///////", options)
- if (options.url == undefined && options.remark == undefined) {
- console.log("1")
- let LineArr = options.dates.split(";")
- let arr1 = []
- LineArr.forEach((item, index) => {
- arr1.push({
- latitude: item.split(",")[0],
- longitude: item.split(",")[1],
- })
- })
- arr1.pop()
- var that = this
- that.setData({
- latitude: arr1[0].latitude,
- longitude: arr1[0].longitude,
- arrLine: arr1,
- points: arr1,
- })
- that.lineRoad()
- that.marksDots1()
- } else {
- console.log("2")
- console.log(options.images, 'options.images');
- const key = 'detailMapInfo';
- let images = wx.getStorageInfo(key)
- let arr = options.url.split(",")
- let LineArr = options.dates.split(";")
- let arr1 = []
- LineArr.forEach((item, index) => {
- let a1 = item.split(",")[0]
- let a2 = item.split(",")[1]
- if (a1 != 0 && a2 != 0) {
- arr1.push({ latitude: a1, longitude: a2 })
- }
- })
- // arr1.pop()
- console.log(arr1)
- var that = this
- console.log(arr[0], arr[1])
- that.setData({
- latitude: arr[0],
- longitude: arr[1],
- arrLine: arr1,
- remark: options.remark,
- imagesTU: images,
- points: arr1,
- })
- that.lineRoad()
- that.marksDots()
- ////console.log("imagesTU",that.data.imagesTU)
- ////console.log("路线",that.data.arrLine)
- ////console.log("路线",that.data.arrLine[0])
- ////console.log("路线",that.data.arrLine[that.data.arrLine.length-1])
- }
- },
- lineRoad() {
- var that = this
- that.setData({
- polyline: [
- {
- points: that.data.arrLine,
- color: "#ff9900",
- width: 9,
- arrowLine: true,
- borderWidth: 1,
- borderColor: "#555",
- },
- ],
- })
- },
- viewMoviePostImg: function (e) {
- var src = e.currentTarget.dataset.src
- wx.previewImage({
- current: src, // 当前显示图片的http链接
- urls: [src], // 需要预览的图片http链接列表
- })
- },
- marksDots() {
- var that = this
- console.log("that.data.arrLine", that.data.arrLine)
- that.setData({
- markers: [
- {
- iconPath: "/images/icon/wz.png",
- id: 0,
- latitude: that.data.latitude,
- longitude: that.data.longitude,
- width: 40,
- height: 60,
- },
- {
- iconPath: "/images/icon/wzEnd.png",
- id: 0,
- latitude: that.data.arrLine[that.data.arrLine.length - 1].latitude,
- longitude: that.data.arrLine[that.data.arrLine.length - 1].longitude,
- width: 33,
- height: 50,
- },
- {
- iconPath: "/images/icon/wzStar.png",
- id: 0,
- latitude: that.data.arrLine[0].latitude,
- longitude: that.data.arrLine[0].longitude,
- width: 26,
- height: 40,
- },
- ],
- })
- },
- marksDots1() {
- var that = this
- that.setData({
- markers: [
- {
- iconPath: "/images/icon/wzEnd.png",
- id: 0,
- latitude: that.data.arrLine[that.data.arrLine.length - 1].latitude,
- longitude: that.data.arrLine[that.data.arrLine.length - 1].longitude,
- width: 33,
- height: 50,
- },
- {
- iconPath: "/images/icon/wzStar.png",
- id: 0,
- latitude: that.data.arrLine[0].latitude,
- longitude: that.data.arrLine[0].longitude,
- width: 26,
- height: 40,
- },
- ],
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {},
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {},
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {},
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {},
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {},
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {},
- })
|