| | |
| | | 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 { |
| | |
| | | markers: [], |
| | | info: {}, |
| | | rice: '', |
| | | eleBusinessArea: [] |
| | | infoData: {}, |
| | | eleBusinessArea: [], |
| | | isShow: false |
| | | }; |
| | | }, |
| | | 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 _this = this; |
| | | var _this2 = this; |
| | | return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { |
| | | var res; |
| | | return _regenerator.default.wrap(function _callee$(_context) { |
| | |
| | | switch (_context.prev = _context.next) { |
| | | case 0: |
| | | _context.next = 2; |
| | | return _this.$u.api.eleBikeList({}); |
| | | 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)(_this.latitude, _this.longitude, item.latitude, item.longitude); |
| | | _this.markers.push({ |
| | | var num = (0, _utils.distance)(_this2.latitude, _this2.longitude, item.latitude, item.longitude); |
| | | _this2.markers.push({ |
| | | id: index, |
| | | width: 40, |
| | | height: 40, |
| | | distance: _this.latitude && _this.longitude ? num : '未知距离', |
| | | distance: _this2.latitude && _this2.longitude ? num : '未知距离', |
| | | latitude: item.latitude, |
| | | longitude: item.longitude, |
| | | title: item.name, |
| | | title: item.code, |
| | | iconPath: '/static/icon/ic_bike@2x.png', |
| | | customCallout: { |
| | | anchorY: 0, |
| | |
| | | }, |
| | | // 获取范围 |
| | | getEleSiteList: function getEleSiteList() { |
| | | var _this2 = this; |
| | | 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) { |
| | |
| | | case 0: |
| | | array = []; |
| | | _context2.next = 3; |
| | | return _this2.$u.api.getEleBusinessArea({}); |
| | | return _this3.$u.api.getEleBusinessArea({}); |
| | | case 3: |
| | | quan = _context2.sent; |
| | | if (quan.code === 200) { |
| | |
| | | }); |
| | | } |
| | | _context2.next = 7; |
| | | return _this2.$u.api.eleSiteList({}); |
| | | return _this3.$u.api.eleSiteList({}); |
| | | case 7: |
| | | res = _context2.sent; |
| | | if (res.code === 200) { |
| | |
| | | }; |
| | | }); |
| | | }); |
| | | _this2.eleBusinessArea = res.data.map(function (item) { |
| | | _this3.eleBusinessArea = res.data.map(function (item) { |
| | | return { |
| | | points: item.electronicFence, |
| | | title: item.name, |
| | |
| | | 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({ |
| | | _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: _this2.latitude && _this2.longitude ? num : '未知距离', |
| | | distance: _this3.latitude && _this3.longitude ? num : '未知距离', |
| | | latitude: latitude, |
| | | longitude: longitude, |
| | | iconPath: '/static/icon/ic_park@2x.png', |
| | |
| | | }); |
| | | }); |
| | | } |
| | | _this2.eleBusinessArea = [].concat(array, (0, _toConsumableArray2.default)(_this2.eleBusinessArea)); |
| | | _this3.eleBusinessArea = [].concat(array, (0, _toConsumableArray2.default)(_this3.eleBusinessArea)); |
| | | case 10: |
| | | case "end": |
| | | return _context2.stop(); |
| | |
| | | }; |
| | | }, |
| | | getSite: function getSite() { |
| | | var _this3 = this; |
| | | var _this4 = this; |
| | | this.$u.api.rentSiteList().then(function (res) { |
| | | if (res.code === 200) { |
| | | _this3.markers = []; |
| | | _this4.markers = []; |
| | | res.data.forEach(function (item, index) { |
| | | var num = (0, _utils.distance)(_this3.latitude, _this3.longitude, item.latitude, item.longitude); |
| | | _this3.markers.push({ |
| | | var num = (0, _utils.distance)(_this4.latitude, _this4.longitude, item.latitude, item.longitude); |
| | | _this4.markers.push({ |
| | | id: index, |
| | | width: 40, |
| | | height: 40, |
| | | isShow: true, |
| | | distance: _this3.latitude && _this3.longitude ? num : '未知距离', |
| | | distance: _this4.latitude && _this4.longitude ? num : '未知距离', |
| | | latitude: item.latitude, |
| | | longitude: item.longitude, |
| | | title: item.name, |
| | |
| | | }); |
| | | }, |
| | | markertap: function markertap(e) { |
| | | var _this4 = this; |
| | | var _this5 = this; |
| | | this.show = false; |
| | | this.markers.forEach(function (item) { |
| | | if (item.id === e.markerId) { |
| | | _this4.rice = item.distance; |
| | | _this5.rice = item.distance; |
| | | item.customCallout.display = 'ALWAYS'; |
| | | if (item.isShow) { |
| | | item.width = 50; |
| | |
| | | item.height = 50; |
| | | } |
| | | setTimeout(function () { |
| | | _this4.info = item; |
| | | _this4.show = true; |
| | | _this5.info = item; |
| | | _this5.show = true; |
| | | }, 300); |
| | | } else { |
| | | if (item.isShow) { |