一些现成的小东西
//键盘敲击监听事件 document.onkeydown = function (event) { var e = event || window.event || arguments.callee.caller.arguments[0]; if (e && e.keyCode == 8) { // BackSpace vm.autoReshDrone = false; } }; //**************************************************************************************************************************** // 百度地图API功能 this.map = new BMap.Map("mapDiv", {mapType:BMAP_HYBRID_MAP}); // 创建Map实例 this.map.centerAndZoom(new BMap.Point(107.000, 27.000), 5); this.map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放 this.map.disableDragging();//禁止拖拽 this.map.enableContinuousZoom();//启用连续缩放效果 this.map.disableDoubleClickZoom();//禁用双击放大 setTimeout(function(){ vm.map.enableDragging();//两秒后开启拖拽 }, 1500); this.map.clearOverlays(); bottom_right_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT});// 右下角,添加比例尺 bottom_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT}); //右下角,添加默认缩放平移控件 this.map.addControl(bottom_right_control); // this.map.addControl(bottom_right_navigation); this.map.addEventListener("dragend",function(){ var bs = vm.map.getBounds(); //获取可视区域 var bssw = bs.getSouthWest(); //可视区域左下角 var bsne = bs.getNorthEast(); //可视区域右上角 var zoom = vm.map.getZoom(); // vm.loadMapInfo("dragend", bssw, bsne, zoom); }); this.map.addEventListener("zoomend",function(){ var bs = vm.map.getBounds(); //获取可视区域 var bssw = bs.getSouthWest(); //可视区域左下角 var bsne = bs.getNorthEast(); //可视区域右上角 var zoom = vm.map.getZoom(); // vm.loadMapInfo("zoomend", bssw, bsne, zoom); }); this.map.addEventListener("click", function(e){ if(e.overlay){ return ; } vm.selectDroneOn = false; vm.lastFarmlandId = 0; }); //********************************************************************************************************************************** //毫秒数转中国时间 formatDateTime(new Date(vm.droneStatus.localTime * 1000 - vm.droneStatus.bootTime)); js当前时间转中国时间 formatDateTime(new Date(new Date().getTime())); function formatDateTime(theDate) { var _hour = theDate.getHours(); var _minute = theDate.getMinutes(); var _second = theDate.getSeconds(); var _year = theDate.getFullYear() var _month = theDate.getMonth(); var _date = theDate.getDate(); if (_hour < 10) { _hour = "0" + _hour; } if (_minute < 10) { _minute = "0" + _minute; } if (_second < 10) { _second = "0" + _second } _month = _month + 1; if (_month < 10) { _month = "0" + _month; } if (_date < 10) { _date = "0" + _date } return _year + "-" + _month + "-" + _date + " " + _hour + ":" + _minute + ":" + _second; }; //************************************************************************************************************** //百度地图画标注 经纬度逆解析 map_click: function (lon, lat) { var bdPoint = wgs84tobd09([{lon:lon, lat:lat}]); var point = new BMap.Point(bdPoint[0].lon, bdPoint[0].lat); this.map.centerAndZoom(point, 14); var imgSize = new BMap.Size(23, 23); var myIcon = new BMap.Icon("/resources/monitor/images/UAV-red1.png", imgSize); myIcon.setImageSize(imgSize); var marker2 = new BMap.Marker(point, {icon: myIcon});// 创建标注 this.map.addOverlay(marker2);// 将标注添加到地图中 var geoc = new BMap.Geocoder(); geoc.getLocation(point, function (rs) { var addComp = rs.addressComponents; var address = addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber; vm.droneInfo.address = address==''?'--':address; }); }, //************************************************************************************************************ //转百度经纬度 function wgs84tobd09(points){ //var pointsTmp = []; for(i in points){ var wgs84togcj02 = coordtransform.wgs84togcj02(points[i].lon, points[i].lat); var gcj02tobd09 = coordtransform.gcj02tobd09(wgs84togcj02[0], wgs84togcj02[1]); points[i].lon = gcj02tobd09[0]; points[i].lat = gcj02tobd09[1]; } return points; } //************************************************************************************************************ //数字校验 checkDroneUid:function (obj){ var str=obj.toString(); if(obj==""){ return false; } if (isNaN(obj)||str.length!=8) { return false; } if(obj<0){ return false; } if(str.split(".").length > 1 && str.split(".")[1].length > 1){ return false; } return true; }, //*************************************************************************************************************** //手机号校验 checkIphone:function (obj){ if(obj==""){ return false; } //手机号正则 var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; //电话 var phone=obj.toString(); if (!phoneReg.test(phone)) { return false; } return true; }, //*************************************************************************************************************** //列表滚轮定位 var objTr = document.getElementsByClassName("lists-group-item on-select")[0];//转化为dom对象 $("#trajectorieslist").animate({scrollTop:objTr.offsetTop-155},"slow"); //定位tr //************************************************************************************************************* //select option 指定选中 $("option[value='volvo']").prop("selected", true); //************************************************************************************************************ //时间戳转时间 function longToTimeString(time){ if(!time){ return '--' } var timeDate; if(time instanceof Date){ timeDate = time; }else{ timeDate = new Date(time); } return timeDate.getFullYear() +(timeDate.getMonth() < 9 ? '-0'+(timeDate.getMonth()+1):'-'+(timeDate.getMonth()+1)) +(timeDate.getDate() < 10 ? '-0'+timeDate.getDate():'-'+timeDate.getDate()) +(timeDate.getHours() < 10 ? ' 0'+timeDate.getHours():' '+timeDate.getHours()) +(timeDate.getMinutes() < 10 ? ':0'+timeDate.getMinutes():':'+timeDate.getMinutes()) +(timeDate.getSeconds() < 10 ? ':0'+timeDate.getSeconds():':'+timeDate.getSeconds()) ; }; //***********************************************************************************************************
demandStatus:[{"key":-1,"value":"全部"},{"key":0,"value":"已取消"},{"key":1,"value":"已提交"},/*{"key":2,"value":"满员"},{"key":3,"value":"待作业"},*/{"key":4,"value":"作业中"},{"key":5,"value":"已完成"}], //搜索ding下拉框初始值
<select class="form-control" id="demandStatus" v-model="demandSelected" onmousewheel="return false">
<option v-for="item in demandStatus" :value="item.key">{{item.value}}</option>
</select>
//**********************************************************************************************************
请留下你的足迹...