import {
    request
} from '@/untils/AxiosUtils.js';
import {
    jsonp
} from 'vue-jsonp'
/*逆地址解析*/
export const getcoder = (location, key, get_poi) => {
    return new Promise((resolve, reject) => {
        const paramsData = {
            location,
            key,
            get_poi,
            output: 'jsonp'
        }
        jsonp('https://apis.map.qq.com/ws/geocoder/v1', paramsData, 30000)
            .then((response) => {
                console.log('response', response)
                resolve({
                    data: response
                })
            }).catch(err => {
                reject(err)
            })
    })
}

// 地名解析
export const getAddresscoder = (params) => {
    return new Promise((resolve, reject) => {
        const paramsData = {
            ...params,
            output: 'jsonp'
        }
        jsonp('https://apis.map.qq.com/ws/geocoder/v1', paramsData, 30000)
            .then((response) => {
                return response
            }).catch(err => {
                reject(err)
            })
    })
}

/*关键词输入提示*/
export const querySearch = (keyword, key) => {
    return new Promise((resolve, reject) => {
        const paramsData = {
            keyword,
            key,
            output: 'jsonp'
        }
        jsonp('https://apis.map.qq.com/ws/place/v1/suggestion', paramsData, 30000)
            .then((response) => {
                console.log('response', response)
                resolve({
                    data: response
                })
            }).catch(err => {
                reject(err)
            })
    })
}

export const geQueryJobsByNearby = (params) => request({
    url: '/api/jobslink-api/nearby/job/queryJobsByNearby',
    method: 'get',
    params
});