|
@@ -438,6 +438,7 @@
|
|
|
});
|
|
|
|
|
|
async function initMap() {
|
|
|
+ console.log('initMap');
|
|
|
await toPromise();
|
|
|
await nextTick();
|
|
|
const wrapEl = unref(wrapRef);
|
|
@@ -445,7 +446,7 @@
|
|
|
|
|
|
// center: [this.longitude || 120.262337, this.latitude || 30.178285],
|
|
|
// const geocoder = new AMap.Geocoder({});
|
|
|
-
|
|
|
+ let searchCity = getCode(defaultAddress.location);
|
|
|
const AMap = (window as any).AMap;
|
|
|
let center = [defaultAddress.lng, defaultAddress.lat];
|
|
|
map = new AMap.Map(wrapEl, {
|
|
@@ -459,7 +460,7 @@
|
|
|
AMap.plugin('AMap.Geocoder', function () {
|
|
|
var geocoder = new AMap.Geocoder({
|
|
|
// city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
|
|
|
- // city: '010',
|
|
|
+ city: searchCity[2] || searchCity[1] || searchCity[0],
|
|
|
});
|
|
|
geocoder.getLocation(defaultAddress.address, async function (status, result) {
|
|
|
if (status === 'complete' && result.info === 'OK') {
|
|
@@ -484,6 +485,8 @@
|
|
|
});
|
|
|
detailAddr.value = defaultAddress.address;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ createMessage.error('查询地址异常');
|
|
|
}
|
|
|
});
|
|
|
// const marker = new AMap.Marker({
|
|
@@ -501,6 +504,7 @@
|
|
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增直播间' : '编辑直播间'));
|
|
|
|
|
|
async function handleMapSearch() {
|
|
|
+ console.log('handleMapSearch');
|
|
|
console.log('detailAddr', detailAddr.value, defaultAddress);
|
|
|
if (detailAddr.value?.length > 0) {
|
|
|
let searchCity = getCode(defaultAddress.location);
|
|
@@ -545,6 +549,8 @@
|
|
|
});
|
|
|
// detailAddr.value = defaultAddress.address;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ createMessage.error('查询地址异常');
|
|
|
}
|
|
|
});
|
|
|
});
|