|
|
@ -19,6 +19,9 @@ |
|
|
|
import homeNavBar from '@/components/homeNavBar.vue' |
|
|
|
import homeNavBar from '@/components/homeNavBar.vue' |
|
|
|
import listItem from '@/components/listItem.vue' |
|
|
|
import listItem from '@/components/listItem.vue' |
|
|
|
import oilSiteApi from '@/api/oil-site.js' |
|
|
|
import oilSiteApi from '@/api/oil-site.js' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import initAMap from '@/utils/amap.js' |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
homeNavBar, |
|
|
|
homeNavBar, |
|
|
@ -122,17 +125,20 @@ export default { |
|
|
|
return !position?.latitude && !position?.longitude ? true : false |
|
|
|
return !position?.latitude && !position?.longitude ? true : false |
|
|
|
}, |
|
|
|
}, |
|
|
|
getlist() { |
|
|
|
getlist() { |
|
|
|
let position = this.$pinia.state.value.user.position |
|
|
|
initAMap().then(() => { |
|
|
|
// console.log('position', position) |
|
|
|
let AMap = this.$AMap |
|
|
|
// console.log(Object.assign(this.page.params, position), position, '地理位置数据') |
|
|
|
let geolocation = new AMap.Geolocation({ |
|
|
|
if (this.positionChenk(position)) { |
|
|
|
// enableHighAccuracy: true // 是否使用高精度定位,默认:true |
|
|
|
position = JSON.parse(localStorage.getItem('position')) |
|
|
|
}) |
|
|
|
if (this.positionChenk(position)) { |
|
|
|
geolocation.getCurrentPosition((status, result) => { |
|
|
|
// console.log(position, this.$pinia.state.value.user.position, '地理位置错误') |
|
|
|
if (status === 'complete') { |
|
|
|
this.finished = true |
|
|
|
let { lat: latitude, lng: longitude } = result.position |
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
// this.position = { latitude, longitude } |
|
|
|
} |
|
|
|
// console.log('this.position', this.position) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let position = { latitude, longitude } |
|
|
|
|
|
|
|
|
|
|
|
this.page.params = Object.assign(this.page.params, position) |
|
|
|
this.page.params = Object.assign(this.page.params, position) |
|
|
|
this.loading = true |
|
|
|
this.loading = true |
|
|
|
oilSiteApi |
|
|
|
oilSiteApi |
|
|
@ -150,12 +156,14 @@ export default { |
|
|
|
this.loading = false |
|
|
|
this.loading = false |
|
|
|
this.refreshing = false |
|
|
|
this.refreshing = false |
|
|
|
} |
|
|
|
} |
|
|
|
// console.log(res) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
.catch(error => { |
|
|
|
this.finished = true |
|
|
|
this.finished = true |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|