diff --git a/miniprogram/app.js b/miniprogram/app.js index 4da07f8..a737c8b 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,9 @@ // 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: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/app.js b/miniprogram/app.js index 4da07f8..a737c8b 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,9 @@ // 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: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/images/gray-marker.png b/miniprogram/images/gray-marker.png new file mode 100644 index 0000000..ab8f593 --- /dev/null +++ b/miniprogram/images/gray-marker.png Binary files differ diff --git a/miniprogram/app.js b/miniprogram/app.js index 4da07f8..a737c8b 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,9 @@ // 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: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/images/gray-marker.png b/miniprogram/images/gray-marker.png new file mode 100644 index 0000000..ab8f593 --- /dev/null +++ b/miniprogram/images/gray-marker.png Binary files differ diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index 500a1d7..155167f 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -1,3 +1,4 @@ +import Toast from '@vant/weapp/toast/toast'; var app = getApp(); const wellTypes = [ {label: '雨水井', value: '1'}, @@ -133,21 +134,35 @@ if (res.data.code == 200) { const listResultData = res.data.data; wellList = listResultData - if(type === 'all' || type === 'cannotOpen' || type === 'refresh') { // 查看所有井 - that.initManholeData(listResultData) - if(listResultData.length && type !== 'refresh') { - const mapCtx = wx.createMapContext('map'); - mapCtx.moveToLocation({ - latitude: listResultData[0].latGaode, - longitude: listResultData[0].lngGaode - }); - } - } else { // 显示周围100米井 - that.locateCurrentPosition() + if(listResultData.length) { + if(type === 'all' || type === 'cannotOpen' || type === 'refresh') { // 查看所有井 + that.initManholeData(listResultData) + if(listResultData.length && type !== 'refresh') { + const mapCtx = wx.createMapContext('map'); + mapCtx.moveToLocation({ + latitude: listResultData[0].latGaode, + longitude: listResultData[0].lngGaode + }); + } + } else { // 显示周围100米井 + that.locateCurrentPosition() + } + // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) + // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); + // that.initManholeData(tempList) + } + else { + console.log('查询不到数据'); + wx.hideLoading() + // wx.showToast({ + // title: "未查询到数据", + // icon: 'none', + // duration: 2000, + // mask: true, // 避免与其他 mask 组件同时显示 + // }) + // } + Toast.fail('未查询到数据'); } - // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) - // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); - // that.initManholeData(tempList) } wx.hideLoading() }, @@ -171,9 +186,9 @@ id: index, longitude: manhole.lngGaode, latitude: manhole.latGaode, - iconPath: that.getMarkerIcon(manhole.isInStall), - width: 30, - height: 30, + iconPath: that.getMarkerIcon(manhole.isInStall, manhole.wellType), + width: 16, + height: 16, zIndex: 0, callout: { content: that.getCalloutContent(manhole), @@ -198,14 +213,18 @@ wx.hideLoading() }, - getMarkerIcon(status) { + getMarkerIcon(status, wellType) { // 地图上 橙红色:井打不开2,黄色 :已安装,蓝色1:未安装0 - console.log('获取到的icon类型', status); - switch(status) { - case '0': return '/images/blue-marker.png'; - case '1': return '/images/yellow-marker.png'; - case '2': return '/images/orange-marker.png'; - default: return '/images/default-marker.png'; + console.log('获取到的icon类型', status, wellType); + if(wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') { + return '/images/gray-marker.png' + } else{ + switch(status) { + case '0': return '/images/blue-marker.png'; + case '1': return '/images/yellow-marker.png'; + case '2': return '/images/orange-marker.png'; + default: return '/images/default-marker.png'; + } } }, diff --git a/miniprogram/app.js b/miniprogram/app.js index 4da07f8..a737c8b 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,9 @@ // 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: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/images/gray-marker.png b/miniprogram/images/gray-marker.png new file mode 100644 index 0000000..ab8f593 --- /dev/null +++ b/miniprogram/images/gray-marker.png Binary files differ diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index 500a1d7..155167f 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -1,3 +1,4 @@ +import Toast from '@vant/weapp/toast/toast'; var app = getApp(); const wellTypes = [ {label: '雨水井', value: '1'}, @@ -133,21 +134,35 @@ if (res.data.code == 200) { const listResultData = res.data.data; wellList = listResultData - if(type === 'all' || type === 'cannotOpen' || type === 'refresh') { // 查看所有井 - that.initManholeData(listResultData) - if(listResultData.length && type !== 'refresh') { - const mapCtx = wx.createMapContext('map'); - mapCtx.moveToLocation({ - latitude: listResultData[0].latGaode, - longitude: listResultData[0].lngGaode - }); - } - } else { // 显示周围100米井 - that.locateCurrentPosition() + if(listResultData.length) { + if(type === 'all' || type === 'cannotOpen' || type === 'refresh') { // 查看所有井 + that.initManholeData(listResultData) + if(listResultData.length && type !== 'refresh') { + const mapCtx = wx.createMapContext('map'); + mapCtx.moveToLocation({ + latitude: listResultData[0].latGaode, + longitude: listResultData[0].lngGaode + }); + } + } else { // 显示周围100米井 + that.locateCurrentPosition() + } + // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) + // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); + // that.initManholeData(tempList) + } + else { + console.log('查询不到数据'); + wx.hideLoading() + // wx.showToast({ + // title: "未查询到数据", + // icon: 'none', + // duration: 2000, + // mask: true, // 避免与其他 mask 组件同时显示 + // }) + // } + Toast.fail('未查询到数据'); } - // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) - // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); - // that.initManholeData(tempList) } wx.hideLoading() }, @@ -171,9 +186,9 @@ id: index, longitude: manhole.lngGaode, latitude: manhole.latGaode, - iconPath: that.getMarkerIcon(manhole.isInStall), - width: 30, - height: 30, + iconPath: that.getMarkerIcon(manhole.isInStall, manhole.wellType), + width: 16, + height: 16, zIndex: 0, callout: { content: that.getCalloutContent(manhole), @@ -198,14 +213,18 @@ wx.hideLoading() }, - getMarkerIcon(status) { + getMarkerIcon(status, wellType) { // 地图上 橙红色:井打不开2,黄色 :已安装,蓝色1:未安装0 - console.log('获取到的icon类型', status); - switch(status) { - case '0': return '/images/blue-marker.png'; - case '1': return '/images/yellow-marker.png'; - case '2': return '/images/orange-marker.png'; - default: return '/images/default-marker.png'; + console.log('获取到的icon类型', status, wellType); + if(wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') { + return '/images/gray-marker.png' + } else{ + switch(status) { + case '0': return '/images/blue-marker.png'; + case '1': return '/images/yellow-marker.png'; + case '2': return '/images/orange-marker.png'; + default: return '/images/default-marker.png'; + } } }, diff --git a/miniprogram/pages/defineMap/defineMap.json b/miniprogram/pages/defineMap/defineMap.json index 0a5371d..29cc54f 100644 --- a/miniprogram/pages/defineMap/defineMap.json +++ b/miniprogram/pages/defineMap/defineMap.json @@ -5,7 +5,8 @@ "van-search": "../../miniprogram_npm/@vant/weapp/search", "van-button": "../../miniprogram_npm/@vant/weapp/button/index", "popup": "@vant/weapp/popup/index", - "van-picker": "@vant/weapp/picker/index" + "van-picker": "@vant/weapp/picker/index", + "van-toast": "@vant/weapp/toast/index" }, "navigationBarTitleText": "地图" } diff --git a/miniprogram/app.js b/miniprogram/app.js index 4da07f8..a737c8b 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,9 +18,9 @@ // 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: "https://grey.logapi.smartlog.work/", // 测试域名 openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/images/gray-marker.png b/miniprogram/images/gray-marker.png new file mode 100644 index 0000000..ab8f593 --- /dev/null +++ b/miniprogram/images/gray-marker.png Binary files differ diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index 500a1d7..155167f 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -1,3 +1,4 @@ +import Toast from '@vant/weapp/toast/toast'; var app = getApp(); const wellTypes = [ {label: '雨水井', value: '1'}, @@ -133,21 +134,35 @@ if (res.data.code == 200) { const listResultData = res.data.data; wellList = listResultData - if(type === 'all' || type === 'cannotOpen' || type === 'refresh') { // 查看所有井 - that.initManholeData(listResultData) - if(listResultData.length && type !== 'refresh') { - const mapCtx = wx.createMapContext('map'); - mapCtx.moveToLocation({ - latitude: listResultData[0].latGaode, - longitude: listResultData[0].lngGaode - }); - } - } else { // 显示周围100米井 - that.locateCurrentPosition() + if(listResultData.length) { + if(type === 'all' || type === 'cannotOpen' || type === 'refresh') { // 查看所有井 + that.initManholeData(listResultData) + if(listResultData.length && type !== 'refresh') { + const mapCtx = wx.createMapContext('map'); + mapCtx.moveToLocation({ + latitude: listResultData[0].latGaode, + longitude: listResultData[0].lngGaode + }); + } + } else { // 显示周围100米井 + that.locateCurrentPosition() + } + // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) + // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); + // that.initManholeData(tempList) + } + else { + console.log('查询不到数据'); + wx.hideLoading() + // wx.showToast({ + // title: "未查询到数据", + // icon: 'none', + // duration: 2000, + // mask: true, // 避免与其他 mask 组件同时显示 + // }) + // } + Toast.fail('未查询到数据'); } - // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941) - // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList); - // that.initManholeData(tempList) } wx.hideLoading() }, @@ -171,9 +186,9 @@ id: index, longitude: manhole.lngGaode, latitude: manhole.latGaode, - iconPath: that.getMarkerIcon(manhole.isInStall), - width: 30, - height: 30, + iconPath: that.getMarkerIcon(manhole.isInStall, manhole.wellType), + width: 16, + height: 16, zIndex: 0, callout: { content: that.getCalloutContent(manhole), @@ -198,14 +213,18 @@ wx.hideLoading() }, - getMarkerIcon(status) { + getMarkerIcon(status, wellType) { // 地图上 橙红色:井打不开2,黄色 :已安装,蓝色1:未安装0 - console.log('获取到的icon类型', status); - switch(status) { - case '0': return '/images/blue-marker.png'; - case '1': return '/images/yellow-marker.png'; - case '2': return '/images/orange-marker.png'; - default: return '/images/default-marker.png'; + console.log('获取到的icon类型', status, wellType); + if(wellType === '燃气井' || wellType === '雨水井' || wellType === '污水井') { + return '/images/gray-marker.png' + } else{ + switch(status) { + case '0': return '/images/blue-marker.png'; + case '1': return '/images/yellow-marker.png'; + case '2': return '/images/orange-marker.png'; + default: return '/images/default-marker.png'; + } } }, diff --git a/miniprogram/pages/defineMap/defineMap.json b/miniprogram/pages/defineMap/defineMap.json index 0a5371d..29cc54f 100644 --- a/miniprogram/pages/defineMap/defineMap.json +++ b/miniprogram/pages/defineMap/defineMap.json @@ -5,7 +5,8 @@ "van-search": "../../miniprogram_npm/@vant/weapp/search", "van-button": "../../miniprogram_npm/@vant/weapp/button/index", "popup": "@vant/weapp/popup/index", - "van-picker": "@vant/weapp/picker/index" + "van-picker": "@vant/weapp/picker/index", + "van-toast": "@vant/weapp/toast/index" }, "navigationBarTitleText": "地图" } diff --git a/miniprogram/pages/defineMap/defineMap.wxml b/miniprogram/pages/defineMap/defineMap.wxml index c0fad34..500eacb 100644 --- a/miniprogram/pages/defineMap/defineMap.wxml +++ b/miniprogram/pages/defineMap/defineMap.wxml @@ -41,7 +41,7 @@ 井打不开 -