|
楼主 |
发表于 2016-6-13 14:08:01
|
显示全部楼层
我实在不知道思路了,崩溃了
- // 加载地图并且计算距离
- Model.prototype.loadBaiduMap = function() {
- var id = this.getIDByXID("baiduMap");
- var inforData = this.comp("inforData");
- window._baiduInit = function() {
- var map = new BMap.Map(id);
- // 判断当前位置与城市坐标的距离
- var pointA = new BMap.Point(justep.Shell.longitude.get(), justep.Shell.latitude.get());// 起点-当前位置
- var pointB = null;// 终点-城市坐标
- m = new disMap();
- inforData.each(function(obj) {
- var infor_id = inforData.getValue("infor_id", obj.row);
- var long = inforData.getValue("infor_longitude", obj.row);
- var lat = inforData.getValue("infor_latitude", obj.row);
- pointB = new BMap.Point(long, lat);
- inforData.setValue("infor_spare2", (map.getDistance(pointA, pointB) / 1000).toFixed(2), obj.row);
- m.set(infor_id, (map.getDistance(pointA, pointB) / 1000).toFixed(2));
- });
- alert("第一个orderBy==="+inforData.getOrderBy("infor_spare2"));
- inforData.setOrderBy("infor_spare2", 1);
-
- alert("第二个orderBy==="+inforData.getOrderBy("infor_spare2"));
- };
- // 判断网络是否正常
- // alert(navigator.connection.type);
- if (navigator.connection.type == "none" || navigator.connection.type == "NONE") {
- justep.Util.hint("亲,你的网络没有链接好!");
- return false;
- } else {
- require([ 'http://api.map.baidu.com/api?ak=EzfQTH533pbevnhohMX4QZRK&v=2.0&callback=_baiduInit' ], function() {
- if (!(window.BMap && window.BMap.apiLoad)) {
- window._baiduInit();
- }
- });
- }
- };
复制代码 |
|