diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 075b9c5..261ce48 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -2,6 +2,10 @@ // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 "version": "0.0", "configurations": [{ + "app-plus" : + { + "launchtype" : "remote" + }, "default" : { "launchtype" : "remote" diff --git a/Utils/Request.js b/Utils/Request.js index eae7132..b74d33a 100644 --- a/Utils/Request.js +++ b/Utils/Request.js @@ -58,7 +58,7 @@ function request(method, url, data) { }, fail(err) { uni.showToast({ - title: '请求失败', + title: '网络异常', icon: 'none', duration: 1500, }) diff --git a/pages.json b/pages.json index 8185efe..88abafb 100644 --- a/pages.json +++ b/pages.json @@ -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" } } }, { diff --git a/pages/goods/refuel/refuel.vue b/pages/goods/refuel/refuel.vue index ea767a7..de9aade 100644 --- a/pages/goods/refuel/refuel.vue +++ b/pages/goods/refuel/refuel.vue @@ -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(); diff --git a/pages/tabBar/category/category.vue b/pages/tabBar/category/category.vue index 5e1d1a8..16d5614 100644 --- a/pages/tabBar/category/category.vue +++ b/pages/tabBar/category/category.vue @@ -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(); + } + } }); }, // 商户列表 diff --git a/pages/tabBar/home/home.vue b/pages/tabBar/home/home.vue index 8d82847..3a5bb55 100644 --- a/pages/tabBar/home/home.vue +++ b/pages/tabBar/home/home.vue @@ -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) {