|
|
@ -58,13 +58,37 @@ export default { |
|
|
|
.map(([key, value]) => `${(key)}=${(value)}`) |
|
|
|
.join('&'); |
|
|
|
|
|
|
|
const fullUrl = `${baseUrl}?${queryString}`; |
|
|
|
let location = uni.getStorageSync('location') |
|
|
|
if (location) { |
|
|
|
queryString+=`&lon=${location.lon}&lat=${location.lat}` |
|
|
|
let fullUrl = `${baseUrl}?${queryString}`; |
|
|
|
console.log(fullUrl); |
|
|
|
this.url = fullUrl |
|
|
|
} else { |
|
|
|
uni.getLocation({ |
|
|
|
success: data => { |
|
|
|
uni.setStorageSync('location', { |
|
|
|
lat: data.latitude, |
|
|
|
lon: data.longitude |
|
|
|
}); |
|
|
|
queryString+=`&lon=${data.longitude}&lat=${data.latitude}` |
|
|
|
let fullUrl = `${baseUrl}?${queryString}`; |
|
|
|
console.log(fullUrl); |
|
|
|
this.url = fullUrl |
|
|
|
|
|
|
|
}, |
|
|
|
fail: res=> { |
|
|
|
let fullUrl = `${baseUrl}?${queryString}`; |
|
|
|
console.log(fullUrl, '获取定位失败', res); |
|
|
|
this.url = fullUrl |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
handleJDSZ (url) { |
|
|
@ -80,9 +104,33 @@ export default { |
|
|
|
.map(([key, value]) => `${(key)}=${(value)}`) |
|
|
|
.join('&'); |
|
|
|
|
|
|
|
const fullUrl = `${baseUrl}?${queryString}`; |
|
|
|
let location = uni.getStorageSync('location') |
|
|
|
if (location) { |
|
|
|
queryString+=`&lon=${location.lon}&lat=${location.lat}` |
|
|
|
let fullUrl = `${baseUrl}?${queryString}`; |
|
|
|
console.log(fullUrl); |
|
|
|
this.url = fullUrl |
|
|
|
} else { |
|
|
|
uni.getLocation({ |
|
|
|
success: data => { |
|
|
|
uni.setStorageSync('location', { |
|
|
|
lat: data.latitude, |
|
|
|
lon: data.longitude |
|
|
|
}); |
|
|
|
queryString+=`&lon=${data.longitude}&lat=${data.latitude}` |
|
|
|
let fullUrl = `${baseUrl}?${queryString}`; |
|
|
|
console.log(fullUrl); |
|
|
|
this.url = fullUrl |
|
|
|
|
|
|
|
}, |
|
|
|
fail: res=> { |
|
|
|
let fullUrl = `${baseUrl}?${queryString}`; |
|
|
|
console.log(fullUrl, '获取定位失败', res); |
|
|
|
this.url = fullUrl |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}).finally(()=>{ |
|
|
|
this.saveUrl = url |
|
|
|