Nessuna descrizione

inspectionDetailMap.js 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. // packageA/pages/historicalTrackDetailMap/historicalTrackDetailMap.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. latitude: null,
  8. longitude: null,
  9. polyline: [],
  10. arrLine: [],
  11. arrLine1: [
  12. { latitude: "31.22115", longitude: "121.54407" },
  13. { latitude: "31.22114", longitude: "121.54409" },
  14. { latitude: "31.22112", longitude: "121.54410" },
  15. ],
  16. remark: "",
  17. markers: "",
  18. imagesTU: "",
  19. points: [],
  20. },
  21. onLoad: function (options) {
  22. console.log("options///////", options)
  23. if (options.url == undefined && options.remark == undefined) {
  24. console.log("1")
  25. let LineArr = options.dates.split(";")
  26. let arr1 = []
  27. LineArr.forEach((item, index) => {
  28. arr1.push({
  29. latitude: item.split(",")[0],
  30. longitude: item.split(",")[1],
  31. })
  32. })
  33. arr1.pop()
  34. var that = this
  35. that.setData({
  36. latitude: arr1[0].latitude,
  37. longitude: arr1[0].longitude,
  38. arrLine: arr1,
  39. points: arr1,
  40. })
  41. that.lineRoad()
  42. that.marksDots1()
  43. } else {
  44. console.log("2")
  45. console.log(options.images, 'options.images');
  46. const key = 'detailMapInfo';
  47. let images = wx.getStorageInfo(key)
  48. let arr = options.url.split(",")
  49. let LineArr = options.dates.split(";")
  50. let arr1 = []
  51. LineArr.forEach((item, index) => {
  52. let a1 = item.split(",")[0]
  53. let a2 = item.split(",")[1]
  54. if (a1 != 0 && a2 != 0) {
  55. arr1.push({ latitude: a1, longitude: a2 })
  56. }
  57. })
  58. // arr1.pop()
  59. console.log(arr1)
  60. var that = this
  61. console.log(arr[0], arr[1])
  62. that.setData({
  63. latitude: arr[0],
  64. longitude: arr[1],
  65. arrLine: arr1,
  66. remark: options.remark,
  67. imagesTU: images,
  68. points: arr1,
  69. })
  70. that.lineRoad()
  71. that.marksDots()
  72. ////console.log("imagesTU",that.data.imagesTU)
  73. ////console.log("路线",that.data.arrLine)
  74. ////console.log("路线",that.data.arrLine[0])
  75. ////console.log("路线",that.data.arrLine[that.data.arrLine.length-1])
  76. }
  77. },
  78. lineRoad() {
  79. var that = this
  80. that.setData({
  81. polyline: [
  82. {
  83. points: that.data.arrLine,
  84. color: "#ff9900",
  85. width: 9,
  86. arrowLine: true,
  87. borderWidth: 1,
  88. borderColor: "#555",
  89. },
  90. ],
  91. })
  92. },
  93. viewMoviePostImg: function (e) {
  94. var src = e.currentTarget.dataset.src
  95. wx.previewImage({
  96. current: src, // 当前显示图片的http链接
  97. urls: [src], // 需要预览的图片http链接列表
  98. })
  99. },
  100. marksDots() {
  101. var that = this
  102. console.log("that.data.arrLine", that.data.arrLine)
  103. that.setData({
  104. markers: [
  105. {
  106. iconPath: "/images/icon/wz.png",
  107. id: 0,
  108. latitude: that.data.latitude,
  109. longitude: that.data.longitude,
  110. width: 40,
  111. height: 60,
  112. },
  113. {
  114. iconPath: "/images/icon/wzEnd.png",
  115. id: 0,
  116. latitude: that.data.arrLine[that.data.arrLine.length - 1].latitude,
  117. longitude: that.data.arrLine[that.data.arrLine.length - 1].longitude,
  118. width: 33,
  119. height: 50,
  120. },
  121. {
  122. iconPath: "/images/icon/wzStar.png",
  123. id: 0,
  124. latitude: that.data.arrLine[0].latitude,
  125. longitude: that.data.arrLine[0].longitude,
  126. width: 26,
  127. height: 40,
  128. },
  129. ],
  130. })
  131. },
  132. marksDots1() {
  133. var that = this
  134. that.setData({
  135. markers: [
  136. {
  137. iconPath: "/images/icon/wzEnd.png",
  138. id: 0,
  139. latitude: that.data.arrLine[that.data.arrLine.length - 1].latitude,
  140. longitude: that.data.arrLine[that.data.arrLine.length - 1].longitude,
  141. width: 33,
  142. height: 50,
  143. },
  144. {
  145. iconPath: "/images/icon/wzStar.png",
  146. id: 0,
  147. latitude: that.data.arrLine[0].latitude,
  148. longitude: that.data.arrLine[0].longitude,
  149. width: 26,
  150. height: 40,
  151. },
  152. ],
  153. })
  154. },
  155. /**
  156. * 生命周期函数--监听页面初次渲染完成
  157. */
  158. onReady: function () {},
  159. /**
  160. * 生命周期函数--监听页面显示
  161. */
  162. onShow: function () {},
  163. /**
  164. * 生命周期函数--监听页面隐藏
  165. */
  166. onHide: function () {},
  167. /**
  168. * 生命周期函数--监听页面卸载
  169. */
  170. onUnload: function () {},
  171. /**
  172. * 页面相关事件处理函数--监听用户下拉动作
  173. */
  174. onPullDownRefresh: function () {},
  175. /**
  176. * 页面上拉触底事件的处理函数
  177. */
  178. onReachBottom: function () {},
  179. /**
  180. * 用户点击右上角分享
  181. */
  182. onShareAppMessage: function () {},
  183. })