WorkCamera/uniapp/WorkCameraf/common/mapTranslateResult.js
2025-12-27 12:17:46 +08:00

30 lines
753 B
JavaScript

// request.js 需自行实现或使用 axios/fetch 等库
import {
get
} from "./request";
import {
getBaseUrl
} from './server'
// 腾讯地图基础配置
const TENGXUN_BASE = getBaseUrl() + "webapi";
/** 转换 GPS 经纬度 */
export const getLocationTranslate = async (locations) => {
console.log(TENGXUN_BASE);
const url = `${TENGXUN_BASE}/GetLocationTranslate?locations=${locations}&type=1`;
const res = await get(url, {});
// console.log(res);
if (res.code == 200) {
return res.data;
}
return "";
}
/** 根据转换后的经纬度获取地址 */
export const getLocationGeocoder = async (locations) => {
const url = `${TENGXUN_BASE}/GetLocationGeocoder?location=${locations}`;
const res = await get(url, {});
return res.data;
}