H5 通过腾讯地图api定点位置
uniapp版本
selectPosition(e) {
uni.setStorageSync("b_page_index", e); // 存入当前选择
let _latitude = "";
let _longitude = "";
console.log("111");
uni.getLocation({
type: "wgs84",
success: (res) => {
console.log(res);
_longitude = res.longitude;
_latitude = res.latitude;
let url = "https://apis.map.qq.com/tools/locpicker?";
url =
url +
"type=0&backurl=" +
encodeURIComponent(
window.location.protocol +
"//" +
window.location.host +
"/h5/#/pages/index/book-car-service"
); // 选择类型及拼接回跳地址
url = url + "&coord=" + _latitude + "," + _longitude; // 经纬度
url = url + "&key=" + this.key + "&referer=myapp"; // 开发密钥及应用名称
console.log(url)
window.location.href = url; // 跳转腾讯地图选点组件
},
});
},
let url = "https://apis.map.qq.com/tools/locpicker?";
url =
url +
"type=0&backurl=" +
encodeURIComponent(
window.location.protocol +
"//" +
window.location.host +
"/h5/#/pages/customer/home"
); // 选择类型及拼接回跳地址
url = url + "&coord=" + _latitude + "," + _longitude; // 经纬度
url = url + "&key=" + this.key + "&referer=myapp"; // 开发密钥及应用名称
// console.log('url :>> ', url);
window.location.href = url; // 跳转腾讯地图选点组件
地图选址的组件:
https://lbs.qq.com/webApi/component/componentGuide/componentPicker

浙公网安备 33010602011771号