From cc6ab7021c3aef6ca3bbf05f8bcb5bfe0e6f6096 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 18 三月 2025 16:52:18 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0.1' into 2.0.1

---
 bicycle/unpackage/dist/dev/mp-weixin/pages/maps/maps.js |  261 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 206 insertions(+), 55 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 ddb5022..64ad8d3 100644
--- a/bicycle/unpackage/dist/dev/mp-weixin/pages/maps/maps.js
+++ b/bicycle/unpackage/dist/dev/mp-weixin/pages/maps/maps.js
@@ -101,7 +101,7 @@
 try {
   components = {
     uPopup: function () {
-      return Promise.all(/*! import() | node-modules/uview-ui/components/u-popup/u-popup */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-popup/u-popup")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-popup/u-popup.vue */ 265))
+      return Promise.all(/*! import() | node-modules/uview-ui/components/u-popup/u-popup */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/uview-ui/components/u-popup/u-popup")]).then(__webpack_require__.bind(null, /*! uview-ui/components/u-popup/u-popup.vue */ 293))
     },
   }
 } catch (e) {
@@ -176,64 +176,58 @@
 "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 _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
 var _utils = __webpack_require__(/*! @/utils/utils.js */ 194);
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
+var _vuex = __webpack_require__(/*! vuex */ 33);
+function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
+function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
 var _default = {
   data: function data() {
     return {
+      type: null,
       show: false,
       latitude: '',
       longitude: '',
       markers: [],
       info: {},
-      rice: ''
+      rice: '',
+      infoData: {},
+      eleBusinessArea: [],
+      isShow: false
     };
   },
-  onLoad: function onLoad() {
+  computed: _objectSpread({}, (0, _vuex.mapState)(['userInfo'])),
+  onLoad: function onLoad(options) {
+    this.type = options.type;
     this.getAddress();
+    this.refresh();
   },
   methods: {
+    saoma: function saoma() {
+      uni.$emit('update', {
+        msg: '椤甸潰鏇存柊'
+      });
+      uni.navigateBack({
+        delta: 1
+      });
+    },
+    // 鍒锋柊棣栭〉淇℃伅
+    refresh: function refresh() {
+      var _this = this;
+      this.$u.api.home().then(function (res) {
+        if (res.code === 200) {
+          _this.isShow = res.data.memberRidesResponse ? false : true;
+        }
+      });
+    },
     // 鑾峰彇缁忕含搴�
     getAddress: function getAddress() {
       var that = this;
@@ -312,6 +306,46 @@
         }
       });
     },
+    getEleBikeList: function getEleBikeList() {
+      var _this2 = 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 _this2.$u.api.eleBikeList({});
+              case 2:
+                res = _context.sent;
+                if (res.code === 200) {
+                  res.data.forEach(function (item, index) {
+                    var num = (0, _utils.distance)(_this2.latitude, _this2.longitude, item.latitude, item.longitude);
+                    _this2.markers.push({
+                      id: index,
+                      width: 40,
+                      height: 40,
+                      distance: _this2.latitude && _this2.longitude ? num : '鏈煡璺濈',
+                      latitude: item.latitude,
+                      longitude: item.longitude,
+                      title: item.code,
+                      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 +356,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 +410,118 @@
         }
       });
     },
+    // 鑾峰彇鑼冨洿
+    getEleSiteList: function getEleSiteList() {
+      var _this3 = 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 _this3.$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 _this3.$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
+                      };
+                    });
+                  });
+                  _this3.eleBusinessArea = res.data.map(function (item) {
+                    return {
+                      points: item.electronicFence,
+                      title: item.name,
+                      fillColor: "#0077FF4D",
+                      strokeColor: "#0077FF",
+                      strokeWidth: 3,
+                      zIndex: 7
+                    };
+                  });
+                  _this3.eleBusinessArea.forEach(function (item) {
+                    var _this3$calculatePolyg = _this3.calculatePolygonCenter(item.points),
+                      latitude = _this3$calculatePolyg.latitude,
+                      longitude = _this3$calculatePolyg.longitude;
+                    var num = (0, _utils.distance)(_this3.latitude, _this3.longitude, latitude, longitude);
+                    _this3.markers.push({
+                      id: Math.floor(Math.random() * 900) + 100,
+                      width: 30,
+                      height: 40,
+                      isShow: false,
+                      title: item.title,
+                      distance: _this3.latitude && _this3.longitude ? num : '鏈煡璺濈',
+                      latitude: latitude,
+                      longitude: longitude,
+                      iconPath: '/static/icon/ic_park@2x.png',
+                      customCallout: {
+                        anchorY: 0,
+                        anchorX: 0,
+                        display: 'BYCLICK'
+                      }
+                    });
+                  });
+                }
+                _this3.eleBusinessArea = [].concat(array, (0, _toConsumableArray2.default)(_this3.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 _this4 = this;
       this.$u.api.rentSiteList().then(function (res) {
         if (res.code === 200) {
-          _this.markers = [];
+          _this4.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)(_this4.latitude, _this4.longitude, item.latitude, item.longitude);
+            _this4.markers.push({
               id: index,
               width: 40,
               height: 40,
-              distance: _this.latitude && _this.longitude ? num : '鏈煡璺濈',
+              isShow: true,
+              distance: _this4.latitude && _this4.longitude ? num : '鏈煡璺濈',
               latitude: item.latitude,
               longitude: item.longitude,
               title: item.name,
@@ -397,21 +538,31 @@
       });
     },
     markertap: function markertap(e) {
-      var _this2 = this;
+      var _this5 = this;
       this.show = false;
       this.markers.forEach(function (item) {
         if (item.id === e.markerId) {
-          _this2.rice = item.distance;
+          _this5.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;
+            _this5.info = item;
+            _this5.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