diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/addNew.png b/miniprogram/images/addNew.png
new file mode 100644
index 0000000..654768e
--- /dev/null
+++ b/miniprogram/images/addNew.png
Binary files differ
diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/addNew.png b/miniprogram/images/addNew.png
new file mode 100644
index 0000000..654768e
--- /dev/null
+++ b/miniprogram/images/addNew.png
Binary files differ
diff --git a/miniprogram/images/minusNew.png b/miniprogram/images/minusNew.png
new file mode 100644
index 0000000..6db0fe7
--- /dev/null
+++ b/miniprogram/images/minusNew.png
Binary files differ
diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/addNew.png b/miniprogram/images/addNew.png
new file mode 100644
index 0000000..654768e
--- /dev/null
+++ b/miniprogram/images/addNew.png
Binary files differ
diff --git a/miniprogram/images/minusNew.png b/miniprogram/images/minusNew.png
new file mode 100644
index 0000000..6db0fe7
--- /dev/null
+++ b/miniprogram/images/minusNew.png
Binary files differ
diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js
index f5dc595..29424a6 100644
--- a/miniprogram/pages/addDevice/addDevice.js
+++ b/miniprogram/pages/addDevice/addDevice.js
@@ -351,7 +351,7 @@
'form.wellType': options.wellType, // 井类型
'form.wellcode': options.wellCode, // 井编号
'form.position': options.position, // 位置
- 'form.devicetype': '1', // 设备类型
+ 'form.devicetype': '井盖状态监测仪', // 设备类型
'form.latitude': parseFloat(options.latitude).toFixed(6),
'form.longitude': parseFloat(options.longitude).toFixed(6),
latitude: parseFloat(options.latitude).toFixed(6),
@@ -678,13 +678,17 @@
wx.showModal({
content: '提交成功,是否返回?',
success: function (res) {
- //用于回显
- wx.setStorageSync('cacheList', that.data.form)
+ console.log('用户点击了返回')
+ //用于回显
+ console.log('lll', that.data.form);
+ wx.setStorageSync('cacheList', that.data.form)
//提交成功后提示用户操作
if (res.confirm) {
// wx.switchTab({
// url: '../earth/earth'
// })
+ console.log('lleeel', that.data.form);
+ app.globalData.addsuccessWellCode = that.data.form.wellcode
wx.navigateBack({ // 返回上一页
delta: 1
});
diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/addNew.png b/miniprogram/images/addNew.png
new file mode 100644
index 0000000..654768e
--- /dev/null
+++ b/miniprogram/images/addNew.png
Binary files differ
diff --git a/miniprogram/images/minusNew.png b/miniprogram/images/minusNew.png
new file mode 100644
index 0000000..6db0fe7
--- /dev/null
+++ b/miniprogram/images/minusNew.png
Binary files differ
diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js
index f5dc595..29424a6 100644
--- a/miniprogram/pages/addDevice/addDevice.js
+++ b/miniprogram/pages/addDevice/addDevice.js
@@ -351,7 +351,7 @@
'form.wellType': options.wellType, // 井类型
'form.wellcode': options.wellCode, // 井编号
'form.position': options.position, // 位置
- 'form.devicetype': '1', // 设备类型
+ 'form.devicetype': '井盖状态监测仪', // 设备类型
'form.latitude': parseFloat(options.latitude).toFixed(6),
'form.longitude': parseFloat(options.longitude).toFixed(6),
latitude: parseFloat(options.latitude).toFixed(6),
@@ -678,13 +678,17 @@
wx.showModal({
content: '提交成功,是否返回?',
success: function (res) {
- //用于回显
- wx.setStorageSync('cacheList', that.data.form)
+ console.log('用户点击了返回')
+ //用于回显
+ console.log('lll', that.data.form);
+ wx.setStorageSync('cacheList', that.data.form)
//提交成功后提示用户操作
if (res.confirm) {
// wx.switchTab({
// url: '../earth/earth'
// })
+ console.log('lleeel', that.data.form);
+ app.globalData.addsuccessWellCode = that.data.form.wellcode
wx.navigateBack({ // 返回上一页
delta: 1
});
diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js
index a224eda..193041b 100644
--- a/miniprogram/pages/defineMap/defineMap.js
+++ b/miniprogram/pages/defineMap/defineMap.js
@@ -18,9 +18,10 @@
{label: '消防井', value: '16'},
{label: '监控井', value: '17'},
]
+let wellList = []
Page({
data: {
- wellTypeList: [
+ wellTypeList: [
'雨水井',
'污水井',
'燃气井',
@@ -39,8 +40,8 @@
'消防井',
'监控井'
],
- longitude: 116.397228,
- latitude: 39.907501,
+ longitude: "116.627340",
+ latitude: "39.874390",
scale: 14,
minScale: 2,
maxScale: 22,
@@ -49,7 +50,7 @@
activeMarker: null,
showActionSheet: false,
filterOptions: [
- { name: '查看所有', type: 'all' },
+ { name: '查看全部井', type: 'all' },
{ name: '按位置', type: 'location' },
{ name: '按井编号', type: 'wellCode' },
{ name: '按井类型', type: 'wellType' },
@@ -62,6 +63,10 @@
wellType: '', // 井类型
isInStall: '', // 井状态
},
+ position7: {
+ left: '46%',
+ top: '46%',
+ },
// -----------------------弹出框--------------------
showPopup: false,
popupType: '',
@@ -72,16 +77,31 @@
},
onLoad() {
- this.fetchManhole({ // 查询井列表的参数
- wellCode: '', // 井编号
- position: '', // 按位置
- wellType: '', // 井类型
- isInStall: '0', // 井状态
- });
+ if(!app.globalData.addsuccessWellCode) {
+ this.fetchManhole({ // 查询井列表的参数
+ wellCode: '', // 井编号
+ position: '', // 按位置
+ wellType: '', // 井类型
+ isInStall: '', // 井状态
+ });
+ }
+},
+ onShow() {
+ if(app.globalData.addsuccessWellCode && wellList.length) {
+ const index = wellList.findIndex(item => item.wellCode === app.globalData.addsuccessWellCode)
+ if(index !== -1) {
+ wellList[index].isInStall = '1'
+ this.initManholeData(wellList)
+ app.globalData.addsuccessWellCode = ''
+ this.setData({
+ activeMarker: null
+ })
+ }
+ }
},
// 获取井
- fetchManhole(params) {
+ fetchManhole(params, type = '') {
const that = this
console.log('请求井列表', params);
wx.showLoading({
@@ -98,9 +118,15 @@
success(res) {
if (res.data.code == 200) {
const listResultData = res.data.data;
- const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
- console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
- that.initManholeData(tempList)
+ wellList = listResultData
+ if(type === 'all') { // 查看所有井
+ that.initManholeData(listResultData)
+ } else { // 显示周围100米井
+ that.locateCurrentPosition()
+ }
+ // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
+ // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ // that.initManholeData(tempList)
}
wx.hideLoading()
},
@@ -258,7 +284,8 @@
wellCode: '', // 井编号
position: '', // 按位置
wellType: '', // 井类型
- })
+ isInStall: '', // 井状态
+ }, 'all')
break;
case 'location': // 按位置筛选
that.setData({defaultTitieText: '请输入位置', defaultText: '请输入位置', showPopup: true });
@@ -431,6 +458,64 @@
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); // 计算圆心角(弧度)
return R * c; // 返回距离(米)
+ },
+
+ // 点击定位
+ locateCurrentPosition() {
+ var that = this;
+ that.setData({
+ markers: []
+ })
+ //获取当前坐标(gcj02)
+ wx.showLoading({
+ title: '正在定位',
+ mask: true, // 是否显示透明蒙层,防止触摸穿透
+ })
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // latitude: '39.908599446615',
+ // longitude: '116.391914605035',
+ })
+ console.log('获取到当前定位', parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6));
+ // 将地图中心移动到当前定位点
+ const mapCtx = wx.createMapContext('map');
+ mapCtx.moveToLocation();
+ wx.hideLoading()
+ if(wellList.length) {
+ // const tempList = that.filterNearbyPoints(wellList, '39.908599446615', '116.391914605035')
+ const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6))
+ console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ if(tempList.length) {
+ that.initManholeData(tempList)
+ mapCtx.moveToLocation({
+ latitude: tempList[0].latGaode,
+ longitude: tempList[0].lngGaode
+ });
+ } else {
+ wx.showToast({
+ title: "当前位置周围100米无闸井",
+ icon: 'none',
+ duration: 3000
+ })
+ }
+ } else {
+ that.fetchManhole()
+ }
+ },
+ fail(err) {
+ wx.hideLoading()
+ wx.showToast({
+ title: "未获取到当前定位!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/addNew.png b/miniprogram/images/addNew.png
new file mode 100644
index 0000000..654768e
--- /dev/null
+++ b/miniprogram/images/addNew.png
Binary files differ
diff --git a/miniprogram/images/minusNew.png b/miniprogram/images/minusNew.png
new file mode 100644
index 0000000..6db0fe7
--- /dev/null
+++ b/miniprogram/images/minusNew.png
Binary files differ
diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js
index f5dc595..29424a6 100644
--- a/miniprogram/pages/addDevice/addDevice.js
+++ b/miniprogram/pages/addDevice/addDevice.js
@@ -351,7 +351,7 @@
'form.wellType': options.wellType, // 井类型
'form.wellcode': options.wellCode, // 井编号
'form.position': options.position, // 位置
- 'form.devicetype': '1', // 设备类型
+ 'form.devicetype': '井盖状态监测仪', // 设备类型
'form.latitude': parseFloat(options.latitude).toFixed(6),
'form.longitude': parseFloat(options.longitude).toFixed(6),
latitude: parseFloat(options.latitude).toFixed(6),
@@ -678,13 +678,17 @@
wx.showModal({
content: '提交成功,是否返回?',
success: function (res) {
- //用于回显
- wx.setStorageSync('cacheList', that.data.form)
+ console.log('用户点击了返回')
+ //用于回显
+ console.log('lll', that.data.form);
+ wx.setStorageSync('cacheList', that.data.form)
//提交成功后提示用户操作
if (res.confirm) {
// wx.switchTab({
// url: '../earth/earth'
// })
+ console.log('lleeel', that.data.form);
+ app.globalData.addsuccessWellCode = that.data.form.wellcode
wx.navigateBack({ // 返回上一页
delta: 1
});
diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js
index a224eda..193041b 100644
--- a/miniprogram/pages/defineMap/defineMap.js
+++ b/miniprogram/pages/defineMap/defineMap.js
@@ -18,9 +18,10 @@
{label: '消防井', value: '16'},
{label: '监控井', value: '17'},
]
+let wellList = []
Page({
data: {
- wellTypeList: [
+ wellTypeList: [
'雨水井',
'污水井',
'燃气井',
@@ -39,8 +40,8 @@
'消防井',
'监控井'
],
- longitude: 116.397228,
- latitude: 39.907501,
+ longitude: "116.627340",
+ latitude: "39.874390",
scale: 14,
minScale: 2,
maxScale: 22,
@@ -49,7 +50,7 @@
activeMarker: null,
showActionSheet: false,
filterOptions: [
- { name: '查看所有', type: 'all' },
+ { name: '查看全部井', type: 'all' },
{ name: '按位置', type: 'location' },
{ name: '按井编号', type: 'wellCode' },
{ name: '按井类型', type: 'wellType' },
@@ -62,6 +63,10 @@
wellType: '', // 井类型
isInStall: '', // 井状态
},
+ position7: {
+ left: '46%',
+ top: '46%',
+ },
// -----------------------弹出框--------------------
showPopup: false,
popupType: '',
@@ -72,16 +77,31 @@
},
onLoad() {
- this.fetchManhole({ // 查询井列表的参数
- wellCode: '', // 井编号
- position: '', // 按位置
- wellType: '', // 井类型
- isInStall: '0', // 井状态
- });
+ if(!app.globalData.addsuccessWellCode) {
+ this.fetchManhole({ // 查询井列表的参数
+ wellCode: '', // 井编号
+ position: '', // 按位置
+ wellType: '', // 井类型
+ isInStall: '', // 井状态
+ });
+ }
+},
+ onShow() {
+ if(app.globalData.addsuccessWellCode && wellList.length) {
+ const index = wellList.findIndex(item => item.wellCode === app.globalData.addsuccessWellCode)
+ if(index !== -1) {
+ wellList[index].isInStall = '1'
+ this.initManholeData(wellList)
+ app.globalData.addsuccessWellCode = ''
+ this.setData({
+ activeMarker: null
+ })
+ }
+ }
},
// 获取井
- fetchManhole(params) {
+ fetchManhole(params, type = '') {
const that = this
console.log('请求井列表', params);
wx.showLoading({
@@ -98,9 +118,15 @@
success(res) {
if (res.data.code == 200) {
const listResultData = res.data.data;
- const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
- console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
- that.initManholeData(tempList)
+ wellList = listResultData
+ if(type === 'all') { // 查看所有井
+ that.initManholeData(listResultData)
+ } else { // 显示周围100米井
+ that.locateCurrentPosition()
+ }
+ // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
+ // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ // that.initManholeData(tempList)
}
wx.hideLoading()
},
@@ -258,7 +284,8 @@
wellCode: '', // 井编号
position: '', // 按位置
wellType: '', // 井类型
- })
+ isInStall: '', // 井状态
+ }, 'all')
break;
case 'location': // 按位置筛选
that.setData({defaultTitieText: '请输入位置', defaultText: '请输入位置', showPopup: true });
@@ -431,6 +458,64 @@
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); // 计算圆心角(弧度)
return R * c; // 返回距离(米)
+ },
+
+ // 点击定位
+ locateCurrentPosition() {
+ var that = this;
+ that.setData({
+ markers: []
+ })
+ //获取当前坐标(gcj02)
+ wx.showLoading({
+ title: '正在定位',
+ mask: true, // 是否显示透明蒙层,防止触摸穿透
+ })
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // latitude: '39.908599446615',
+ // longitude: '116.391914605035',
+ })
+ console.log('获取到当前定位', parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6));
+ // 将地图中心移动到当前定位点
+ const mapCtx = wx.createMapContext('map');
+ mapCtx.moveToLocation();
+ wx.hideLoading()
+ if(wellList.length) {
+ // const tempList = that.filterNearbyPoints(wellList, '39.908599446615', '116.391914605035')
+ const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6))
+ console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ if(tempList.length) {
+ that.initManholeData(tempList)
+ mapCtx.moveToLocation({
+ latitude: tempList[0].latGaode,
+ longitude: tempList[0].lngGaode
+ });
+ } else {
+ wx.showToast({
+ title: "当前位置周围100米无闸井",
+ icon: 'none',
+ duration: 3000
+ })
+ }
+ } else {
+ that.fetchManhole()
+ }
+ },
+ fail(err) {
+ wx.hideLoading()
+ wx.showToast({
+ title: "未获取到当前定位!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/pages/defineMap/defineMap.wxml b/miniprogram/pages/defineMap/defineMap.wxml
index 7f80f38..5879144 100644
--- a/miniprogram/pages/defineMap/defineMap.wxml
+++ b/miniprogram/pages/defineMap/defineMap.wxml
@@ -4,6 +4,7 @@
latitude="{{latitude}}"
scale="{{scale}}"
markers="{{markers}}"
+ show-location
bindmarkertap="onMarkerTap"
style="width: 100%; height: 100vh;">
@@ -19,11 +20,16 @@
-->
+
+
+
+
-
+
+
diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/addNew.png b/miniprogram/images/addNew.png
new file mode 100644
index 0000000..654768e
--- /dev/null
+++ b/miniprogram/images/addNew.png
Binary files differ
diff --git a/miniprogram/images/minusNew.png b/miniprogram/images/minusNew.png
new file mode 100644
index 0000000..6db0fe7
--- /dev/null
+++ b/miniprogram/images/minusNew.png
Binary files differ
diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js
index f5dc595..29424a6 100644
--- a/miniprogram/pages/addDevice/addDevice.js
+++ b/miniprogram/pages/addDevice/addDevice.js
@@ -351,7 +351,7 @@
'form.wellType': options.wellType, // 井类型
'form.wellcode': options.wellCode, // 井编号
'form.position': options.position, // 位置
- 'form.devicetype': '1', // 设备类型
+ 'form.devicetype': '井盖状态监测仪', // 设备类型
'form.latitude': parseFloat(options.latitude).toFixed(6),
'form.longitude': parseFloat(options.longitude).toFixed(6),
latitude: parseFloat(options.latitude).toFixed(6),
@@ -678,13 +678,17 @@
wx.showModal({
content: '提交成功,是否返回?',
success: function (res) {
- //用于回显
- wx.setStorageSync('cacheList', that.data.form)
+ console.log('用户点击了返回')
+ //用于回显
+ console.log('lll', that.data.form);
+ wx.setStorageSync('cacheList', that.data.form)
//提交成功后提示用户操作
if (res.confirm) {
// wx.switchTab({
// url: '../earth/earth'
// })
+ console.log('lleeel', that.data.form);
+ app.globalData.addsuccessWellCode = that.data.form.wellcode
wx.navigateBack({ // 返回上一页
delta: 1
});
diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js
index a224eda..193041b 100644
--- a/miniprogram/pages/defineMap/defineMap.js
+++ b/miniprogram/pages/defineMap/defineMap.js
@@ -18,9 +18,10 @@
{label: '消防井', value: '16'},
{label: '监控井', value: '17'},
]
+let wellList = []
Page({
data: {
- wellTypeList: [
+ wellTypeList: [
'雨水井',
'污水井',
'燃气井',
@@ -39,8 +40,8 @@
'消防井',
'监控井'
],
- longitude: 116.397228,
- latitude: 39.907501,
+ longitude: "116.627340",
+ latitude: "39.874390",
scale: 14,
minScale: 2,
maxScale: 22,
@@ -49,7 +50,7 @@
activeMarker: null,
showActionSheet: false,
filterOptions: [
- { name: '查看所有', type: 'all' },
+ { name: '查看全部井', type: 'all' },
{ name: '按位置', type: 'location' },
{ name: '按井编号', type: 'wellCode' },
{ name: '按井类型', type: 'wellType' },
@@ -62,6 +63,10 @@
wellType: '', // 井类型
isInStall: '', // 井状态
},
+ position7: {
+ left: '46%',
+ top: '46%',
+ },
// -----------------------弹出框--------------------
showPopup: false,
popupType: '',
@@ -72,16 +77,31 @@
},
onLoad() {
- this.fetchManhole({ // 查询井列表的参数
- wellCode: '', // 井编号
- position: '', // 按位置
- wellType: '', // 井类型
- isInStall: '0', // 井状态
- });
+ if(!app.globalData.addsuccessWellCode) {
+ this.fetchManhole({ // 查询井列表的参数
+ wellCode: '', // 井编号
+ position: '', // 按位置
+ wellType: '', // 井类型
+ isInStall: '', // 井状态
+ });
+ }
+},
+ onShow() {
+ if(app.globalData.addsuccessWellCode && wellList.length) {
+ const index = wellList.findIndex(item => item.wellCode === app.globalData.addsuccessWellCode)
+ if(index !== -1) {
+ wellList[index].isInStall = '1'
+ this.initManholeData(wellList)
+ app.globalData.addsuccessWellCode = ''
+ this.setData({
+ activeMarker: null
+ })
+ }
+ }
},
// 获取井
- fetchManhole(params) {
+ fetchManhole(params, type = '') {
const that = this
console.log('请求井列表', params);
wx.showLoading({
@@ -98,9 +118,15 @@
success(res) {
if (res.data.code == 200) {
const listResultData = res.data.data;
- const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
- console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
- that.initManholeData(tempList)
+ wellList = listResultData
+ if(type === 'all') { // 查看所有井
+ that.initManholeData(listResultData)
+ } else { // 显示周围100米井
+ that.locateCurrentPosition()
+ }
+ // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
+ // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ // that.initManholeData(tempList)
}
wx.hideLoading()
},
@@ -258,7 +284,8 @@
wellCode: '', // 井编号
position: '', // 按位置
wellType: '', // 井类型
- })
+ isInStall: '', // 井状态
+ }, 'all')
break;
case 'location': // 按位置筛选
that.setData({defaultTitieText: '请输入位置', defaultText: '请输入位置', showPopup: true });
@@ -431,6 +458,64 @@
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); // 计算圆心角(弧度)
return R * c; // 返回距离(米)
+ },
+
+ // 点击定位
+ locateCurrentPosition() {
+ var that = this;
+ that.setData({
+ markers: []
+ })
+ //获取当前坐标(gcj02)
+ wx.showLoading({
+ title: '正在定位',
+ mask: true, // 是否显示透明蒙层,防止触摸穿透
+ })
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // latitude: '39.908599446615',
+ // longitude: '116.391914605035',
+ })
+ console.log('获取到当前定位', parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6));
+ // 将地图中心移动到当前定位点
+ const mapCtx = wx.createMapContext('map');
+ mapCtx.moveToLocation();
+ wx.hideLoading()
+ if(wellList.length) {
+ // const tempList = that.filterNearbyPoints(wellList, '39.908599446615', '116.391914605035')
+ const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6))
+ console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ if(tempList.length) {
+ that.initManholeData(tempList)
+ mapCtx.moveToLocation({
+ latitude: tempList[0].latGaode,
+ longitude: tempList[0].lngGaode
+ });
+ } else {
+ wx.showToast({
+ title: "当前位置周围100米无闸井",
+ icon: 'none',
+ duration: 3000
+ })
+ }
+ } else {
+ that.fetchManhole()
+ }
+ },
+ fail(err) {
+ wx.hideLoading()
+ wx.showToast({
+ title: "未获取到当前定位!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/pages/defineMap/defineMap.wxml b/miniprogram/pages/defineMap/defineMap.wxml
index 7f80f38..5879144 100644
--- a/miniprogram/pages/defineMap/defineMap.wxml
+++ b/miniprogram/pages/defineMap/defineMap.wxml
@@ -4,6 +4,7 @@
latitude="{{latitude}}"
scale="{{scale}}"
markers="{{markers}}"
+ show-location
bindmarkertap="onMarkerTap"
style="width: 100%; height: 100vh;">
@@ -19,11 +20,16 @@
-->
+
+
+
+
-
+
+
diff --git a/miniprogram/pages/defineMap/defineMap.wxss b/miniprogram/pages/defineMap/defineMap.wxss
index 49e8347..2a625a5 100644
--- a/miniprogram/pages/defineMap/defineMap.wxss
+++ b/miniprogram/pages/defineMap/defineMap.wxss
@@ -131,6 +131,12 @@
margin-top: 10px;
}
+ .refresh-btn {
+ position: fixed;
+ left: 30rpx;
+ bottom: 80rpx;
+ }
+
.filter-btn {
position: fixed;
right: 30rpx;
diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/addNew.png b/miniprogram/images/addNew.png
new file mode 100644
index 0000000..654768e
--- /dev/null
+++ b/miniprogram/images/addNew.png
Binary files differ
diff --git a/miniprogram/images/minusNew.png b/miniprogram/images/minusNew.png
new file mode 100644
index 0000000..6db0fe7
--- /dev/null
+++ b/miniprogram/images/minusNew.png
Binary files differ
diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js
index f5dc595..29424a6 100644
--- a/miniprogram/pages/addDevice/addDevice.js
+++ b/miniprogram/pages/addDevice/addDevice.js
@@ -351,7 +351,7 @@
'form.wellType': options.wellType, // 井类型
'form.wellcode': options.wellCode, // 井编号
'form.position': options.position, // 位置
- 'form.devicetype': '1', // 设备类型
+ 'form.devicetype': '井盖状态监测仪', // 设备类型
'form.latitude': parseFloat(options.latitude).toFixed(6),
'form.longitude': parseFloat(options.longitude).toFixed(6),
latitude: parseFloat(options.latitude).toFixed(6),
@@ -678,13 +678,17 @@
wx.showModal({
content: '提交成功,是否返回?',
success: function (res) {
- //用于回显
- wx.setStorageSync('cacheList', that.data.form)
+ console.log('用户点击了返回')
+ //用于回显
+ console.log('lll', that.data.form);
+ wx.setStorageSync('cacheList', that.data.form)
//提交成功后提示用户操作
if (res.confirm) {
// wx.switchTab({
// url: '../earth/earth'
// })
+ console.log('lleeel', that.data.form);
+ app.globalData.addsuccessWellCode = that.data.form.wellcode
wx.navigateBack({ // 返回上一页
delta: 1
});
diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js
index a224eda..193041b 100644
--- a/miniprogram/pages/defineMap/defineMap.js
+++ b/miniprogram/pages/defineMap/defineMap.js
@@ -18,9 +18,10 @@
{label: '消防井', value: '16'},
{label: '监控井', value: '17'},
]
+let wellList = []
Page({
data: {
- wellTypeList: [
+ wellTypeList: [
'雨水井',
'污水井',
'燃气井',
@@ -39,8 +40,8 @@
'消防井',
'监控井'
],
- longitude: 116.397228,
- latitude: 39.907501,
+ longitude: "116.627340",
+ latitude: "39.874390",
scale: 14,
minScale: 2,
maxScale: 22,
@@ -49,7 +50,7 @@
activeMarker: null,
showActionSheet: false,
filterOptions: [
- { name: '查看所有', type: 'all' },
+ { name: '查看全部井', type: 'all' },
{ name: '按位置', type: 'location' },
{ name: '按井编号', type: 'wellCode' },
{ name: '按井类型', type: 'wellType' },
@@ -62,6 +63,10 @@
wellType: '', // 井类型
isInStall: '', // 井状态
},
+ position7: {
+ left: '46%',
+ top: '46%',
+ },
// -----------------------弹出框--------------------
showPopup: false,
popupType: '',
@@ -72,16 +77,31 @@
},
onLoad() {
- this.fetchManhole({ // 查询井列表的参数
- wellCode: '', // 井编号
- position: '', // 按位置
- wellType: '', // 井类型
- isInStall: '0', // 井状态
- });
+ if(!app.globalData.addsuccessWellCode) {
+ this.fetchManhole({ // 查询井列表的参数
+ wellCode: '', // 井编号
+ position: '', // 按位置
+ wellType: '', // 井类型
+ isInStall: '', // 井状态
+ });
+ }
+},
+ onShow() {
+ if(app.globalData.addsuccessWellCode && wellList.length) {
+ const index = wellList.findIndex(item => item.wellCode === app.globalData.addsuccessWellCode)
+ if(index !== -1) {
+ wellList[index].isInStall = '1'
+ this.initManholeData(wellList)
+ app.globalData.addsuccessWellCode = ''
+ this.setData({
+ activeMarker: null
+ })
+ }
+ }
},
// 获取井
- fetchManhole(params) {
+ fetchManhole(params, type = '') {
const that = this
console.log('请求井列表', params);
wx.showLoading({
@@ -98,9 +118,15 @@
success(res) {
if (res.data.code == 200) {
const listResultData = res.data.data;
- const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
- console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
- that.initManholeData(tempList)
+ wellList = listResultData
+ if(type === 'all') { // 查看所有井
+ that.initManholeData(listResultData)
+ } else { // 显示周围100米井
+ that.locateCurrentPosition()
+ }
+ // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
+ // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ // that.initManholeData(tempList)
}
wx.hideLoading()
},
@@ -258,7 +284,8 @@
wellCode: '', // 井编号
position: '', // 按位置
wellType: '', // 井类型
- })
+ isInStall: '', // 井状态
+ }, 'all')
break;
case 'location': // 按位置筛选
that.setData({defaultTitieText: '请输入位置', defaultText: '请输入位置', showPopup: true });
@@ -431,6 +458,64 @@
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); // 计算圆心角(弧度)
return R * c; // 返回距离(米)
+ },
+
+ // 点击定位
+ locateCurrentPosition() {
+ var that = this;
+ that.setData({
+ markers: []
+ })
+ //获取当前坐标(gcj02)
+ wx.showLoading({
+ title: '正在定位',
+ mask: true, // 是否显示透明蒙层,防止触摸穿透
+ })
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // latitude: '39.908599446615',
+ // longitude: '116.391914605035',
+ })
+ console.log('获取到当前定位', parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6));
+ // 将地图中心移动到当前定位点
+ const mapCtx = wx.createMapContext('map');
+ mapCtx.moveToLocation();
+ wx.hideLoading()
+ if(wellList.length) {
+ // const tempList = that.filterNearbyPoints(wellList, '39.908599446615', '116.391914605035')
+ const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6))
+ console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ if(tempList.length) {
+ that.initManholeData(tempList)
+ mapCtx.moveToLocation({
+ latitude: tempList[0].latGaode,
+ longitude: tempList[0].lngGaode
+ });
+ } else {
+ wx.showToast({
+ title: "当前位置周围100米无闸井",
+ icon: 'none',
+ duration: 3000
+ })
+ }
+ } else {
+ that.fetchManhole()
+ }
+ },
+ fail(err) {
+ wx.hideLoading()
+ wx.showToast({
+ title: "未获取到当前定位!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/pages/defineMap/defineMap.wxml b/miniprogram/pages/defineMap/defineMap.wxml
index 7f80f38..5879144 100644
--- a/miniprogram/pages/defineMap/defineMap.wxml
+++ b/miniprogram/pages/defineMap/defineMap.wxml
@@ -4,6 +4,7 @@
latitude="{{latitude}}"
scale="{{scale}}"
markers="{{markers}}"
+ show-location
bindmarkertap="onMarkerTap"
style="width: 100%; height: 100vh;">
@@ -19,11 +20,16 @@
-->
+
+
+
+
-
+
+
diff --git a/miniprogram/pages/defineMap/defineMap.wxss b/miniprogram/pages/defineMap/defineMap.wxss
index 49e8347..2a625a5 100644
--- a/miniprogram/pages/defineMap/defineMap.wxss
+++ b/miniprogram/pages/defineMap/defineMap.wxss
@@ -131,6 +131,12 @@
margin-top: 10px;
}
+ .refresh-btn {
+ position: fixed;
+ left: 30rpx;
+ bottom: 80rpx;
+ }
+
.filter-btn {
position: fixed;
right: 30rpx;
diff --git a/miniprogram/project.config.json b/miniprogram/project.config.json
index 0d82855..5b31ab6 100644
--- a/miniprogram/project.config.json
+++ b/miniprogram/project.config.json
@@ -40,5 +40,6 @@
"tabIndent": "insertSpaces",
"tabSize": 4
},
- "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
+ "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+ "simulatorPluginLibVersion": {}
}
\ No newline at end of file
diff --git a/miniprogram/images/add.png b/miniprogram/images/add.png
index 3a0bd2e..7764ca3 100644
--- a/miniprogram/images/add.png
+++ b/miniprogram/images/add.png
Binary files differ
diff --git a/miniprogram/images/addNew.png b/miniprogram/images/addNew.png
new file mode 100644
index 0000000..654768e
--- /dev/null
+++ b/miniprogram/images/addNew.png
Binary files differ
diff --git a/miniprogram/images/minusNew.png b/miniprogram/images/minusNew.png
new file mode 100644
index 0000000..6db0fe7
--- /dev/null
+++ b/miniprogram/images/minusNew.png
Binary files differ
diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js
index f5dc595..29424a6 100644
--- a/miniprogram/pages/addDevice/addDevice.js
+++ b/miniprogram/pages/addDevice/addDevice.js
@@ -351,7 +351,7 @@
'form.wellType': options.wellType, // 井类型
'form.wellcode': options.wellCode, // 井编号
'form.position': options.position, // 位置
- 'form.devicetype': '1', // 设备类型
+ 'form.devicetype': '井盖状态监测仪', // 设备类型
'form.latitude': parseFloat(options.latitude).toFixed(6),
'form.longitude': parseFloat(options.longitude).toFixed(6),
latitude: parseFloat(options.latitude).toFixed(6),
@@ -678,13 +678,17 @@
wx.showModal({
content: '提交成功,是否返回?',
success: function (res) {
- //用于回显
- wx.setStorageSync('cacheList', that.data.form)
+ console.log('用户点击了返回')
+ //用于回显
+ console.log('lll', that.data.form);
+ wx.setStorageSync('cacheList', that.data.form)
//提交成功后提示用户操作
if (res.confirm) {
// wx.switchTab({
// url: '../earth/earth'
// })
+ console.log('lleeel', that.data.form);
+ app.globalData.addsuccessWellCode = that.data.form.wellcode
wx.navigateBack({ // 返回上一页
delta: 1
});
diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js
index a224eda..193041b 100644
--- a/miniprogram/pages/defineMap/defineMap.js
+++ b/miniprogram/pages/defineMap/defineMap.js
@@ -18,9 +18,10 @@
{label: '消防井', value: '16'},
{label: '监控井', value: '17'},
]
+let wellList = []
Page({
data: {
- wellTypeList: [
+ wellTypeList: [
'雨水井',
'污水井',
'燃气井',
@@ -39,8 +40,8 @@
'消防井',
'监控井'
],
- longitude: 116.397228,
- latitude: 39.907501,
+ longitude: "116.627340",
+ latitude: "39.874390",
scale: 14,
minScale: 2,
maxScale: 22,
@@ -49,7 +50,7 @@
activeMarker: null,
showActionSheet: false,
filterOptions: [
- { name: '查看所有', type: 'all' },
+ { name: '查看全部井', type: 'all' },
{ name: '按位置', type: 'location' },
{ name: '按井编号', type: 'wellCode' },
{ name: '按井类型', type: 'wellType' },
@@ -62,6 +63,10 @@
wellType: '', // 井类型
isInStall: '', // 井状态
},
+ position7: {
+ left: '46%',
+ top: '46%',
+ },
// -----------------------弹出框--------------------
showPopup: false,
popupType: '',
@@ -72,16 +77,31 @@
},
onLoad() {
- this.fetchManhole({ // 查询井列表的参数
- wellCode: '', // 井编号
- position: '', // 按位置
- wellType: '', // 井类型
- isInStall: '0', // 井状态
- });
+ if(!app.globalData.addsuccessWellCode) {
+ this.fetchManhole({ // 查询井列表的参数
+ wellCode: '', // 井编号
+ position: '', // 按位置
+ wellType: '', // 井类型
+ isInStall: '', // 井状态
+ });
+ }
+},
+ onShow() {
+ if(app.globalData.addsuccessWellCode && wellList.length) {
+ const index = wellList.findIndex(item => item.wellCode === app.globalData.addsuccessWellCode)
+ if(index !== -1) {
+ wellList[index].isInStall = '1'
+ this.initManholeData(wellList)
+ app.globalData.addsuccessWellCode = ''
+ this.setData({
+ activeMarker: null
+ })
+ }
+ }
},
// 获取井
- fetchManhole(params) {
+ fetchManhole(params, type = '') {
const that = this
console.log('请求井列表', params);
wx.showLoading({
@@ -98,9 +118,15 @@
success(res) {
if (res.data.code == 200) {
const listResultData = res.data.data;
- const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
- console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
- that.initManholeData(tempList)
+ wellList = listResultData
+ if(type === 'all') { // 查看所有井
+ that.initManholeData(listResultData)
+ } else { // 显示周围100米井
+ that.locateCurrentPosition()
+ }
+ // const tempList = that.filterNearbyPoints(listResultData, 39.907900661893, 116.39424858941)
+ // console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ // that.initManholeData(tempList)
}
wx.hideLoading()
},
@@ -258,7 +284,8 @@
wellCode: '', // 井编号
position: '', // 按位置
wellType: '', // 井类型
- })
+ isInStall: '', // 井状态
+ }, 'all')
break;
case 'location': // 按位置筛选
that.setData({defaultTitieText: '请输入位置', defaultText: '请输入位置', showPopup: true });
@@ -431,6 +458,64 @@
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); // 计算圆心角(弧度)
return R * c; // 返回距离(米)
+ },
+
+ // 点击定位
+ locateCurrentPosition() {
+ var that = this;
+ that.setData({
+ markers: []
+ })
+ //获取当前坐标(gcj02)
+ wx.showLoading({
+ title: '正在定位',
+ mask: true, // 是否显示透明蒙层,防止触摸穿透
+ })
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // latitude: '39.908599446615',
+ // longitude: '116.391914605035',
+ })
+ console.log('获取到当前定位', parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6));
+ // 将地图中心移动到当前定位点
+ const mapCtx = wx.createMapContext('map');
+ mapCtx.moveToLocation();
+ wx.hideLoading()
+ if(wellList.length) {
+ // const tempList = that.filterNearbyPoints(wellList, '39.908599446615', '116.391914605035')
+ const tempList = that.filterNearbyPoints(wellList, parseFloat(res.latitude).toFixed(6), parseFloat(res.longitude).toFixed(6))
+ console.log('获取当前人的定位周围100米的数据',tempList.length, tempList);
+ if(tempList.length) {
+ that.initManholeData(tempList)
+ mapCtx.moveToLocation({
+ latitude: tempList[0].latGaode,
+ longitude: tempList[0].lngGaode
+ });
+ } else {
+ wx.showToast({
+ title: "当前位置周围100米无闸井",
+ icon: 'none',
+ duration: 3000
+ })
+ }
+ } else {
+ that.fetchManhole()
+ }
+ },
+ fail(err) {
+ wx.hideLoading()
+ wx.showToast({
+ title: "未获取到当前定位!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/pages/defineMap/defineMap.wxml b/miniprogram/pages/defineMap/defineMap.wxml
index 7f80f38..5879144 100644
--- a/miniprogram/pages/defineMap/defineMap.wxml
+++ b/miniprogram/pages/defineMap/defineMap.wxml
@@ -4,6 +4,7 @@
latitude="{{latitude}}"
scale="{{scale}}"
markers="{{markers}}"
+ show-location
bindmarkertap="onMarkerTap"
style="width: 100%; height: 100vh;">
@@ -19,11 +20,16 @@
-->
+
+
+
+
-
+
+
diff --git a/miniprogram/pages/defineMap/defineMap.wxss b/miniprogram/pages/defineMap/defineMap.wxss
index 49e8347..2a625a5 100644
--- a/miniprogram/pages/defineMap/defineMap.wxss
+++ b/miniprogram/pages/defineMap/defineMap.wxss
@@ -131,6 +131,12 @@
margin-top: 10px;
}
+ .refresh-btn {
+ position: fixed;
+ left: 30rpx;
+ bottom: 80rpx;
+ }
+
.filter-btn {
position: fixed;
right: 30rpx;
diff --git a/miniprogram/project.config.json b/miniprogram/project.config.json
index 0d82855..5b31ab6 100644
--- a/miniprogram/project.config.json
+++ b/miniprogram/project.config.json
@@ -40,5 +40,6 @@
"tabIndent": "insertSpaces",
"tabSize": 4
},
- "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
+ "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+ "simulatorPluginLibVersion": {}
}
\ No newline at end of file
diff --git a/miniprogram/project.private.config.json b/miniprogram/project.private.config.json
index 2183d83..8f109f9 100644
--- a/miniprogram/project.private.config.json
+++ b/miniprogram/project.private.config.json
@@ -9,6 +9,13 @@
"miniprogram": {
"list": [
{
+ "name": "pages/login/login",
+ "pathName": "pages/login/login",
+ "query": "",
+ "launchMode": "default",
+ "scene": null
+ },
+ {
"name": "pages/defineMap/defineMap",
"pathName": "pages/defineMap/defineMap",
"query": "",