|
@@ -23,6 +23,7 @@ |
|
|
import {getQueryLand} from "@/api/homesteadSurvey/zjdzd"; |
|
|
import {getQueryLand} from "@/api/homesteadSurvey/zjdzd"; |
|
|
import $ from "jquery"; |
|
|
import $ from "jquery"; |
|
|
import { getConfigKey } from "@/api/system/config"; |
|
|
import { getConfigKey } from "@/api/system/config"; |
|
|
|
|
|
import {Toast} from "vant"; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
components: { |
|
|
components: { |
|
@@ -147,11 +148,15 @@ export default { |
|
|
// 2. 再尝试浏览器 |
|
|
// 2. 再尝试浏览器 |
|
|
if (navigator.geolocation) { |
|
|
if (navigator.geolocation) { |
|
|
console.log('使用浏览器获取定位'); |
|
|
console.log('使用浏览器获取定位'); |
|
|
|
|
|
const loading = Toast.loading({ |
|
|
|
|
|
message: '定位中...', |
|
|
|
|
|
duration: 0, |
|
|
|
|
|
}); |
|
|
let timeout = this.getLocationTimeout(); |
|
|
let timeout = this.getLocationTimeout(); |
|
|
navigator.geolocation.getCurrentPosition( |
|
|
navigator.geolocation.getCurrentPosition( |
|
|
(position) => { |
|
|
(position) => { |
|
|
const { latitude, longitude } = position.coords; |
|
|
const { latitude, longitude } = position.coords; |
|
|
console.log('浏览器定位结果: 经纬度=' + longitude + ', ' + latitude);1 |
|
|
|
|
|
|
|
|
console.log('浏览器定位结果: 经纬度=' + longitude + ', ' + latitude); |
|
|
let res = { |
|
|
let res = { |
|
|
code: 200, |
|
|
code: 200, |
|
|
data: { |
|
|
data: { |
|
@@ -159,9 +164,11 @@ export default { |
|
|
lat: latitude, |
|
|
lat: latitude, |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
loading.clear(); |
|
|
callback(res); |
|
|
callback(res); |
|
|
}, |
|
|
}, |
|
|
(error) => { |
|
|
(error) => { |
|
|
|
|
|
loading.clear(); |
|
|
console.log('定位失败: ' + error.message); |
|
|
console.log('定位失败: ' + error.message); |
|
|
getQueryLand().then(callback); |
|
|
getQueryLand().then(callback); |
|
|
}, |
|
|
}, |
|
|