diff --git a/components/c-map/index.vue b/components/c-map/index.vue
index a35c503a64936943d42ba72db492effa1bb115b2..84ed5450247a9bcb0b19af0de35d179fa9452468 100644
--- a/components/c-map/index.vue
+++ b/components/c-map/index.vue
@@ -1,188 +1,267 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
+ .loading {
+ animation: turn 2s linear infinite;
+ width: 50px;
+ height: 50px;
+ position: relative;
+ top: 50%;
+ margin-top: -25px;
+ }
+
diff --git a/components/c-tabbar-popup/index.vue b/components/c-tabbar-popup/index.vue
index e1670f3dadde513fc3354bba0d1e59a518883b1e..ec6dc560ed509070f4aff8192f4271f1544ec6d3 100644
--- a/components/c-tabbar-popup/index.vue
+++ b/components/c-tabbar-popup/index.vue
@@ -36,14 +36,14 @@
},
methods: {
toHelpForm(type) {
- if (this.$store.state.user.integration < 60 || this.$store.state.user.authenticationState !=2) {
+ /* if (this.$store.state.user.integration < 60 || this.$store.state.user.authenticationState !=2) {
this.$refs.uToast.show({
title: "信誉分过低/你未实名认证",
type: "error",
duration: "2300"
});
return;
- }
+ } */
this.$u.route("/pages/help-form/help-form", {
//参数列表
typeId: type.typeId,
diff --git a/pages/help-form/help-form.vue b/pages/help-form/help-form.vue
index 658483ddb86c7aef825692c39c77a691ce3ca2f8..f6b955e0906def778aa1ac86ffde743ec4874173 100644
--- a/pages/help-form/help-form.vue
+++ b/pages/help-form/help-form.vue
@@ -355,7 +355,7 @@ export default {
let that = this;
uni.chooseLocation({
success: function(res) {
- console.log(res);
+ console.log("reslocation",res);
that.form.informationLongitude = res.longitude;
that.form.informationLatitude = res.latitude;
that.form.informationDetailocation = res.name;
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 32e92e5ade3bdbe41e4dcec4caaed885fe0b8e70..65294f10c250c87553333c981e50f473743c2172 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -5,8 +5,8 @@
- {
this.helpListLoadingState.Loading = false;
});
- }
+ }
+ },
+ /* 获取地图标记点 */
+ getHelpListMapCovers(){
+ home
+ .getHelpList()
+ .then((res) => {
+ console.log(res)
+ })
+ }
+ },
+ created() {
+ console.log(this.$c);
+ this.getItems();
+ this.getHelpListMapCovers()
+
},
mounted() {
uni.showLoading({ title: "定位中..." });
diff --git a/static/images/location2.png b/static/images/location2.png
new file mode 100644
index 0000000000000000000000000000000000000000..1543eeb9b5dafea25f42abc3d51d877264922b25
Binary files /dev/null and b/static/images/location2.png differ
diff --git a/static/images/location3.png b/static/images/location3.png
new file mode 100644
index 0000000000000000000000000000000000000000..4ff3077e71e31de7ba2d41790d7142b3c052a3d9
Binary files /dev/null and b/static/images/location3.png differ
diff --git a/tools/mapUtil/MapUtil.js b/tools/mapUtil/MapUtil.js
new file mode 100644
index 0000000000000000000000000000000000000000..0037543c84d26a72245112cf1cc2f626a5aa9d9f
--- /dev/null
+++ b/tools/mapUtil/MapUtil.js
@@ -0,0 +1,121 @@
+import {
+ zjMarker
+} from './ZjMarker.js';
+class MapUtil {
+ constructor(northeast, southwest, scale) {
+ this.northeast = northeast;
+ this.southwest = southwest;
+ this.scale = scale;
+ console.log('初始化mapUtil成功');
+ console.log(this.northeast, 'northeast');
+ }
+ //设置初始化范围
+ setInitData(northeast, southwest, scale) {
+ this.northeast = northeast;
+ this.southwest = southwest;
+ this.scale = scale;
+ console.log('刷新mapUtil成功');
+ }
+ //判断是否为缩放,
+ checkRefresh(northeast, southwest) {
+ console.log('检测是否可以刷新接口');
+ console.log(this.northeast, 'northeast');
+ console.log(northeast, 'currentNortheast');
+ let result = true;
+ if (this.northeast.latitude > northeast.latitude) {
+ console.log('东北纬度缩小');
+ }
+ if (this.southwest.latitude < southwest.latitude) {
+ console.log('西南纬度增高');
+ }
+ if (this.northeast.longitude > northeast.longitude) {
+ console.log('东北经度增大');
+ }
+ if (this.southwest.longitude < southwest.longitude) {
+ console.log('西南经度缩小');
+ }
+ if (this.northeast.latitude > northeast.latitude && this.southwest.latitude < southwest.latitude &&
+ this.northeast.longitude > northeast.longitude && this.southwest.longitude < southwest.longitude) {
+ console.log('地图缩放,不请求接口');
+ result = false
+ }
+ return result;
+ }
+ //根据东北 西南经纬度 以及后台返回标记点 格式化成小程序marker点
+ getFortMatMarkerList(northeast, southwest, scale, backendMarkerList) {
+ //屏幕中显示的经度的长度和纬度的长度
+ let mapWidth = southwest.longitude - northeast.longitude;
+ let mapHeight = northeast.latitude - southwest.latitude;
+ //将屏幕中地图分割的横向 格子数和 纵向格子数
+ let widthSize = scale;
+ let heightSize = widthSize + parseInt(scale / 2);
+ //计算每个格子的经纬度的长度
+ let unitWidth = mapWidth / widthSize;
+ let unitHeight = mapHeight / heightSize;
+ let pointData = {};
+ console.log("backendMarkerList",backendMarkerList)
+ backendMarkerList.forEach(latLng => {
+ //如果点在显示范围内
+ console.log(latLng.latitude < northeast.latitude && latLng.latitude > southwest.latitude &&
+ latLng.longitude < northeast.longitude && latLng.longitude > southwest.longitude)
+ if (latLng.latitude < northeast.latitude && latLng.latitude > southwest.latitude &&
+ latLng.longitude < northeast.longitude && latLng.longitude > southwest.longitude) {
+ let relativeX = latLng.longitude - northeast.longitude;
+ let relativeY = latLng.latitude - southwest.latitude;
+ //计算出这个点,处于哪个格子
+ let x = parseInt(Math.floor(relativeX / unitWidth));
+ let y = parseInt(Math.floor(relativeY / unitHeight));
+ if (x < 0 || y < 0) {
+ console.log('点位不在格子内', '失败');
+ }
+ //生成单元格点位数据
+ let pointKey = x + ',' + y;
+ if (pointData[pointKey] == undefined) {
+ pointData[pointKey] = [];
+ }
+ console.log("pointData[pointKey]",pointData[pointKey])
+ pointData[pointKey].push(latLng);
+ }
+ });
+ let resultMapArray = [];
+ for (let y = 0; y < heightSize; y++) {
+ for (let x = 0; x < widthSize; x++) {
+ let pointKey = x + ',' + y;
+ //筛选没有充电站点位的格子
+ if (pointData[pointKey] != undefined) {
+ let markerItem = {};
+ //聚合点与单点共存 , 长度等于一 不聚合点
+ if (pointData[pointKey].length == 1) {
+ let iconPath = pointData[pointKey][0].ScanAndCharge == 1 ? '/static/images/location2.png' : '/static/images/location2.png';
+ markerItem = new zjMarker(pointData[pointKey][0].longitude, pointData[pointKey][0].latitude, pointData[pointKey][0].id, {
+ iconPath: iconPath
+ })
+ //长度大于一 聚合点
+ } else if (pointData[pointKey].length > 1) {
+ let iconPath = pointData[pointKey][0].ScanAndCharge == 1 ? '/static/images/location3.png' : '/static/images/location3.png';
+ markerItem = new zjMarker(pointData[pointKey][0].longitude, pointData[pointKey][0].latitude, pointData[pointKey][0].id, {
+ type: 'cluster',
+ iconPath: iconPath,
+ num: pointData[pointKey].length
+ })
+ }
+ resultMapArray.push(markerItem);
+ }
+ }
+ }
+ console.log(resultMapArray, 'resultMapArray');
+ return resultMapArray;
+ }
+ //获取中心纬度
+ getCenterLocation(northeast, southwest) {
+ let mapWidth = southwest.longitude - northeast.longitude;
+ let mapHeight = northeast.latitude - southwest.latitude;
+ let longitude = northeast.longitude + mapWidth;
+ let latitude = southwest.latitude + mapHeight;
+ return {
+ latitude: latitude,
+ longitude: longitude
+ }
+ }
+}
+export {MapUtil}
\ No newline at end of file
diff --git a/tools/mapUtil/ZjMarker.js b/tools/mapUtil/ZjMarker.js
new file mode 100644
index 0000000000000000000000000000000000000000..505a0915e65d05f34e68d9b401c50bc32be5f977
--- /dev/null
+++ b/tools/mapUtil/ZjMarker.js
@@ -0,0 +1,25 @@
+//地图marker标记点基类 (单点`聚合)
+export class zjMarker {
+ constructor(longitude, latitude, id, options = {}) {
+ this.longitude = longitude;
+ this.latitude = latitude;
+ this.id = id;
+ this.width = options.width ? options.width : 40;
+ this.height = options.height != undefined ? options.height : 46;
+ let type = options.type == undefined ? 'single' : options.type;
+ this.iconPath = options.iconPath == undefined ? '/static/icon/location.png' : options.iconPath;
+ if (type != 'single') {
+ this.callout = {
+ content: options.num, //文本
+ color: '#000', //文本颜色
+ borderRadius: 3, //边框圆角
+ borderWidth: 0, //边框宽度
+ bgColor: 'transparent', //背景色
+ padding: 0, //文本边缘留白,
+ display: 'ALWAYS',
+ textAlign: 'center', //文本对齐方式。有效值: left, right, center,
+ anchorY: 62 //可能需要根据各个手机做出相应的适配
+ }
+ }
+ }
+}
\ No newline at end of file