| | |
| | | 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) { |
| | |
| | | "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; |
| | |
| | | } |
| | | }); |
| | | }, |
| | | 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; |
| | |
| | | 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 监听地理位置变化") { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | // 获取范围 |
| | | 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, |
| | |
| | | }); |
| | | }, |
| | | 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'; |
| | | } |
| | | }); |