gree_leran/utils/location.js

24 lines
471 B
JavaScript
Raw Normal View History

2024-06-16 01:04:56 +00:00
import {
http
} from "./http.js"
const key = "ae9fa14b945ed3a3ff054e5a189a7478"
export function coordinateToLocation(longitude, latitude) {
return new Promise((resolve,reject)=>{
uni.request({
url: "https://restapi.amap.com/v3/geocode/regeo",
method: "get",
data: {
key: key,
location: `${longitude},${latitude}`
// coordsys: "gps"
},
success(res) {
console.log(res)
resolve(res)
},
fail(err) {
reject(err)
}
})
})
}