起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1750|回复: 1

[处理中3] 百度地图的显示问题

[复制链接]

265

主题

614

帖子

1171

积分

金牌会员

Rank: 6Rank: 6

积分
1171
QQ
发表于 2017-11-6 09:12:52 | 显示全部楼层 |阅读模式
我的应用需要展现地图,打包运行后,地图显示不出来。apploader中显示是正常的,由于环境不同,代码是在apploader中完整抄过去的。
QQ图片20171106091048.jpg


实际代码为:
  1. define(function(require){
  2.         var $ = require("jquery");
  3.         var justep = require("$UI/system/lib/justep");
  4.         require("cordova!cordova-plugin-geolocation");
  5.         require("cordova!com.justep.cordova.plugin.baidulocation");
  6.         require("cordova!com.justep.cordova.plugin.baiduMapBase");
  7.         require("cordova!com.justep.cordova.plugin.baiduMapSearch");

  8.         var Model = function(){
  9.                 this.callParent();
  10.                 this._lon ;
  11.                 this._lat ;
  12.         };

  13.         Model.prototype.modelParamsReceive = function(event){
  14.                 //百度地图显示
  15.        var my = this ;
  16.                 //打开地图
  17.        var lat = event.data.lat ;
  18.        var lon = event.data.lon ;
  19.        alert(lat) ;
  20.                 navigator.baiduMap.base.open({
  21.                          "position":{x:0, y:48, w:$(window).width(), h:$(window).height()-48},
  22.                          //"position":{x:0, y:$(window).height()-300-50, w:$(window).width(), h:300},                //成功
  23.                          //"position":{x:0, y:$(window).height(), w:$(window).width(), h:$(window).height()},
  24.                          //"center":{lon:my._lon, lat:my._lat},
  25.                          "center":{lon:lon, lat:lat},
  26.                          "zoomLevel":15,
  27.                          "events":{"click":onClick,"dbClick":ondbClick,"longPress":onLongPress}
  28.                 }, function(){
  29.                         justep.Util.hint("成功");
  30.                 }, callBack);
  31.         };

  32.         var onClick = function(event,args){
  33.                 justep.Util.hint(JSON.stringify(args));
  34.         };
  35.         var ondbClick = function(event,args){
  36.                 justep.Util.hint(JSON.stringify(args));
  37.         };
  38.         var onLongPress = function(event,args){
  39.                 justep.Util.hint(JSON.stringify(args));
  40.         };
  41.         var callBack = function(info){
  42.                 console.log(JSON.stringify(info));
  43.                 justep.Util.hint(JSON.stringify(info));
  44.         };
  45.        
  46.         Model.prototype.button1Click = function(event){
  47.                 //显示当前位置
  48.                 navigator.baiduMap.base.showCurrentLocation({
  49.                         isShow:true,
  50.                         trackingMode:"none"
  51.                 });
  52.         };
  53.        
  54.         Model.prototype.button2Click = function(event){
  55.                 //添加大头针
  56.                 navigator.baiduMap.base.addAnnotations([{
  57.                         id:1,
  58.                         title:"盐城市政府",
  59.                         //subTitle:"张三",
  60.                         lon:120.1688153093,
  61.                         lat:33.3543605899,
  62.                         draggable:true,
  63.                         color:navigator.baiduMap.base.annotationColor.Red
  64.                 },{
  65.                         id:2,
  66.                         title:"创投中心",
  67.                         //subTitle:"李四",
  68.                         lon:120.1730808076,
  69.                         lat:33.3527067751,
  70.                         draggable:false,
  71.                         color:navigator.baiduMap.base.annotationColor.Purple
  72.                 },{
  73.                         id:3,
  74.                         title:"科技馆",
  75.                         //subTitle:"王五",
  76.                         lon:120.1743008076,
  77.                         lat:33.3514367751,
  78.                         draggable:false,
  79.                         color:navigator.baiduMap.base.annotationColor.Green
  80.                 }], callBack, callBack);       
  81.         };
  82.        
  83.         Model.prototype.backBtnClick = function(event){
  84.                 navigator.baiduMap.base.close();
  85.                 this.close() ;
  86.         };
  87.        
  88.         return Model;
  89. });
复制代码

请老师指导一下,我的错误在哪里?
非常感谢!




发表于 2017-11-6 09:39:44 | 显示全部楼层
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-7-1 03:26 , Processed in 0.061474 second(s), 26 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表