| | |
| | | }); |
| | | myAmapFun.getRegeo({ |
| | | location: addr.longitude + ',' + addr.latitude, |
| | | success: function success(data) { |
| | | console.log(data, '==================获取地址'); |
| | | var info = data[0]; |
| | | locParam.province = info.province; |
| | | locParam.city = info.city; |
| | | locParam.area = info.district; |
| | | locParam.street = info.street; |
| | | var ta = info.name || '地址获取失败'; |
| | | locParam.address = ta; |
| | | that.$store.commit('setPosition', locParam); |
| | | that.$isResolve(); |
| | | }, |
| | | success: function () { |
| | | var _success2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(data) { |
| | | var info, ta, resCity; |
| | | return _regenerator.default.wrap(function _callee3$(_context3) { |
| | | while (1) { |
| | | switch (_context3.prev = _context3.next) { |
| | | case 0: |
| | | console.log(data, '==================获取地址'); |
| | | info = data[0]; |
| | | locParam.province = info.province; |
| | | locParam.city = info.regeocodeData.addressComponent.city; |
| | | ta = info.name || '地址获取失败'; |
| | | locParam.address = ta; |
| | | _context3.next = 8; |
| | | return that.$u.api.getCityByName({ |
| | | cityName: locParam.city |
| | | }); |
| | | case 8: |
| | | resCity = _context3.sent; |
| | | if (resCity.code === 200) { |
| | | locParam.cityId = resCity.data.id; |
| | | } |
| | | that.$store.commit('setPosition', locParam); |
| | | that.$isResolve(); |
| | | case 12: |
| | | case "end": |
| | | return _context3.stop(); |
| | | } |
| | | } |
| | | }, _callee3); |
| | | })); |
| | | function success(_x2) { |
| | | return _success2.apply(this, arguments); |
| | | } |
| | | return success; |
| | | }(), |
| | | fail: function fail(err) { |
| | | console.error('获取位置失败===========', err); |
| | | that.$store.commit('setPosition', locParam); |