xiaozy
xiaozhiyong 2 years ago
parent 19ad15f345
commit 791d9f13ec
  1. 6
      src/store/piniaIndex.js
  2. 4
      src/views/HomeView.vue
  3. 6
      src/views/orderDetails/components/oilNextFooter.vue

@ -34,9 +34,9 @@ const instance = defineStore('user', {
let geolocation = new AMap.Geolocation({ let geolocation = new AMap.Geolocation({
// enableHighAccuracy: true // 是否使用高精度定位,默认:true // enableHighAccuracy: true // 是否使用高精度定位,默认:true
}) })
geolocation.getCurrentPosition(function (status, result) { geolocation.getCurrentPosition((status, result) => {
console.log('piniaIndex status', status) // console.log('piniaIndex status', status)
console.log('piniaIndex result', result) // console.log('piniaIndex result', result)
if (status === 'complete') { if (status === 'complete') {
let { lat: latitude, lng: longitude } = result.position let { lat: latitude, lng: longitude } = result.position
this.position = { latitude, longitude } this.position = { latitude, longitude }

@ -137,8 +137,8 @@ export default {
// enableHighAccuracy: true // 使true // enableHighAccuracy: true // 使true
}) })
geolocation.getCurrentPosition((status, result) => { geolocation.getCurrentPosition((status, result) => {
console.log('status', status) // console.log('status', status)
console.log('result', result) // console.log('result', result)
if (status === 'complete') { if (status === 'complete') {
let { lat: latitude, lng: longitude } = result.position let { lat: latitude, lng: longitude } = result.position
this.position = { latitude, longitude } this.position = { latitude, longitude }

@ -126,7 +126,11 @@ export default {
if (this.positionChenk(position)) { if (this.positionChenk(position)) {
position = JSON.parse(localStorage.getItem('position')) position = JSON.parse(localStorage.getItem('position'))
if (this.positionChenk(position)) { if (this.positionChenk(position)) {
console.log(position, this.$pinia.state.value.user.position, '地理位置错误') Notify({
message: '地理位置错误',
type: 'danger',
duration: 1000
})
return return
} }
} }

Loading…
Cancel
Save