Ei kuvausta

inspectionHuatanDeatil.js 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // greenland/pages/inspectionHuatan/inspectionHuatanDeatil/inspectionHuatanDeatil.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. allData: {},
  9. // 拍照点位
  10. markers: [],
  11. longitude: '',
  12. latitude: '',
  13. },
  14. scrolltoupper() {},
  15. // 获取数据
  16. getinfobyid(id) {
  17. app.loading();
  18. let url = app.globalData.httpsUrlServer + '/lhgyWork/selectPatrolTrackById';
  19. let data = {
  20. id: id,
  21. };
  22. app.postReq(url, data, (res) => {
  23. console.log(res);
  24. if (res.status == 200) {
  25. this.setData({
  26. allData: res.data,
  27. });
  28. // 渲染 拍照点位
  29. let arr = [];
  30. if (this.data.allData.fileListResponse.length > 0) {
  31. this.data.allData.fileListResponse.forEach((v, i) => {
  32. if (!v.number3) {
  33. let obj = {
  34. latitude: v.fileList[0].fileCoordinates.split(',')[0],
  35. longitude: v.fileList[0].fileCoordinates.split(',')[1],
  36. width: 20,
  37. height: 20,
  38. iconPath: '../../../../images/icon/wz.png',
  39. id: 1,
  40. };
  41. arr.push(obj);
  42. } else {
  43. // 没有问题的 点位
  44. let obj = {
  45. latitude: v.fileList[0].fileCoordinates.split(',')[0],
  46. longitude: v.fileList[0].fileCoordinates.split(',')[1],
  47. width: 30,
  48. height: 50,
  49. iconPath: '../../../../images/icon/wzStar.png',
  50. id: 2,
  51. };
  52. arr.push(obj);
  53. }
  54. });
  55. }
  56. console.log(arr);
  57. this.setData({
  58. markers: arr,
  59. });
  60. app.hideloading();
  61. }
  62. });
  63. },
  64. //去点位详情页
  65. jumpDetails(e) {
  66. let url = e.currentTarget.dataset.url;
  67. let remark = e.currentTarget.dataset.remark;
  68. let images = JSON.stringify(e.currentTarget.dataset.images);
  69. wx.navigateTo({
  70. url:
  71. // "/packageA/pages/historicalTrackDetailMap/historicalTrackDetailMap?url=" +
  72. '../inspectionHuatanDeatilMap/inspectionHuatanDeatilMap?url=' +
  73. url +
  74. '&dates=' +
  75. this.data.stringsArr +
  76. '&remark=' +
  77. remark +
  78. '&images=' +
  79. images,
  80. });
  81. },
  82. // 预览图片
  83. viewMoviePostImg(e) {
  84. var src = e.currentTarget.dataset.src;
  85. wx.previewImage({
  86. current: src, // 当前显示图片的http链接
  87. urls: [src], // 需要预览的图片http链接列表
  88. });
  89. },
  90. // 去工地那也
  91. formDtealis(e) {
  92. let id = this.data.allData.fileListResponse[e.currentTarget.dataset.index]
  93. .fileList[0].number3;
  94. console.log(id);
  95. // orderId=2740&stateid=1&seatId=0&deptType=2&typeFlag=3
  96. // app.globalData.orderType = 0
  97. // app.globalData.orderState = 0
  98. wx.navigateTo({
  99. url: `/greenland/pages/greenOrderDetails/greenOrderDetails?orderId=${id}&deptType=2`,
  100. });
  101. },
  102. onLoad: function (options) {
  103. var that = this;
  104. wx.getLocation({
  105. type: 'wgs84',
  106. success: function (res) {
  107. var latitude = res.latitude;
  108. var longitude = res.longitude;
  109. //console.log(res.latitude);
  110. that.setData({
  111. latitude: res.latitude,
  112. longitude: res.longitude,
  113. markers: [
  114. {
  115. latitude: res.latitude,
  116. longitude: res.longitude,
  117. },
  118. ],
  119. });
  120. },
  121. });
  122. this.setData({
  123. infoId: options.id,
  124. });
  125. this.getinfobyid(options.id);
  126. },
  127. });