42 lines
705 B
TypeScript
42 lines
705 B
TypeScript
import request from '@/utils/request'
|
|
|
|
export interface ILocation {
|
|
lat: number,
|
|
lng: number
|
|
}
|
|
|
|
/**
|
|
* 腾讯地图关键字输入提示返回的POI对象结构
|
|
*/
|
|
export interface IAreaData {
|
|
address: string,
|
|
id: string,
|
|
title: string,
|
|
province: string,
|
|
city: string,
|
|
district: string,
|
|
adcode: string,
|
|
type: number,
|
|
location: ILocation
|
|
}
|
|
|
|
export async function queryArea(str: string, region: string) {
|
|
let data = {keyword: str, region}
|
|
return request({
|
|
url: '/area/query',
|
|
method: 'post',
|
|
data
|
|
})
|
|
|
|
}
|
|
|
|
export async function addressToLoc(address: string) {
|
|
let data = { address }
|
|
return request({
|
|
url: '/area/geocoder',
|
|
method: 'post',
|
|
data
|
|
})
|
|
|
|
}
|