41 lines
719 B
TypeScript
41 lines
719 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
|
|
showStr?: string
|
|
}
|
|
|
|
export async function queryArea(str: string, region: string) {
|
|
const data = { keyword: str, region }
|
|
return request({
|
|
url: '/area/query',
|
|
method: 'post',
|
|
data
|
|
})
|
|
}
|
|
|
|
export async function addressToLoc(address: string) {
|
|
const data = { address }
|
|
return request({
|
|
url: '/area/geocoder',
|
|
method: 'post',
|
|
data
|
|
})
|
|
}
|