diff --git a/miniprogram/images/limit.png b/miniprogram/images/limit.png new file mode 100644 index 0000000..d07cf18 --- /dev/null +++ b/miniprogram/images/limit.png Binary files differ diff --git a/miniprogram/images/limit.png b/miniprogram/images/limit.png new file mode 100644 index 0000000..d07cf18 --- /dev/null +++ b/miniprogram/images/limit.png Binary files differ diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index b6f443d..d3a77a0 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -10,7 +10,7 @@ - + diff --git a/miniprogram/images/limit.png b/miniprogram/images/limit.png new file mode 100644 index 0000000..d07cf18 --- /dev/null +++ b/miniprogram/images/limit.png Binary files differ diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index b6f443d..d3a77a0 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -10,7 +10,7 @@ - + diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index d3ac276..651c287 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -78,6 +78,7 @@ defaultTitieText: '请输入内容', showPopupSelect: false, // 井类型选择器 showLocation: true, // 是否显示定位 + limitData: 30, // 查询的范围 }, preventDefault(e) { @@ -115,6 +116,38 @@ refresh() { this.fetchManhole(this.data.listQuery, 'refresh'); }, + // 点击筛选井范围 + chooseLimit() { + var that = this + wx.showActionSheet({ + alertText: "筛选周围井的范围", + itemList: ['3米', '5米', '10米', '30米', '100米'], + success: (res) => { + if (!res.cancel) { + that.setData({ + activeMarker: null, + activeMarkerWellCode: null, + activeMarkerId: null, + }); + const types = [{label: '3米', value: 3}, {label: '5米', value: 5}, {label: '10米', value: 10}, {label: '30米', value: 30}, {label: '100米', value: 100}]; + const paramsValue = types[res.tapIndex].value + const paramsTitle = types[res.tapIndex].label + that.setData({ + 'limitData': paramsValue + }) + that.setData({ + listQuery: { // 查询井列表的参数 + wellCode: '', // 井编号 + position: '', // 按位置 + wellType: '', // 井类型 + isInStall: '', // 井状态 + }, + }) + that.fetchManhole(that.data.listQuery); + } + } + }); + }, // 获取井 fetchManhole(params, type = '') { @@ -145,11 +178,11 @@ longitude: listResultData[0].lngGaode }); } - } else { // 显示周围30米井 - that.locateCurrentPosition() - } + } else { // 显示周围${thst.data.limitData}米井 + that.locateCurrentPosition() + } // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) - // console.log('获取当前人的定位周围30米的数据',tempList.length, tempList); + // console.log('获取当前人的定位周围${thst.data.limitData}米的数据',tempList.length, tempList); // that.initManholeData(tempList) } else { @@ -606,6 +639,7 @@ * @returns {Array} 符合条件的点位数组 */ filterNearbyPoints(points, userLat, userLng, radius = 30) { + console.log('筛选井范围: 米', radius) if (!points || !points.length || !userLat || !userLng) { return []; // 校验参数合法性 } @@ -668,8 +702,8 @@ wx.hideLoading() 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('获取当前人的定位周围30米的数据',tempList.length, tempList); + const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude), parseFloat(res.longitude), that.data.limitData) + console.log(`获取当前人的定位周围${that.data.limitData}米的数据`,tempList.length, tempList); if(tempList.length) { that.initManholeData(tempList) mapCtx.moveToLocation({ @@ -681,7 +715,7 @@ }); } else { wx.showToast({ - title: "当前位置周围30米无闸井", + title: `当前位置周围${that.data.limitData}米无闸井`, icon: 'none', duration: 3000 }) diff --git a/miniprogram/images/limit.png b/miniprogram/images/limit.png new file mode 100644 index 0000000..d07cf18 --- /dev/null +++ b/miniprogram/images/limit.png Binary files differ diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index b6f443d..d3a77a0 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -10,7 +10,7 @@ - + diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index d3ac276..651c287 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -78,6 +78,7 @@ defaultTitieText: '请输入内容', showPopupSelect: false, // 井类型选择器 showLocation: true, // 是否显示定位 + limitData: 30, // 查询的范围 }, preventDefault(e) { @@ -115,6 +116,38 @@ refresh() { this.fetchManhole(this.data.listQuery, 'refresh'); }, + // 点击筛选井范围 + chooseLimit() { + var that = this + wx.showActionSheet({ + alertText: "筛选周围井的范围", + itemList: ['3米', '5米', '10米', '30米', '100米'], + success: (res) => { + if (!res.cancel) { + that.setData({ + activeMarker: null, + activeMarkerWellCode: null, + activeMarkerId: null, + }); + const types = [{label: '3米', value: 3}, {label: '5米', value: 5}, {label: '10米', value: 10}, {label: '30米', value: 30}, {label: '100米', value: 100}]; + const paramsValue = types[res.tapIndex].value + const paramsTitle = types[res.tapIndex].label + that.setData({ + 'limitData': paramsValue + }) + that.setData({ + listQuery: { // 查询井列表的参数 + wellCode: '', // 井编号 + position: '', // 按位置 + wellType: '', // 井类型 + isInStall: '', // 井状态 + }, + }) + that.fetchManhole(that.data.listQuery); + } + } + }); + }, // 获取井 fetchManhole(params, type = '') { @@ -145,11 +178,11 @@ longitude: listResultData[0].lngGaode }); } - } else { // 显示周围30米井 - that.locateCurrentPosition() - } + } else { // 显示周围${thst.data.limitData}米井 + that.locateCurrentPosition() + } // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) - // console.log('获取当前人的定位周围30米的数据',tempList.length, tempList); + // console.log('获取当前人的定位周围${thst.data.limitData}米的数据',tempList.length, tempList); // that.initManholeData(tempList) } else { @@ -606,6 +639,7 @@ * @returns {Array} 符合条件的点位数组 */ filterNearbyPoints(points, userLat, userLng, radius = 30) { + console.log('筛选井范围: 米', radius) if (!points || !points.length || !userLat || !userLng) { return []; // 校验参数合法性 } @@ -668,8 +702,8 @@ wx.hideLoading() 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('获取当前人的定位周围30米的数据',tempList.length, tempList); + const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude), parseFloat(res.longitude), that.data.limitData) + console.log(`获取当前人的定位周围${that.data.limitData}米的数据`,tempList.length, tempList); if(tempList.length) { that.initManholeData(tempList) mapCtx.moveToLocation({ @@ -681,7 +715,7 @@ }); } else { wx.showToast({ - title: "当前位置周围30米无闸井", + title: `当前位置周围${that.data.limitData}米无闸井`, icon: 'none', duration: 3000 }) diff --git a/miniprogram/pages/defineMap/defineMap.wxml b/miniprogram/pages/defineMap/defineMap.wxml index 17027c4..b7d1db5 100644 --- a/miniprogram/pages/defineMap/defineMap.wxml +++ b/miniprogram/pages/defineMap/defineMap.wxml @@ -26,6 +26,10 @@ + + + {{limitData}}米 +