邓洁 : 修改发布地址问题

This commit is contained in:
邓洁
2023-12-06 22:51:18 +08:00
parent 2199f88725
commit 12a810cc0d
5 changed files with 20 additions and 8 deletions

View File

@@ -45,7 +45,7 @@
}, },
data() { data() {
return { 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: '', currentNum: '',
keyword: '' keyword: ''
}; };
@@ -130,7 +130,7 @@
let district = re.result.ad_info.district let district = re.result.ad_info.district
// console.log('city-code', re.result.ad_info.city_code.substring(3)); // 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_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('district', district);
that.getRegionList() that.getRegionList()
// that.position = city.slice(0, 2) + district.slice(0, 2) // that.position = city.slice(0, 2) + district.slice(0, 2)

View File

@@ -193,10 +193,12 @@
// console.log(re.result.ad_info.district); // console.log(re.result.ad_info.district);
let city = re.result.ad_info.city let city = re.result.ad_info.city
let district = re.result.ad_info.district 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)); // 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_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('district', district);
uni.setStorageSync('province', province);
that.getRegionList() that.getRegionList()
// that.position = city.slice(0, 2) + district.slice(0, 2) // that.position = city.slice(0, 2) + district.slice(0, 2)
}, },

View File

@@ -320,11 +320,15 @@
}) })
}, },
getAddressList(value) { getAddressList(value) {
let address = this.form.region.split('-')[1] + value
// console.log('uni.getStorageSync()', uni.getStorageSync('province'), uni.getStorageSync('city'));
var that = this var that = this
uni.request({ 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, that.$api.key,
success(res) { success(res) {
// console.log('地址转经纬度', that.form.region.split('-')[0], address, res.data);
if (res.data.message == "query ok") { if (res.data.message == "query ok") {
// console.log('lat', res.data.result.location.lat); // console.log('lat', res.data.result.location.lat);
that.form.latitude = res.data.result.location.lat that.form.latitude = res.data.result.location.lat

View File

@@ -345,11 +345,15 @@
uni.$u.toast('请先选择区域') uni.$u.toast('请先选择区域')
return false return false
} }
let address = this.form.region.split('-')[1] + value
// console.log('uni.getStorageSync()', uni.getStorageSync('province'), uni.getStorageSync('city'));
var that = this var that = this
uni.request({ 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, that.$api.key,
success(res) { success(res) {
// console.log('地址转经纬度', that.form.region.split('-')[0], address, res.data);
// console.log('diz', res.data.result.location); // console.log('diz', res.data.result.location);
if (res.data.message == "query ok") { if (res.data.message == "query ok") {
// console.log('lat', res.data.result.location.lat); // console.log('lat', res.data.result.location.lat);

View File

@@ -345,13 +345,15 @@
uni.$u.toast('请先选择区域') uni.$u.toast('请先选择区域')
return false return false
} }
let address = this.form.region.split('-')[1] + value
var that = this var that = this
// console.log('uni.getStorageSync()', uni.getStorageSync('province'), uni.getStorageSync('city'));
uni.request({ 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, that.$api.key,
success(res) { 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") { if (res.data.message == "query ok") {
// console.log('lat', res.data.result.location.lat); // console.log('lat', res.data.result.location.lat);
that.form.latitude = res.data.result.location.lat that.form.latitude = res.data.result.location.lat