// greenland/pages/inspectionHuatan/inspectionHuatanDeatil/inspectionHuatanDeatil.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { allData: {}, // 拍照点位 markers: [], longitude: '', latitude: '', }, scrolltoupper() {}, // 获取数据 getinfobyid(id) { app.loading(); let url = app.globalData.httpsUrlServer + '/lhgyWork/selectPatrolTrackById'; let data = { id: id, }; app.postReq(url, data, (res) => { console.log(res); if (res.status == 200) { this.setData({ allData: res.data, }); // 渲染 拍照点位 let arr = []; if (this.data.allData.fileListResponse.length > 0) { this.data.allData.fileListResponse.forEach((v, i) => { if (!v.number3) { let obj = { latitude: v.fileList[0].fileCoordinates.split(',')[0], longitude: v.fileList[0].fileCoordinates.split(',')[1], width: 20, height: 20, iconPath: '../../../../images/icon/wz.png', id: 1, }; arr.push(obj); } else { // 没有问题的 点位 let obj = { latitude: v.fileList[0].fileCoordinates.split(',')[0], longitude: v.fileList[0].fileCoordinates.split(',')[1], width: 30, height: 50, iconPath: '../../../../images/icon/wzStar.png', id: 2, }; arr.push(obj); } }); } console.log(arr); this.setData({ markers: arr, }); app.hideloading(); } }); }, //去点位详情页 jumpDetails(e) { let url = e.currentTarget.dataset.url; let remark = e.currentTarget.dataset.remark; let images = JSON.stringify(e.currentTarget.dataset.images); wx.navigateTo({ url: // "/packageA/pages/historicalTrackDetailMap/historicalTrackDetailMap?url=" + '../inspectionHuatanDeatilMap/inspectionHuatanDeatilMap?url=' + url + '&dates=' + this.data.stringsArr + '&remark=' + remark + '&images=' + images, }); }, // 预览图片 viewMoviePostImg(e) { var src = e.currentTarget.dataset.src; wx.previewImage({ current: src, // 当前显示图片的http链接 urls: [src], // 需要预览的图片http链接列表 }); }, // 去工地那也 formDtealis(e) { let id = this.data.allData.fileListResponse[e.currentTarget.dataset.index] .fileList[0].number3; console.log(id); // orderId=2740&stateid=1&seatId=0&deptType=2&typeFlag=3 // app.globalData.orderType = 0 // app.globalData.orderState = 0 wx.navigateTo({ url: `/greenland/pages/greenOrderDetails/greenOrderDetails?orderId=${id}&deptType=2`, }); }, onLoad: function (options) { var that = this; wx.getLocation({ type: 'wgs84', success: function (res) { var latitude = res.latitude; var longitude = res.longitude; //console.log(res.latitude); that.setData({ latitude: res.latitude, longitude: res.longitude, markers: [ { latitude: res.latitude, longitude: res.longitude, }, ], }); }, }); this.setData({ infoId: options.id, }); this.getinfobyid(options.id); }, });