diff --git a/src/components/Map/MapGisLine.vue b/src/components/Map/MapGisLine.vue index b8ae4dd9..14869cbd 100644 --- a/src/components/Map/MapGisLine.vue +++ b/src/components/Map/MapGisLine.vue @@ -23,6 +23,7 @@ import {getQueryLand} from "@/api/homesteadSurvey/zjdzd"; import $ from "jquery"; import { getConfigKey } from "@/api/system/config"; + import {Toast} from "vant"; export default { components: { @@ -147,11 +148,15 @@ export default { // 2. 再尝试浏览器 if (navigator.geolocation) { console.log('使用浏览器获取定位'); + const loading = Toast.loading({ + message: '定位中...', + duration: 0, + }); let timeout = this.getLocationTimeout(); navigator.geolocation.getCurrentPosition( (position) => { const { latitude, longitude } = position.coords; - console.log('浏览器定位结果: 经纬度=' + longitude + ', ' + latitude);1 + console.log('浏览器定位结果: 经纬度=' + longitude + ', ' + latitude); let res = { code: 200, data: { @@ -159,9 +164,11 @@ export default { lat: latitude, }, }; + loading.clear(); callback(res); }, (error) => { + loading.clear(); console.log('定位失败: ' + error.message); getQueryLand().then(callback); }, diff --git a/src/components/Map/MapGisTagDTGCopy.vue b/src/components/Map/MapGisTagDTGCopy.vue index efe6f81e..9ef8d90d 100644 --- a/src/components/Map/MapGisTagDTGCopy.vue +++ b/src/components/Map/MapGisTagDTGCopy.vue @@ -21,6 +21,7 @@ import Cookies from "js-cookie"; import {getQueryLand} from "@/api/homesteadSurvey/zjdzd"; import { getConfigKey } from "@/api/system/config"; + import {Toast} from "vant"; export default { data() { @@ -143,6 +144,10 @@ // 2. 再尝试浏览器 if (navigator.geolocation) { console.log('使用浏览器获取定位'); + const loading = Toast.loading({ + message: '定位中...', + duration: 0, + }); let timeout = this.getLocationTimeout(); navigator.geolocation.getCurrentPosition( (position) => { @@ -155,9 +160,11 @@ lat: latitude, }, }; + loading.clear(); callback(res); }, (error) => { + loading.clear(); console.log('定位失败: ' + error.message); getQueryLand().then(callback); },