1.修改H5 定位问题

yj-dev
杨杰 2 years ago
parent 3f48b10e59
commit f7e0dfa745
  1. 4
      pages/goods/refuel-details/refuel-details.vue
  2. 25
      pages/tabBar/home/home.vue

@ -264,7 +264,7 @@
latitude: app.globalData.latitude,
longitude: app.globalData.longitude,
isTyAgent: this.isTyAgent
}
}
recentGasStation(params).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
@ -304,7 +304,7 @@
latitude: app.globalData.latitude,
longitude: app.globalData.longitude,
isTyAgent: this.isTyAgent
}
}
getGasDetailByStoreKey(params).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {

@ -249,7 +249,12 @@
})
// #endif
//
// #ifdef MP
this.postionIng();
// #endif
// #ifdef H5
this.getCoordinates();
// #endif
uni.getStorage({
key: "user",
success(e) {
@ -428,6 +433,26 @@
}
})
},
//H5
getCoordinates() {
let that = this;
//
let data = {
key: "7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB" //密钥,需要在腾讯位置服务官网(https://lbs.qq.com/申请自己的密钥
};
let url = "https://apis.map.qq.com/ws/location/v1/ip"; //IP
data.output = "jsonp";
//IP
this.$jsonp(url, data)
.then(res => {
app.globalData.latitude = res.result.location.lat;
app.globalData.longitude = res.result.location.lng;
that.getUserLocation(res.result.location.lng, res.result.location.lat);
})
.catch(error => {
console.log(error);
});
},
//
findByLatAndLng(item, item1) {
let that = this;

Loading…
Cancel
Save