| | |
| | | <script> |
| | | import { mapState } from 'vuex' |
| | | // var QQMapWX = require('@/utils/qqmap-wx-jssdk.js') |
| | | var amapFile = require('@/utils/amap-wx.130.js') |
| | | export default { |
| | | computed: { |
| | |
| | | isHighAccuracy: true, |
| | | success: function (addr) { |
| | | const locParam = { latitude: addr.latitude, longitude: addr.longitude }; |
| | | // uni.setStorageSync('address', locParam); |
| | | var address = null |
| | | var myAmapFun = new amapFile.AMapWX({ key: 'e4d46c87adf151dca20060317592b1b6' }); |
| | | var myAmapFun = new amapFile.AMapWX({ key: that.$gaodeMapKey}); |
| | | myAmapFun.getRegeo({ |
| | | location: addr.longitude + ',' + addr.latitude, |
| | | success: async function(data) { |
| | | console.log(data, '==================获取地址'); |
| | | let info = data[0]; |
| | | console.log(info, '==================获取地址'); |
| | | locParam.province = info.province; |
| | | locParam.city = info.regeocodeData.addressComponent.city; |
| | | var ta = info.name || '地址获取失败'; |
| | | var ta = info.desc || '地址获取失败'; |
| | | locParam.address = ta |
| | | const resCity = await that.$u.api.getCityByName({ cityName: locParam.city }) |
| | | if (resCity.code === 200 && resCity.data) { |
| | |
| | | that.$isResolve() |
| | | } |
| | | }); |
| | | |
| | | // const qqmapsdk = new QQMapWX({ |
| | | // key: 'WE3BZ-HN6WS-ONDOH-62QCV-MNL6F-5NFNE' |
| | | // }); |
| | | // qqmapsdk.reverseGeocoder({ |
| | | // locParam, |
| | | // success: async function(res) { |
| | | // console.log(res, '==================获取地址'); |
| | | // let info = res.result; |
| | | // locParam.province = info.address_component.province; |
| | | // locParam.city = info.address_component.city; |
| | | // locParam.area = info.address_component.district; |
| | | // locParam.street = info.address_component.street; |
| | | // var ta = info.address || '地址获取失败' ; |
| | | // if(info.formatted_addresses && info.formatted_addresses.recommend){ |
| | | // ta =info.formatted_addresses.recommend |
| | | // } |
| | | // locParam.address =ta |
| | | // const resCity = await that.$u.api.getCityByName({ cityName: locParam.city }) |
| | | // if (resCity.code === 200) { |
| | | // locParam.cityId = resCity.data.id |
| | | // } |
| | | // that.$store.commit('setPosition',locParam) |
| | | // that.$isResolve() |
| | | // }, |
| | | // fail: (err) => { |
| | | // that.$isResolve() |
| | | // } |
| | | // }); |
| | | } |
| | | }); |
| | | }, |