|

楼主 |
发表于 2017-3-3 17:49:09
|
显示全部楼层
geo提供的获取位置就是百度的坐标,其实没有转换的必要。这个“案例缺陷”什么时候修正?会有通知吗?
顺便贴上我的代码:
- Model.prototype.button5Click = function(event){
- var self = this;
- if (justep.Browser.isWeChat){
- // if (justep.Browser.isX5App || justep.Browser.isWeChat){ //保留JS-API提供的显示位置代码geo
- if (confirm("希望查看你的大概位置吗?")) {
- self.openApiLocation();
- } else {}
- }else if(justep.Browser.isX5App){
- if (confirm("希望查看你的大概位置吗?")) {
- var longitude = window.wLongitude;
- var latitude = window.wLatitude;
- var name = "BaiduMap";
- appAvailability.check({
- ios : "baidumap://", // URL Scheme
- android : "com.baidu.BaiduMap" // 包名
- }, success(name), fail(name));
- function success(name) { // 成功回调
- bmap.marker({
- location : latitude + "," + longitude,
- title : "您的大概位置",
- content : "已经为您打开百度地图,该服务由百度提供。",
- src : "http://www.mfxxl.com"
- });
- }
- function fail(name) { // 失败回调
- return function() {
- window.location.href = "http://map.baidu.com/mobile/webapp/index/index/foo=bar/vt=map";
- };
- }
- } else {}
- } else {
- if (confirm("希望查看你的大概位置吗?")) { //网页打开腾讯地图
- self.poiMarker();
- } else {}
- }
- };
复制代码 |
|