diff --git a/miniprogram/pages/earth/earth.js b/miniprogram/pages/earth/earth.js
index 8bc3b3b..ab1a56e 100644
--- a/miniprogram/pages/earth/earth.js
+++ b/miniprogram/pages/earth/earth.js
@@ -1,5 +1,6 @@
// miniprogram/pages/earth/earth.js
-
+const screenWidth = wx.getSystemInfoSync().windowWidth
+const screenHeight = wx.getSystemInfoSync().windowHeight
// 引入SDK核心类
var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
var qqmapsdk;
@@ -26,7 +27,39 @@
longitude84: "",
latitude84: "",
markers: [],
- controls: []
+ controls: [], // 控件集合
+ position1: {
+ right: '20rpx',
+ top: '40rpx',
+ },
+ position2: {
+ right: '20rpx',
+ top: '120rpx',
+ },
+ position3: {
+ right: '20rpx',
+ top: '200rpx',
+ },
+ position4: {
+ right: '20rpx',
+ bottom: '200rpx',
+ },
+ position5: {
+ left: '20rpx',
+ bottom: '200rpx',
+ },
+ position6: {
+ left: '20rpx',
+ bottom: '120rpx',
+ },
+ position7: {
+ left: '46%',
+ top: '46%',
+ },
+ position8: {
+ right: '20rpx',
+ bottom: '120rpx',
+ },
},
/**
@@ -135,7 +168,6 @@
qqmapsdk = new QQMapWX({
key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
})
-
},
/**
@@ -312,9 +344,11 @@
//加载地图组件
controltap: function (e) {
- // console.log(e.controlId);
+ const controlId = e.currentTarget.dataset.controlid
+ console.log(controlId);
+
//进入添加设备页
- if (1 == e.controlId) {
+ if (1 == controlId) {
wx.setClipboardData({
data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
success: function (res) {
@@ -327,7 +361,7 @@
})
}
})
- } else if (3 == e.controlId) {
+ } else if (3 == controlId) {
//先定位
// this.locationPosition()
wx.setClipboardData({
@@ -342,29 +376,29 @@
wx.navigateTo({
url: '../addDevice/addDevice'
})
- } else if (2 == e.controlId) {
+ } else if (2 == controlId) {
this.setData({
show: true
});
- } else if (4 == e.controlId) {
+ } else if (4 == controlId) {
wx.openLocation({
latitude: Number(this.data.marker_latitude),
longitude: Number(this.data.marker_longitude),
name: this.data.title,
scale: 35
})
- } else if (5 == e.controlId) {
+ } else if (5 == controlId) {
var flag = this.data.enableSsatellite;
this.setData({
enableSsatellite: !flag
});
- } else if (6 == e.controlId) {
+ } else if (6 == controlId) {
//先清marker
this.setData({
markers: []
})
this.locationPosition()
- }else if (8 == e.controlId) {
+ }else if (8 == controlId) {
//跳转日志缓存页
wx.switchTab({
url: '../applog/applog',
diff --git a/miniprogram/pages/earth/earth.js b/miniprogram/pages/earth/earth.js
index 8bc3b3b..ab1a56e 100644
--- a/miniprogram/pages/earth/earth.js
+++ b/miniprogram/pages/earth/earth.js
@@ -1,5 +1,6 @@
// miniprogram/pages/earth/earth.js
-
+const screenWidth = wx.getSystemInfoSync().windowWidth
+const screenHeight = wx.getSystemInfoSync().windowHeight
// 引入SDK核心类
var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
var qqmapsdk;
@@ -26,7 +27,39 @@
longitude84: "",
latitude84: "",
markers: [],
- controls: []
+ controls: [], // 控件集合
+ position1: {
+ right: '20rpx',
+ top: '40rpx',
+ },
+ position2: {
+ right: '20rpx',
+ top: '120rpx',
+ },
+ position3: {
+ right: '20rpx',
+ top: '200rpx',
+ },
+ position4: {
+ right: '20rpx',
+ bottom: '200rpx',
+ },
+ position5: {
+ left: '20rpx',
+ bottom: '200rpx',
+ },
+ position6: {
+ left: '20rpx',
+ bottom: '120rpx',
+ },
+ position7: {
+ left: '46%',
+ top: '46%',
+ },
+ position8: {
+ right: '20rpx',
+ bottom: '120rpx',
+ },
},
/**
@@ -135,7 +168,6 @@
qqmapsdk = new QQMapWX({
key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
})
-
},
/**
@@ -312,9 +344,11 @@
//加载地图组件
controltap: function (e) {
- // console.log(e.controlId);
+ const controlId = e.currentTarget.dataset.controlid
+ console.log(controlId);
+
//进入添加设备页
- if (1 == e.controlId) {
+ if (1 == controlId) {
wx.setClipboardData({
data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
success: function (res) {
@@ -327,7 +361,7 @@
})
}
})
- } else if (3 == e.controlId) {
+ } else if (3 == controlId) {
//先定位
// this.locationPosition()
wx.setClipboardData({
@@ -342,29 +376,29 @@
wx.navigateTo({
url: '../addDevice/addDevice'
})
- } else if (2 == e.controlId) {
+ } else if (2 == controlId) {
this.setData({
show: true
});
- } else if (4 == e.controlId) {
+ } else if (4 == controlId) {
wx.openLocation({
latitude: Number(this.data.marker_latitude),
longitude: Number(this.data.marker_longitude),
name: this.data.title,
scale: 35
})
- } else if (5 == e.controlId) {
+ } else if (5 == controlId) {
var flag = this.data.enableSsatellite;
this.setData({
enableSsatellite: !flag
});
- } else if (6 == e.controlId) {
+ } else if (6 == controlId) {
//先清marker
this.setData({
markers: []
})
this.locationPosition()
- }else if (8 == e.controlId) {
+ }else if (8 == controlId) {
//跳转日志缓存页
wx.switchTab({
url: '../applog/applog',
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 8663307..ad97bcf 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -4,7 +4,8 @@
-