1.修改ios 不能获取定位信息

yj-dev
杨杰 3 years ago
parent cb857da6b4
commit 109a2a3b9c
  1. 4
      .hbuilderx/launch.json
  2. 2
      Utils/Request.js
  3. 7
      pages.json
  4. 8
      pages/goods/refuel/refuel.vue
  5. 66
      pages/tabBar/category/category.vue
  6. 65
      pages/tabBar/home/home.vue

@ -2,6 +2,10 @@
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "remote"
},
"default" :
{
"launchtype" : "remote"

@ -58,7 +58,7 @@ function request(method, url, data) {
},
fail(err) {
uni.showToast({
title: '请求失败',
title: '网络异常',
icon: 'none',
duration: 1500,
})

@ -10,12 +10,7 @@
"onReachBottomDistance": 50,
"app-plus": {
"titleNView": false, //
"softinputNavBar": "none",
"subNVues": [{
"id": "homeTitleNvue", //
"path": "pages/tabBar/home/subNvue/homeTitleNvue", //
"type": "navigationBar"
}]
"softinputNavBar": "none"
}
}
}, {

@ -162,13 +162,7 @@
that.isTyAgent = true;
}
that.getGasStoreList();
// uni.getLocation({
// type: 'wgs84',
// success: function(res) {
// that.latitudeful = res.latitude;
// that.longitudeful = res.longitude;
// }
// })
},
onReachBottom() {
this.getGasStoreList();

@ -73,7 +73,8 @@
import {
getCouponList,
getStoreListByMerchant,
getMerchantList
getMerchantList,
findByLatAndLng
} from "../../../Utils/Api.js";
import wybPopup from '../../../components/wyb-popup/wyb-popup.vue';
let app = getApp();
@ -141,44 +142,39 @@
success: function(res) {
app.globalData.latitude = res.latitude;
app.globalData.longitude = res.longitude;
// #ifdef H5
that.getUserLocation(res.longitude, res.latitude);
// #endif
// #ifdef MP
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude +
',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
data: {},
success: function(res) {
that.city = res.data.result.address_component.city.replace(/市/g,
'');
app.globalData.cityId = res.data.result.ad_info.adcode;
// app.globalData.cityId = '500100';
that.getMerchantList();
}
})
// #endif
that.findByLatAndLng(res.longitude, res.latitude);
// uni.request({
// url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude +
// ',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
// data: {},
// success: function(res) {
// that.city = res.data.result.address_component.city.replace(//g,
// '');
// app.globalData.cityId = res.data.result.ad_info.adcode;
// // app.globalData.cityId = '500100';
// that.getMerchantList();
// }
// })
}
})
},
//
getUserLocation(long, lat) {
let vm = this;
let url =
'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1';
let locationObj = lat + ',' + long;
this.$jsonp(url, {
key: '7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
location: locationObj
})
.then(res => {
vm.city = res.result.address_component.city.replace(/市/g,
'');
app.globalData.cityId = res.result.ad_info.adcode;
vm.getMerchantList();
})
.catch(err => {
console.log(err);
findByLatAndLng(item, item1) {
let datas = {
lng: item,
lat: item1
}
findByLatAndLng(datas).then(res => {
if (res.return_code == '000000') {
this.city = res.return_data.result.addressComponent.province;
app.globalData.cityName = res.return_data.result.addressComponent
.province;
app.globalData.cityId = res.return_data.result.addressComponent.adcode;
// app.globalData.cityId = '500100';
if (res.return_data.result.addressComponent.adcode) {
this.getMerchantList();
}
}
});
},
//

@ -370,39 +370,35 @@
success: function(res) {
app.globalData.latitude = res.latitude;
app.globalData.longitude = res.longitude;
// #ifdef H5
uni.hideLoading();
that.findByLatAndLng(res.longitude, res.latitude);
// that.getUserLocation(res.longitude, res.latitude);
//#endif
// #ifdef MP
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude +
',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
data: {},
success: function(res) {
// that.city = res.data.result.address_component.city.replace(//g,
// '');
that.city = res.data.result.address_component.province;
app.globalData.cityName = res.data.result.address_component
.province;
app.globalData.cityId = res.data.result.ad_info.adcode;
uni.hideLoading();
if (res.data.result.ad_info.adcode) {
that.getCouponListArea();
that.getCouponListgold();
that.getCmsContent();
that.getCmsAactibity();
that.getCmsContentcmshome();
that.getCmsContentcmsContent();
}
},
fail(err) {
uni.hideLoading()
}
})
//#endif
// uni.request({
// url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude +
// ',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
// data: {},
// success: function(res) {
// // that.city = res.data.result.address_component.city.replace(//g,
// // '');
// that.city = res.data.result.address_component.province;
// app.globalData.cityName = res.data.result.address_component
// .province;
// app.globalData.cityId = res.data.result.ad_info.adcode;
// uni.hideLoading();
// if (res.data.result.ad_info.adcode) {
// that.getCouponListArea();
// that.getCouponListgold();
// that.getCmsContent();
// that.getCmsAactibity();
// that.getCmsContentcmshome();
// that.getCmsContentcmsContent();
// }
// },
// fail(err) {
// uni.hideLoading()
// }
// })
},
fail: (err) => {
if (err.errCode == 2) {
@ -428,16 +424,15 @@
app.globalData.cityName = res.return_data.result.addressComponent
.province;
app.globalData.cityId = res.return_data.result.addressComponent.adcode;
// app.globalData.cityId = '500100';
if (res.return_data.result.addressComponent.adcode) {
app.globalData.cityId = '500103';
// if (res.return_data.result.addressComponent.adcode) {
that.getCouponListArea();
that.getCouponListgold();
uni.hideLoading();
that.getCmsContent();
that.getCmsAactibity();
that.getCmsContentcmshome();
that.getCmsContentcmsContent();
}
// }
uni.getStorage({
key: 'accountType',
success(e) {

Loading…
Cancel
Save