【优化】因系统地址库存在与腾讯小程序地图返回数据有差异,导致省市县反向解析获取失败,将省市县重置为下拉选取,地图保留作为获取精确坐标及地址详情的触发。

This commit is contained in:
JianWeie
2022-06-21 14:49:32 +08:00
parent ea2969e69a
commit 25167908c4

View File

@@ -25,26 +25,30 @@
<!-- #ifndef APP-NVUE -->
<u-input :value="pickerValue" type="select" disabled placeholder="请选择省市区区域">
<template slot="suffix">
<u-button text="请选择" type="success" size="mini" @click="toMap"></u-button>
<!--<u-button text="请选择" type="success" size="mini" @click="toMap"></u-button>-->
<u-button text="请选择" type="success" size="mini" @click="show = true"></u-button>
</template>
</u-input>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<u--input :value="pickerValue" type="select" disabled placeholder="请选择省市区区域">
<template slot="suffix">
<u-button text="请选择" type="success" size="mini" @click="toMap"></u-button>
<!--<u-button text="请选择" type="success" size="mini" @click="toMap"></u-button>-->
<u-button text="请选择" type="success" size="mini" @click="show = true"></u-button>
</template>
</u--input>
<!-- #endif -->
</u-form-item>
<u-form-item label="地点" borderBottom>
<u-form-item label="街道社区" borderBottom @click="toMap">
<!-- 注意由于兼容性差异如果需要使用前后插槽nvue下需使用u--input非nvue下需使用u-input -->
<!-- #ifndef APP-NVUE -->
<u-input :value="form.street" type="text" disabled placeholder="请选择"></u-input>
<u-input :value="form.street" type="text" disabled placeholder="请定位">
</u-input>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<u--input :value="form.street" type="text" disabled placeholder="请选择"></u--input>
<u--input :value="form.street" type="text" disabled placeholder="请定位">
</u--input>
<!-- #endif -->
</u-form-item>
@@ -161,23 +165,23 @@
this.form.street = location.name;
this.form.address = location.address;
let postData = {
countyName: location.district,
cityName: location.city,
provinceName: location.province,
}
this.$u.api.getAreaIdByName(postData).then(res => {
if (res.status) {
this.areaId = res.data.areaId;
this.pickerValue = res.data.fullName;
} else {
uni.showModal({
title: '提示',
content: '地区选择出现问题,请重新选择地区',
showCancel: false
});
}
});
//let postData = {
// countyName: location.district,
// cityName: location.city,
// provinceName: location.province,
//}
//this.$u.api.getAreaIdByName(postData).then(res => {
// if (res.status) {
// this.areaId = res.data.areaId;
// this.pickerValue = res.data.fullName;
// } else {
// uni.showModal({
// title: '提示',
// content: '地区选择出现问题,请重新选择地区',
// showCancel: false
// });
// }
//});
console.log("location1:", location);
}
},