diff --git a/miniprogram/app.js b/miniprogram/app.js index a737c8b..c10326f 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,10 @@ // this.globalData = {} }, globalData: { - // httpsUrl: "https://logapi.smartlog.work/", // 正式域名 + httpsUrl: "https://logapi.smartlog.work/", // 正式域名 // httpsUrl: "http://111.198.10.15:11638/", // 15 - httpsUrl: "https://grey.logapi.smartlog.work/", // 测试域名 + // httpsUrl: "http://192.168.126.39:5905/", // 周甜 + // httpsUrl: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/app.js b/miniprogram/app.js index a737c8b..c10326f 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,10 @@ // this.globalData = {} }, globalData: { - // httpsUrl: "https://logapi.smartlog.work/", // 正式域名 + httpsUrl: "https://logapi.smartlog.work/", // 正式域名 // httpsUrl: "http://111.198.10.15:11638/", // 15 - httpsUrl: "https://grey.logapi.smartlog.work/", // 测试域名 + // httpsUrl: "http://192.168.126.39:5905/", // 周甜 + // httpsUrl: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/images/purple-marker.png b/miniprogram/images/purple-marker.png new file mode 100644 index 0000000..ce83eb7 --- /dev/null +++ b/miniprogram/images/purple-marker.png Binary files differ diff --git a/miniprogram/app.js b/miniprogram/app.js index a737c8b..c10326f 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,10 @@ // this.globalData = {} }, globalData: { - // httpsUrl: "https://logapi.smartlog.work/", // 正式域名 + httpsUrl: "https://logapi.smartlog.work/", // 正式域名 // httpsUrl: "http://111.198.10.15:11638/", // 15 - httpsUrl: "https://grey.logapi.smartlog.work/", // 测试域名 + // httpsUrl: "http://192.168.126.39:5905/", // 周甜 + // httpsUrl: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/images/purple-marker.png b/miniprogram/images/purple-marker.png new file mode 100644 index 0000000..ce83eb7 --- /dev/null +++ b/miniprogram/images/purple-marker.png Binary files differ diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index 155167f..d3ac276 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -77,6 +77,7 @@ defaultText: '请输入内容', defaultTitieText: '请输入内容', showPopupSelect: false, // 井类型选择器 + showLocation: true, // 是否显示定位 }, preventDefault(e) { @@ -144,11 +145,11 @@ longitude: listResultData[0].lngGaode }); } - } else { // 显示周围100米井 + } else { // 显示周围30米井 that.locateCurrentPosition() } // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) - // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); + // console.log('获取当前人的定位周围30米的数据',tempList.length, tempList); // that.initManholeData(tempList) } else { @@ -215,10 +216,12 @@ getMarkerIcon(status, wellType) { // 地图上 橙红色:井打不开2,黄色 :已安装,蓝色1:未安装0 - console.log('获取到的icon类型', status, wellType); - if(wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') { + if((wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') && status !== '3' && status !== '4' && status !== '5') { return '/images/gray-marker.png' - } else{ + } else if((wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') && (status === '3' || status === '4' || status === '5')) { + return '/images/purple-marker.png' + } + else{ switch(status) { case '0': return '/images/blue-marker.png'; case '1': return '/images/yellow-marker.png'; @@ -294,6 +297,66 @@ } }) }, + // 编辑雨-污-燃井 + updateWellType() { + var that = this + wx.showActionSheet({ + itemList: ['雨水井', '污水井', '燃气井'], + success: (res) => { + if (!res.cancel) { + const types = [{label: '雨水井', value: '3'}, {label: '污水井', value: '4'}, {label: '燃气井', value: '5'}]; + const paramstypes = types[res.tapIndex].value + const paramstitle = types[res.tapIndex].label + wx.showModal({ + content: `确定修改为${paramstitle}吗?`, + success: function (res) { + if (res.confirm) { + if(wellList.length) { + const index = wellList.findIndex(item => item.wellCode === that.data.activeMarkerWellCode) + if(index !== -1) { + wellList[index].isInStall = paramstypes + wellList[index].wellType = paramstitle + that.initManholeData(wellList) + } + } + wx.request({ + method: "post", + url: app.globalData.httpsUrl + "/appDeviceAdd/markerWell", + data: { + wellCode: that.data.activeMarker.manholeInfo.wellCode, + isInStall: paramstypes + }, + header: { + 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + }, + success(res) { + }, + fail(err) { + wx.showToast({ + title: "修改井类型失败", + icon: 'none', + duration: 2000 + }) + } + }) + } else { //这里是点击了取消以后 + console.log('用户点击取消') + } + } + }) + } + } + }); + }, + + // 显隐定位 + clickShowLocation() { + var that = this + const showLocation = !that.data.showLocation; + that.setData({ + showLocation + }); + }, // 点击标记点 onMarkerTap(e) { // ========================================================= @@ -428,6 +491,7 @@ break; } }, + // --------------------------------popup相关方法-------------------------------------------- // 打开popup showPopup() { @@ -538,10 +602,10 @@ * @param {Array} points - 点位数组(每条数据需包含 latGaode 和 lngGaode 字段) * @param {number} userLat - 用户当前纬度 * @param {number} userLng - 用户当前经度 - * @param {number} radius - 筛选半径(单位:米,默认 100 米) + * @param {number} radius - 筛选半径(单位:米,默认 30 米) * @returns {Array} 符合条件的点位数组 */ - filterNearbyPoints(points, userLat, userLng, radius = 100) { + filterNearbyPoints(points, userLat, userLng, radius = 30) { if (!points || !points.length || !userLat || !userLng) { return []; // 校验参数合法性 } @@ -605,7 +669,7 @@ if(wellList.length) { // const tempList = that.filterNearbyPoints(wellList, '39.908599446615', '116.391914605035') const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude), parseFloat(res.longitude)) - console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); + console.log('获取当前人的定位周围30米的数据',tempList.length, tempList); if(tempList.length) { that.initManholeData(tempList) mapCtx.moveToLocation({ @@ -617,7 +681,7 @@ }); } else { wx.showToast({ - title: "当前位置周围100米无闸井", + title: "当前位置周围30米无闸井", icon: 'none', duration: 3000 }) diff --git a/miniprogram/app.js b/miniprogram/app.js index a737c8b..c10326f 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,10 @@ // this.globalData = {} }, globalData: { - // httpsUrl: "https://logapi.smartlog.work/", // 正式域名 + httpsUrl: "https://logapi.smartlog.work/", // 正式域名 // httpsUrl: "http://111.198.10.15:11638/", // 15 - httpsUrl: "https://grey.logapi.smartlog.work/", // 测试域名 + // httpsUrl: "http://192.168.126.39:5905/", // 周甜 + // httpsUrl: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/images/purple-marker.png b/miniprogram/images/purple-marker.png new file mode 100644 index 0000000..ce83eb7 --- /dev/null +++ b/miniprogram/images/purple-marker.png Binary files differ diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index 155167f..d3ac276 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -77,6 +77,7 @@ defaultText: '请输入内容', defaultTitieText: '请输入内容', showPopupSelect: false, // 井类型选择器 + showLocation: true, // 是否显示定位 }, preventDefault(e) { @@ -144,11 +145,11 @@ longitude: listResultData[0].lngGaode }); } - } else { // 显示周围100米井 + } else { // 显示周围30米井 that.locateCurrentPosition() } // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) - // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); + // console.log('获取当前人的定位周围30米的数据',tempList.length, tempList); // that.initManholeData(tempList) } else { @@ -215,10 +216,12 @@ getMarkerIcon(status, wellType) { // 地图上 橙红色:井打不开2,黄色 :已安装,蓝色1:未安装0 - console.log('获取到的icon类型', status, wellType); - if(wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') { + if((wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') && status !== '3' && status !== '4' && status !== '5') { return '/images/gray-marker.png' - } else{ + } else if((wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') && (status === '3' || status === '4' || status === '5')) { + return '/images/purple-marker.png' + } + else{ switch(status) { case '0': return '/images/blue-marker.png'; case '1': return '/images/yellow-marker.png'; @@ -294,6 +297,66 @@ } }) }, + // 编辑雨-污-燃井 + updateWellType() { + var that = this + wx.showActionSheet({ + itemList: ['雨水井', '污水井', '燃气井'], + success: (res) => { + if (!res.cancel) { + const types = [{label: '雨水井', value: '3'}, {label: '污水井', value: '4'}, {label: '燃气井', value: '5'}]; + const paramstypes = types[res.tapIndex].value + const paramstitle = types[res.tapIndex].label + wx.showModal({ + content: `确定修改为${paramstitle}吗?`, + success: function (res) { + if (res.confirm) { + if(wellList.length) { + const index = wellList.findIndex(item => item.wellCode === that.data.activeMarkerWellCode) + if(index !== -1) { + wellList[index].isInStall = paramstypes + wellList[index].wellType = paramstitle + that.initManholeData(wellList) + } + } + wx.request({ + method: "post", + url: app.globalData.httpsUrl + "/appDeviceAdd/markerWell", + data: { + wellCode: that.data.activeMarker.manholeInfo.wellCode, + isInStall: paramstypes + }, + header: { + 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + }, + success(res) { + }, + fail(err) { + wx.showToast({ + title: "修改井类型失败", + icon: 'none', + duration: 2000 + }) + } + }) + } else { //这里是点击了取消以后 + console.log('用户点击取消') + } + } + }) + } + } + }); + }, + + // 显隐定位 + clickShowLocation() { + var that = this + const showLocation = !that.data.showLocation; + that.setData({ + showLocation + }); + }, // 点击标记点 onMarkerTap(e) { // ========================================================= @@ -428,6 +491,7 @@ break; } }, + // --------------------------------popup相关方法-------------------------------------------- // 打开popup showPopup() { @@ -538,10 +602,10 @@ * @param {Array} points - 点位数组(每条数据需包含 latGaode 和 lngGaode 字段) * @param {number} userLat - 用户当前纬度 * @param {number} userLng - 用户当前经度 - * @param {number} radius - 筛选半径(单位:米,默认 100 米) + * @param {number} radius - 筛选半径(单位:米,默认 30 米) * @returns {Array} 符合条件的点位数组 */ - filterNearbyPoints(points, userLat, userLng, radius = 100) { + filterNearbyPoints(points, userLat, userLng, radius = 30) { if (!points || !points.length || !userLat || !userLng) { return []; // 校验参数合法性 } @@ -605,7 +669,7 @@ if(wellList.length) { // const tempList = that.filterNearbyPoints(wellList, '39.908599446615', '116.391914605035') const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude), parseFloat(res.longitude)) - console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); + console.log('获取当前人的定位周围30米的数据',tempList.length, tempList); if(tempList.length) { that.initManholeData(tempList) mapCtx.moveToLocation({ @@ -617,7 +681,7 @@ }); } else { wx.showToast({ - title: "当前位置周围100米无闸井", + title: "当前位置周围30米无闸井", icon: 'none', duration: 3000 }) diff --git a/miniprogram/pages/defineMap/defineMap.wxml b/miniprogram/pages/defineMap/defineMap.wxml index 500eacb..17027c4 100644 --- a/miniprogram/pages/defineMap/defineMap.wxml +++ b/miniprogram/pages/defineMap/defineMap.wxml @@ -4,7 +4,7 @@ latitude="{{latitude}}" scale="{{scale}}" markers="{{markers}}" - show-location + show-location="{{showLocation}}" bindmarkertap="onMarkerTap" style="width: 100%; height: 100vh;"> @@ -26,6 +26,13 @@ + + @@ -41,6 +48,11 @@ 井打不开 + @@ -41,6 +48,11 @@ 井打不开 + @@ -41,6 +48,11 @@ 井打不开 +