|
|
@@ -117,6 +117,7 @@ import BoxMid from '@/common/components/box/BoxMid.vue';
|
|
|
import Touchable from '@/components/feedback/Touchable.vue';
|
|
|
import Image from '@/components/basic/Image.vue';
|
|
|
import { getCascaderItemByValue } from '@/components/form/CascaderUtils';
|
|
|
+import { isValidLonLat } from '../composeabe/LonLat';
|
|
|
|
|
|
const mapCtx = uni.createMapContext('prevMap');
|
|
|
|
|
|
@@ -157,10 +158,25 @@ async function asyncLoadData(item: CascaderItem) {
|
|
|
function handlePickEnd(values: CascaderItem[]) {
|
|
|
if (values.length > 0) {
|
|
|
selectedRegion.value = values[values.length - 1].data;
|
|
|
- currentLonLat.value = {
|
|
|
- longitude: Number(selectedRegion.value!.longitude),
|
|
|
- latitude: Number(selectedRegion.value!.latitude),
|
|
|
- };
|
|
|
+ let i = values.length - 1;
|
|
|
+ for (; i >= 0; i--) {
|
|
|
+ const lonlat = {
|
|
|
+ longitude: Number(values[i].data.longitude),
|
|
|
+ latitude: Number(values[i].data.latitude),
|
|
|
+ };
|
|
|
+ if (isValidLonLat(lonlat)) {
|
|
|
+ currentLonLat.value = lonlat;
|
|
|
+ console.log('currentLonLat.value', currentLonLat.value);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (i !== values.length - 1) {
|
|
|
+ alert({
|
|
|
+ title: '提示',
|
|
|
+ content: '您的家乡暂时没有经纬度信息,麻烦您拖动地图至您的家乡准确位置',
|
|
|
+ confirmText: '好',
|
|
|
+ })
|
|
|
+ }
|
|
|
mapCtx.moveToLocation({
|
|
|
longitude: Number(currentLonLat.value.longitude),
|
|
|
latitude: Number(currentLonLat.value.latitude),
|