EverySingleDay

来源:互联网 发布:手机屏幕校准软件 编辑:程序博客网 时间:2024/06/04 19:18


【JS空值判断】

空值的检测 使用了 str.match(/^[ ]*$/)可以判断一个或者多个空格 或者空字符串, 返回值为该对象

【jquery合理运用】

在页面上 利用jquery的选择器 搜索div的时候,选择jquery的选择器还是直接查找某一个节点的各关系节点,通过页面布局是否固定来确定要不要全局搜索。
选择器 会进行页面的全局搜索,如果页面足够大,会导致效率低,在页面布局较为固定的情况,
可以在某一个节点的基础上,使用jquery丰富的API查找到关系节点,达到提高效率的目的。


【请求timeout】

在与服务端交互的时候,服务端需要对请求做处理,并且在服务端响应可能会很长的情况下,需要给ajax请求设置一个timeout的等待时长,

合理的等待时长,可以使响应能准确的回到。而不至于响应回来的时候,已经过去了。

例如:

appcan.request.ajax({    url:     type: "POST",    contentType: 'application/json; charset=utf-8',    dataType: "json",    timeout : 100000,    data: JSON.stringify(objData),    headers: 
    suCb:
    errorCb:
)}

--------------------------------------------------------------

【基本配置】

1.下载java JDK

2.解压安装在c盘下,安装之后路径:C:\Program Files (x86)\Java\jdk1.6.0_13

3.在【我的电脑】【高级系统设置】中,【系统变量】  添加JAVA_HOME    路径:C:\Program Files (x86)\Java\jdk1.6.0_13

4.添加系统变量Path 路径C:\Program Files (x86)\Java\jdk1.6.0_13

5.CLASS_PATH  javahome的路径 加上lib中的 dt.jar 和 tools.jar 即可


【收藏的书签】

http://xxgblog.com/ 

https://mvnrepository.com/artifact/junit/junit mavenRepository的地址 查看maven


[地图]

添加气泡,当前位置和气泡的显示

需要注意看一下,list打开的页面,跟其他的list是一个页面,所以布局发生了变化。导致一直会占有其他的页面。

还有地图打开后,获取到页面的高度。 应该算上footer的高度。

<!DOCTYPE html><html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px"><head>    <title></title>    <meta charset="utf-8">    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">    <link rel="stylesheet" href="../../css/fonts/font-awesome.min.css">    <link rel="stylesheet" href="../../css/ui-box.css">    <link rel="stylesheet" href="../../css/ui-base.css">    <link rel="stylesheet" href="../../css/ui-color.css">    <link rel="stylesheet" href="../../css/appcan.icon.css">    <link rel="stylesheet" href="../../css/appcan.control.css">    <link rel="stylesheet" href="../../css/eflow.css">    <link rel="stylesheet" href="../../mainpage_content/css/main.css"></head><body class="um-vp " ontouchstart><div id="page_0" class="up ub ub-ver bc-bg" tabindex="0">    <!--header开始-->    <!--<div id="header" class="uh bc-text-head ub bc-head eflow_bg_blue">-->    <!--<div class="nav-btn" id="nav-left">-->    <!--<div class="fa fa-angle-left fa-2x"></div>-->    <!--</div>-->    <!--<h1 class="ut ub-f1 ulev-3 ut-s tx-c" tabindex="0"></h1>-->    <!--<div class="nav-btn nav-bt" id="nav-right"></div>-->    <!--</div>-->    <!--header结束--><!--content开始-->    <div id="my_location_content" class="ub-f1 tx-l">    </div>    <!--content结束--></div><script src="../../js/appcan.js"></script><script src="../../js/appcan.control.js"></script><script src="../../js/jquery.i18n.properties.js"></script><script src="../../js/frame/location_utils.js"></script></body><script>    //缩放级别 米 3-19    var zoomLevels = [2000000, 1000000, 500000, 200000, 100000, 50000, 25000, 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20];    $.i18n.properties({        name : 'strings',        path : '../resources/i18n/',        mode : 'map',        callback : function() {            $("#header").find("h1").html($.i18n.prop("my_Location"));            $("#nav-right").html($.i18n.prop("my_location_refresh"));        }    });    window.uexOnload = function() {        var titHeight = appcan.locStorage.getVal("titHeight");        appcan.locStorage.remove("titHeight");        var mapW = $('#my_location_content').offset().width;        var mapH = $('#my_location_content').offset().height;        uexBaiduMap.cbCurrentLocation = function(data) {            if (data) {                data = JSON.parse(data);                if (data.longitude && data.latitude) {                    uexBaiduMap.setCenter(data.longitude, data.latitude);                    uexBaiduMap.setMyLocationEnable(1);                    appcan.locStorage.setVal("MYLOCATIONLONGITUDE", data.longitude);                    appcan.locStorage.setVal("MYLOCATIONLATITUDE", data.latitude);                    var my_location_mark_flag = appcan.locStorage.getVal("my_location_mark_flag");                    if (my_location_mark_flag == "attPlace") {                        var attLongitude = appcan.locStorage.getVal("my_location_mark_longitude");                        var attLatitude = appcan.locStorage.getVal("my_location_mark_latitude");                        var distance_service = appcan.require("location_util");                        if(data.latitude && data.longitude && attLatitude && attLongitude){                            var distance = distance_service.getGreatCircleDistance(parseFloat(data.latitude), parseFloat(data.longitude), parseFloat(attLatitude), parseFloat(attLongitude));                            if (distance <= 200) {                                uexBaiduMap.setZoomLevel(17);                            } else {                                for (var i = 0; i < zoomLevels.length; i++) {                                    if (2 * zoomLevels[i] <= distance) {                                        uexBaiduMap.setZoomLevel(i + 3);                                        break;                                    }                                }                            }                        }else{                            uexBaiduMap.getCurrentLocation();                        }                    }                }            } else {                uexBaiduMap.getCurrentLocation();            }            uexBaiduMap.hideMap();        };        //默认中心点 或者 当前位置        var longitude_storage = appcan.locStorage.getVal("MYLOCATIONLONGITUDE") || '104.07436';        var latitude_storage = appcan.locStorage.getVal("MYLOCATIONLATITUDE") || '30.549281';        uexBaiduMap.open(0, titHeight, mapW, mapH, longitude_storage, latitude_storage);        uexBaiduMap.setZoomEnable(1);        //uexBaiduMap.zoomControlsEnabled(1)        uexBaiduMap.setZoomLevel(14);        uexBaiduMap.getCurrentLocation();        var my_location_mark_flag = appcan.locStorage.getVal("my_location_mark_flag");        if (my_location_mark_flag == "attPlace") {            var attLongitude = appcan.locStorage.getVal("my_location_mark_longitude");            var attLatitude = appcan.locStorage.getVal("my_location_mark_latitude");            //alert(attLongitude);            //alert(attLatitude);            if (attLongitude != "0" && attLongitude!=null && attLatitude != "0" && attLatitude!=null) {//                addMark("id0001", attLongitude, attLatitude);                addMark("taskId001", "104.07436", "30.549281");                addMark("taskId002", attLongitude, attLatitude);                addMark("taskId003", attLongitude, attLatitude);                //if (uexWidgetOne.platformName && uexWidgetOne.platformName.toLowerCase().indexOf('ios') > -1){//                setMark("id0001", attLongitude, attLatitude);                setMark("taskId001", "104.07436", "30.549281");                //}            }            //appcan.locStorage.remove("my_location_mark_flag");        }        uexWidgetOne.cbError = function(opid, type, data) {            alert(data);        };        uexBaiduMap.onSDKReceiverError = function makerListner(json) {            //alert("onSDKReceiverError: " + json);        };        uexBaiduMap.hideMap();    };    function addMark(markId, longitudeValue, latitudeValue) {        var data = [{            id : markId,            icon : "res://my_att_place.png",            bubble : {                title : $.i18n.prop("attendance_place"),                bgImage : ""            },            longitude : longitudeValue,            latitude : latitudeValue        }];        var dataStr = JSON.stringify(data);        uexBaiduMap.addMarkersOverlay(dataStr);        uexBaiduMap.showBubble(markId);    }    function setMark(markId, longitudeValue, latitudeValue) {        var makerInfo = {            makerInfo : {                icon : "res://my_att_place.png",                bubble : {                    title : $.i18n.prop("attendance_place"),                    bgImage : ""                },                longitude : longitudeValue,                latitude : latitudeValue            }        };        var jsonStr = JSON.stringify(makerInfo);        uexBaiduMap.setMarkerOverlay(markId, jsonStr);        uexBaiduMap.showBubble(markId);    }    appcan.button("#nav-left", "btn-act", function(a, b) {        //需要关闭一下内层页面吗        uexBaiduMap.close();        appcan.closeWin(-1);    });        //更改为刷新的按钮 再次获取当前的位置    appcan.button("#nav-right", "btn-act", function(a, b) {        //alert(uexBaiduMap.getCurrentLocation);        uexBaiduMap.cbCurrentLocation = function(data) {            //alert(data);            if (data) {                data = JSON.parse(data);                if (data.longitude && data.latitude) {                    uexBaiduMap.setCenter(data.longitude, data.latitude);                    uexBaiduMap.setMyLocationEnable(1);                    appcan.locStorage.setVal("MYLOCATIONLONGITUDE", data.longitude);                    appcan.locStorage.setVal("MYLOCATIONLATITUDE", data.latitude);                }            } else {                uexBaiduMap.getCurrentLocation();            }        }        uexBaiduMap.getCurrentLocation();    });</script></html>