diff --git a/components/InputAndSwiper/InputAndSwiper.vue b/components/InputAndSwiper/InputAndSwiper.vue index 5d4c8bb..ebfedab 100644 --- a/components/InputAndSwiper/InputAndSwiper.vue +++ b/components/InputAndSwiper/InputAndSwiper.vue @@ -45,7 +45,7 @@ }, data() { return { - position: uni.getStorageSync('city') + uni.getStorageSync('district').slice(0, 2), + position: uni.getStorageSync('city').slice(0, 2) + uni.getStorageSync('district').slice(0, 2), currentNum: '', keyword: '' }; @@ -130,7 +130,7 @@ let district = re.result.ad_info.district // console.log('city-code', re.result.ad_info.city_code.substring(3)); uni.setStorageSync('city_code', re.result.ad_info.city_code.substring(3)); - uni.setStorageSync('city', city.slice(0, 2)); + uni.setStorageSync('city', city); uni.setStorageSync('district', district); that.getRegionList() // that.position = city.slice(0, 2) + district.slice(0, 2) diff --git a/pages/index/index.vue b/pages/index/index.vue index f1ef1f5..02733d3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -193,10 +193,12 @@ // console.log(re.result.ad_info.district); let city = re.result.ad_info.city let district = re.result.ad_info.district + let province = re.result.ad_info.province // console.log('city-code', re.result.ad_info.city_code.substring(3)); uni.setStorageSync('city_code', re.result.ad_info.city_code.substring(3)); - uni.setStorageSync('city', city.slice(0, 2)); + uni.setStorageSync('city', city); uni.setStorageSync('district', district); + uni.setStorageSync('province', province); that.getRegionList() // that.position = city.slice(0, 2) + district.slice(0, 2) }, diff --git a/pages/publish/publishInvestment/publishInvestment.vue b/pages/publish/publishInvestment/publishInvestment.vue index d92aa0b..fde3f4e 100644 --- a/pages/publish/publishInvestment/publishInvestment.vue +++ b/pages/publish/publishInvestment/publishInvestment.vue @@ -320,11 +320,15 @@ }) }, getAddressList(value) { + let address = this.form.region.split('-')[1] + value + // console.log('uni.getStorageSync()', uni.getStorageSync('province'), uni.getStorageSync('city')); var that = this uni.request({ - url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + that.form.region + value + '&key=' + + url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + uni.getStorageSync('province') + uni + .getStorageSync('city') + that.form.region.split('-')[0] + address + '&key=' + that.$api.key, success(res) { + // console.log('地址转经纬度', that.form.region.split('-')[0], address, res.data); if (res.data.message == "query ok") { // console.log('lat', res.data.result.location.lat); that.form.latitude = res.data.result.location.lat diff --git a/pages/publish/publishRent/publishRent.vue b/pages/publish/publishRent/publishRent.vue index 5acae29..7d3ab20 100644 --- a/pages/publish/publishRent/publishRent.vue +++ b/pages/publish/publishRent/publishRent.vue @@ -345,11 +345,15 @@ uni.$u.toast('请先选择区域') return false } + let address = this.form.region.split('-')[1] + value + // console.log('uni.getStorageSync()', uni.getStorageSync('province'), uni.getStorageSync('city')); var that = this uni.request({ - url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + that.form.region + value + '&key=' + + url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + uni.getStorageSync('province') + uni + .getStorageSync('city') + that.form.region.split('-')[0] + address + '&key=' + that.$api.key, success(res) { + // console.log('地址转经纬度', that.form.region.split('-')[0], address, res.data); // console.log('diz', res.data.result.location); if (res.data.message == "query ok") { // console.log('lat', res.data.result.location.lat); diff --git a/pages/publish/publishTransfer/publishTransfer.vue b/pages/publish/publishTransfer/publishTransfer.vue index 55d638f..ceb2b31 100644 --- a/pages/publish/publishTransfer/publishTransfer.vue +++ b/pages/publish/publishTransfer/publishTransfer.vue @@ -345,13 +345,15 @@ uni.$u.toast('请先选择区域') return false } - + let address = this.form.region.split('-')[1] + value var that = this + // console.log('uni.getStorageSync()', uni.getStorageSync('province'), uni.getStorageSync('city')); uni.request({ - url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + that.form.region + value + '&key=' + + url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + uni.getStorageSync('province') + uni + .getStorageSync('city') + that.form.region.split('-')[0] + address + '&key=' + that.$api.key, success(res) { - // console.log('地址转经纬度', that.form.region, res.data); + // console.log('地址转经纬度', that.form.region.split('-')[0], address, res.data); if (res.data.message == "query ok") { // console.log('lat', res.data.result.location.lat); that.form.latitude = res.data.result.location.lat