From 6fefd1df691815a47844cb28b50521b630d942f4 Mon Sep 17 00:00:00 2001 From: Zhao Date: Mon, 28 Jul 2025 17:29:16 +0800 Subject: [PATCH] =?UTF-8?q?Task=20H5=E5=AE=9A=E4=BD=8D=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E6=8C=87=E7=A4=BA=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Map/MapGisLine.vue | 9 ++++++++- src/components/Map/MapGisTagDTGCopy.vue | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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); },