From 9dfc54bf6e0fdb3c746815707487c6ae50e98905 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 25 二月 2025 18:30:08 +0800
Subject: [PATCH] 更新
---
bicycle/unpackage/dist/dev/mp-weixin/pages/maps/maps.js | 214 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 198 insertions(+), 16 deletions(-)
diff --git a/bicycle/unpackage/dist/dev/mp-weixin/pages/maps/maps.js b/bicycle/unpackage/dist/dev/mp-weixin/pages/maps/maps.js
index 7099c0b..60e25eb 100644
--- a/bicycle/unpackage/dist/dev/mp-weixin/pages/maps/maps.js
+++ b/bicycle/unpackage/dist/dev/mp-weixin/pages/maps/maps.js
@@ -176,11 +176,33 @@
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
+var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
+var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 30));
+var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
+var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32));
var _utils = __webpack_require__(/*! @/utils/utils.js */ 194);
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
//
//
//
@@ -222,15 +244,18 @@
var _default = {
data: function data() {
return {
+ type: null,
show: false,
latitude: '',
longitude: '',
markers: [],
info: {},
- rice: ''
+ rice: '',
+ eleBusinessArea: []
};
},
- onLoad: function onLoad() {
+ onLoad: function onLoad(options) {
+ this.type = options.type;
this.getAddress();
},
methods: {
@@ -312,6 +337,46 @@
}
});
},
+ getEleBikeList: function getEleBikeList() {
+ var _this = this;
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
+ var res;
+ return _regenerator.default.wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ _context.next = 2;
+ return _this.$u.api.eleBikeList({});
+ case 2:
+ res = _context.sent;
+ if (res.code === 200) {
+ res.data.forEach(function (item, index) {
+ var num = (0, _utils.distance)(_this.latitude, _this.longitude, item.latitude, item.longitude);
+ _this.markers.push({
+ id: index,
+ width: 40,
+ height: 40,
+ distance: _this.latitude && _this.longitude ? num : '鏈煡璺濈',
+ latitude: item.latitude,
+ longitude: item.longitude,
+ title: item.name,
+ iconPath: '/static/icon/ic_bike@2x.png',
+ customCallout: {
+ anchorY: 0,
+ anchorX: 0,
+ display: 'BYCLICK'
+ }
+ });
+ });
+ }
+ case 4:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee);
+ }))();
+ },
// 瀹氫綅鑾峰彇
fnGetlocation: function fnGetlocation() {
var that = this;
@@ -322,7 +387,14 @@
success: function success(res) {
that.latitude = res.latitude;
that.longitude = res.longitude;
- that.getSite();
+ if (that.type == 1) {
+ console.log('鑷杞�');
+ that.getSite();
+ } else {
+ console.log('鐢靛姩杞�');
+ that.getEleBikeList();
+ that.getEleSiteList();
+ }
},
fail: function fail(err) {
if (err.errMsg === "getLocation:fail 棰戠箒璋冪敤浼氬鍔犵數閲忔崯鑰楋紝鍙�冭檻浣跨敤 wx.onLocationChange 鐩戝惉鍦扮悊浣嶇疆鍙樺寲") {
@@ -369,18 +441,118 @@
}
});
},
+ // 鑾峰彇鑼冨洿
+ getEleSiteList: function getEleSiteList() {
+ var _this2 = this;
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
+ var array, quan, arrs, res;
+ return _regenerator.default.wrap(function _callee2$(_context2) {
+ while (1) {
+ switch (_context2.prev = _context2.next) {
+ case 0:
+ array = [];
+ _context2.next = 3;
+ return _this2.$u.api.getEleBusinessArea({});
+ case 3:
+ quan = _context2.sent;
+ if (quan.code === 200) {
+ arrs = JSON.parse(quan.data);
+ array.push({
+ points: arrs.map(function (item) {
+ return {
+ latitude: item.lat,
+ longitude: item.lng
+ };
+ }),
+ fillColor: "#0077FF12",
+ strokeColor: "#0077FF",
+ strokeWidth: 3,
+ zIndex: 7
+ });
+ }
+ _context2.next = 7;
+ return _this2.$u.api.eleSiteList({});
+ case 7:
+ res = _context2.sent;
+ if (res.code === 200) {
+ res.data.forEach(function (item) {
+ var arr = JSON.parse(item.electronicFence);
+ item.electronicFence = arr.map(function (data) {
+ return {
+ latitude: data.lat,
+ longitude: data.lng
+ };
+ });
+ });
+ _this2.eleBusinessArea = res.data.map(function (item) {
+ return {
+ points: item.electronicFence,
+ title: item.name,
+ fillColor: "#0077FF4D",
+ strokeColor: "#0077FF",
+ strokeWidth: 3,
+ zIndex: 7
+ };
+ });
+ _this2.eleBusinessArea.forEach(function (item) {
+ var _this2$calculatePolyg = _this2.calculatePolygonCenter(item.points),
+ latitude = _this2$calculatePolyg.latitude,
+ longitude = _this2$calculatePolyg.longitude;
+ var num = (0, _utils.distance)(_this2.latitude, _this2.longitude, latitude, longitude);
+ _this2.markers.push({
+ id: Math.floor(Math.random() * 900) + 100,
+ width: 30,
+ height: 40,
+ isShow: false,
+ title: item.title,
+ distance: _this2.latitude && _this2.longitude ? num : '鏈煡璺濈',
+ latitude: latitude,
+ longitude: longitude,
+ iconPath: '/static/icon/ic_park@2x.png',
+ customCallout: {
+ anchorY: 0,
+ anchorX: 0,
+ display: 'BYCLICK'
+ }
+ });
+ });
+ }
+ _this2.eleBusinessArea = [].concat(array, (0, _toConsumableArray2.default)(_this2.eleBusinessArea));
+ case 10:
+ case "end":
+ return _context2.stop();
+ }
+ }
+ }, _callee2);
+ }))();
+ },
+ // 璁$畻澶氳竟褰腑蹇冪偣
+ calculatePolygonCenter: function calculatePolygonCenter(polygonPoints) {
+ var x = 0,
+ y = 0;
+ var numPoints = polygonPoints.length;
+ for (var i = 0; i < numPoints; i++) {
+ x += polygonPoints[i].latitude;
+ y += polygonPoints[i].longitude;
+ }
+ return {
+ latitude: x / numPoints,
+ longitude: y / numPoints
+ };
+ },
getSite: function getSite() {
- var _this = this;
+ var _this3 = this;
this.$u.api.rentSiteList().then(function (res) {
if (res.code === 200) {
- _this.markers = [];
+ _this3.markers = [];
res.data.forEach(function (item, index) {
- var num = (0, _utils.distance)(_this.latitude, _this.longitude, item.latitude, item.longitude);
- _this.markers.push({
+ var num = (0, _utils.distance)(_this3.latitude, _this3.longitude, item.latitude, item.longitude);
+ _this3.markers.push({
id: index,
width: 40,
height: 40,
- distance: _this.latitude && _this.longitude ? num : '鏈煡璺濈',
+ isShow: true,
+ distance: _this3.latitude && _this3.longitude ? num : '鏈煡璺濈',
latitude: item.latitude,
longitude: item.longitude,
title: item.name,
@@ -397,21 +569,31 @@
});
},
markertap: function markertap(e) {
- var _this2 = this;
+ var _this4 = this;
this.show = false;
this.markers.forEach(function (item) {
if (item.id === e.markerId) {
- _this2.rice = item.distance;
+ _this4.rice = item.distance;
item.customCallout.display = 'ALWAYS';
- item.width = 50;
- item.height = 50;
+ if (item.isShow) {
+ item.width = 50;
+ item.height = 50;
+ } else {
+ item.width = 40;
+ item.height = 50;
+ }
setTimeout(function () {
- _this2.info = item;
- _this2.show = true;
+ _this4.info = item;
+ _this4.show = true;
}, 300);
} else {
- item.width = 40;
- item.height = 40;
+ if (item.isShow) {
+ item.width = 40;
+ item.height = 40;
+ } else {
+ item.width = 30;
+ item.height = 40;
+ }
item.customCallout.display = 'BYCLICK';
}
});
--
Gitblit v1.9.3