|
@@ -2,24 +2,34 @@ layui.use('element', function() {
|
|
|
var element = layui.element;
|
|
|
layer = layui.layer;
|
|
|
});
|
|
|
+
|
|
|
+// if (screen.availWidth <= 750) {
|
|
|
+// $('.logo-img').attr('src', '/img/map-logo2.png');
|
|
|
+// $('.logo-img').css("width", "257px");
|
|
|
+// }
|
|
|
+
|
|
|
$(function() {
|
|
|
- $("input").bind('keyup blur',function(){
|
|
|
- var reg= /[^\w\u4e00-\u9fa5\/\-]/gi;
|
|
|
- var val=$(this).val();
|
|
|
- if(reg.test(val)){
|
|
|
- $(this).val($(this).val().replace(reg,''));
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
+ // 全部输入框特殊字符不能输入
|
|
|
+ // 匹配标志: g:全局匹配 i:忽略大小写
|
|
|
+ // / 是表达式开始和结束的标记
|
|
|
+ // \ 可以将后面出现的字符标记为特殊字符
|
|
|
+ // ^ 匹配输入字符串的开始位置,除非在方括号表达式中使用,当该符号在方括号表达式中使用时,表示不接受该方括号表达式中的字符集合。要匹配 ^ 字符本身,请使用 \^。
|
|
|
+ // \w 匹配字母、数字、下划线。等价于 [A-Za-z0-9_]
|
|
|
+ // $("input").bind('keyup blur', function() {
|
|
|
+ // // var reg= /[^\w\u4e00-\u9fa5\/\-]/gi;
|
|
|
+ // var reg = /[^\w\u4e00-\u9fa5]/gi;
|
|
|
+ // var val = $(this).val();
|
|
|
+ // if (reg.test(val)) {
|
|
|
+ // $(this).val($(this).val().replace(reg, ''));
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
// 点击市级部门下的文字地址选择切换样式 街镇选择开始
|
|
|
$('.text-first p').click(function() {
|
|
|
$(this).addClass('tab');
|
|
|
$(this).siblings().removeClass('tab');
|
|
|
const jztext = $(this).text();
|
|
|
var index = $(this).index() - 1;
|
|
|
-
|
|
|
-
|
|
|
// console.log(index)
|
|
|
if (jztext == "南坪镇") {
|
|
|
var jd = ['重庆市南岸区响水路7号'];
|
|
@@ -108,20 +118,6 @@ $(function() {
|
|
|
$('.inp-icon2').click(function() {
|
|
|
let start = $('#gj-one').val();
|
|
|
let end = $('#gj-two').val();
|
|
|
- if (!/^([\u4e00-\u9fa5A-Za-z0-9,.?!;,。?!、;])*$/.test(start)) {
|
|
|
- return false;
|
|
|
- $('.show-first').css('display', 'block');
|
|
|
- $('.show-second').css('display', 'none');
|
|
|
- $('.show-third').css('display', 'none');
|
|
|
- $('.show-fourth').css('display', 'none');
|
|
|
- }
|
|
|
- if (!/^([\u4e00-\u9fa5A-Za-z0-9,.?!;,。?!、;])*$/.test(end)) {
|
|
|
- return false;
|
|
|
- $('.show-first').css('display', 'block');
|
|
|
- $('.show-second').css('display', 'none');
|
|
|
- $('.show-third').css('display', 'none');
|
|
|
- $('.show-fourth').css('display', 'none');
|
|
|
- }
|
|
|
if (start === "" || end === "") {
|
|
|
$('.show-first').css('display', 'block');
|
|
|
$('.show-second').css('display', 'none');
|
|
@@ -157,7 +153,7 @@ $(function() {
|
|
|
$('.show-fourth').css('display', 'none');
|
|
|
// bdGEO(jzadds);
|
|
|
bdGEO(jzs);
|
|
|
- })
|
|
|
+ });
|
|
|
// 点击公交的出现结果部分的路径选择查看具体路径
|
|
|
$('.line-first').click(function() {
|
|
|
$(this).parent('.line').siblings().find(".line-hide").css('display', 'none');
|
|
@@ -191,20 +187,6 @@ $(function() {
|
|
|
$('.inp-icon3').click(function() {
|
|
|
let start = $('#zj-one').val();
|
|
|
let end = $('#zj-two').val();
|
|
|
- if (!/^([\u4e00-\u9fa5A-Za-z0-9,.?!;,。?!、;])*$/.test(start)) {
|
|
|
- return false;
|
|
|
- $('.show-first').css('display', 'block');
|
|
|
- $('.show-second').css('display', 'none');
|
|
|
- $('.show-third').css('display', 'none');
|
|
|
- $('.show-fourth').css('display', 'none');
|
|
|
- }
|
|
|
- if (!/^([\u4e00-\u9fa5A-Za-z0-9,.?!;,。?!、;])*$/.test(end)) {
|
|
|
- return false;
|
|
|
- $('.show-first').css('display', 'block');
|
|
|
- $('.show-second').css('display', 'none');
|
|
|
- $('.show-third').css('display', 'none');
|
|
|
- $('.show-fourth').css('display', 'none');
|
|
|
- }
|
|
|
if (start === "" || end === "") {
|
|
|
$('.show-first').css('display', 'block');
|
|
|
$('.show-second').css('display', 'none');
|
|
@@ -219,8 +201,6 @@ $(function() {
|
|
|
$('#end2').text(end);
|
|
|
}
|
|
|
});
|
|
|
- // 点击头部的搜索的搜索按钮在左边出现结果
|
|
|
-
|
|
|
|
|
|
// 写受理场所和查阅场所前的icon切换
|
|
|
$('.top-title>li').click(function() {
|
|
@@ -597,22 +577,25 @@ $(function() {
|
|
|
"<span>" + sum + "</span>" +
|
|
|
"条记录"
|
|
|
);
|
|
|
- $(".title-first").bind('keyup blur','.inps',function(){
|
|
|
- var reg= /[^\w\u4e00-\u9fa5\/\-]/gi;
|
|
|
- var item = $(this).find('.inps');
|
|
|
- var val=item.val();
|
|
|
- if(reg.test(val)){
|
|
|
- item.val(item.val().replace(reg,''));
|
|
|
- }
|
|
|
- });
|
|
|
- $(".title-first").bind('keyup blur','.inpst',function(){
|
|
|
- var reg= /[^\w\u4e00-\u9fa5\/\-]/gi;
|
|
|
- var item = $(this).find('.inpst');
|
|
|
- var val=item.val();
|
|
|
- if(reg.test(val)){
|
|
|
- item.val(item.val().replace(reg,''));
|
|
|
- }
|
|
|
- });
|
|
|
+ // 点击公交或者自驾出现隐藏层中的输入框,让其不能输入特殊字符
|
|
|
+ // $(".title-first").bind('keyup blur', '.inps', function() {
|
|
|
+ // // var reg= /[^\w\u4e00-\u9fa5\/\-]/gi;
|
|
|
+ // var reg = /[^\w\u4e00-\u9fa5]/gi;
|
|
|
+ // var item = $(this).find('.inps');
|
|
|
+ // var val = item.val();
|
|
|
+ // if (reg.test(val)) {
|
|
|
+ // item.val(item.val().replace(reg, ''));
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // $(".title-first").bind('keyup blur', '.inpst', function() {
|
|
|
+ // // var reg= /[^\w\u4e00-\u9fa5\/\-]/gi;
|
|
|
+ // var reg = /[^\w\u4e00-\u9fa5]/gi;
|
|
|
+ // var item = $(this).find('.inpst');
|
|
|
+ // var val = item.val();
|
|
|
+ // if (reg.test(val)) {
|
|
|
+ // item.val(item.val().replace(reg, ''));
|
|
|
+ // }
|
|
|
+ // });
|
|
|
}
|
|
|
|
|
|
// 区级部门循环渲染
|
|
@@ -658,13 +641,13 @@ $(function() {
|
|
|
"<span>" + num + "</span>" +
|
|
|
"条记录"
|
|
|
);
|
|
|
- $(".districtLevel>input").bind('keyup blur',function(){
|
|
|
- var reg= /[^\w\u4e00-\u9fa5\/\-]/gi;
|
|
|
- var val=$(this).val();
|
|
|
- if(reg.test(val)){
|
|
|
- $(this).val($(this).val().replace(reg,''));
|
|
|
- }
|
|
|
- });
|
|
|
+ // $(".districtLevel>input").bind('keyup blur', function() {
|
|
|
+ // var reg = /[^\w\u4e00-\u9fa5\/\-]/gi;
|
|
|
+ // var val = $(this).val();
|
|
|
+ // if (reg.test(val)) {
|
|
|
+ // $(this).val($(this).val().replace(reg, ''));
|
|
|
+ // }
|
|
|
+ // });
|
|
|
};
|
|
|
|
|
|
// 点击市级部门下公交出现输入框并点击中间的切换按钮能够切换起点和终点
|
|
@@ -672,14 +655,14 @@ $(function() {
|
|
|
let inps = $('.inps').css('left');
|
|
|
if (inps == '0px') {
|
|
|
$('.inps').css('left', '90px');
|
|
|
- }
|
|
|
+ }
|
|
|
if (inps == '90px') {
|
|
|
$('.inps').css('left', '0px');
|
|
|
}
|
|
|
let inpText = $('.inp-text').css('left');
|
|
|
if (inpText == '220px') {
|
|
|
$('.inp-text').css('left', '0px');
|
|
|
- }
|
|
|
+ }
|
|
|
if (inpText == '0px') {
|
|
|
$('.inp-text').css('left', '220px');
|
|
|
}
|
|
@@ -697,15 +680,15 @@ $(function() {
|
|
|
let inpst = $('.inpst').css('left');
|
|
|
if (inpst == '0px') {
|
|
|
$('.inpst').css('left', '90px');
|
|
|
- }
|
|
|
+ }
|
|
|
if (inpst == '90px') {
|
|
|
$('.inpst').css('left', '0px');
|
|
|
}
|
|
|
let inpText2 = $('.inp-text2').css('left');
|
|
|
if (inpText2 == '220px') {
|
|
|
$('.inp-text2').css('left', '0px');
|
|
|
- }
|
|
|
- if (inpText2 == '0px'){
|
|
|
+ }
|
|
|
+ if (inpText2 == '0px') {
|
|
|
$('.inp-text2').css('left', '220px');
|
|
|
}
|
|
|
let changeButs2 = $('.change-buts2').css('left');
|
|
@@ -831,7 +814,6 @@ $(function() {
|
|
|
if (index == 0) {
|
|
|
marker.openInfoWindow(infoWindow)
|
|
|
}
|
|
|
- // marker.openInfoWindow(infoWindow); //开启信息窗口
|
|
|
marker.addEventListener("click", function() {
|
|
|
map.openInfoWindow(infoWindow, point); //开启信息窗口
|
|
|
});
|
|
@@ -840,8 +822,6 @@ $(function() {
|
|
|
|
|
|
//区级部门与街镇解析地址批量解析结束
|
|
|
$('.second-title>li').click(function() {
|
|
|
- // 解决点击事件,多次执行的问题
|
|
|
- // $('.second-title>li').unbind('click');
|
|
|
const xz = $(this).text();
|
|
|
if (xz == "区级部门") {
|
|
|
bdGEO(adds);
|
|
@@ -1087,12 +1067,6 @@ $(function() {
|
|
|
$('.show-second').css('display', 'none');
|
|
|
$('.show-third').css('display', 'none');
|
|
|
$('.show-fourth').css('display', 'none');
|
|
|
- } else if (!/^([\u4e00-\u9fa5A-Za-z0-9,.?!;,。?!、;])*$/.test(valInput)) {
|
|
|
- return false;
|
|
|
- $('.show-first').css('display', 'block');
|
|
|
- $('.show-second').css('display', 'none');
|
|
|
- $('.show-third').css('display', 'none');
|
|
|
- $('.show-fourth').css('display', 'none');
|
|
|
} else {
|
|
|
$('.show-first').css('display', 'none');
|
|
|
$('.show-second').css('display', 'block');
|
|
@@ -1156,8 +1130,6 @@ $(function() {
|
|
|
$(document).on('click', '.change-but>input', function() {
|
|
|
map.clearOverlays();
|
|
|
const inpVal = $(this).val();
|
|
|
- $(this).addClass("xz-active").siblings("input").removeClass("xz-active");
|
|
|
- $(this).parents(".title-first").siblings("ul").find(".change-but").children("input").removeClass("xz-active");
|
|
|
var routePolicy = [
|
|
|
// BMAP_TRANSIT_POLICY_RECOMMEND,//推荐
|
|
|
// BMAP_TRANSIT_POLICY_LEAST_TRANSFER,//少换成
|
|
@@ -1361,6 +1333,12 @@ $(function() {
|
|
|
$(this).siblings('.hide2').find('.inp-text2').css('left', '220px');
|
|
|
$(this).siblings('.hide2').find('.change-buts2').css('left', '185px');
|
|
|
$(this).siblings('.hide2').find('.imgSearch2').css('right', '10px');
|
|
|
+ $(this).addClass("xz-active").siblings("input").removeClass("xz-active");
|
|
|
+ $(this).parents(".title-first").siblings("ul").find(".change-but").children("input").removeClass("xz-active");
|
|
|
+ var hideBlue1 = $(this).siblings('.hide1').css('display');
|
|
|
+ if (hideBlue1 == 'none') {
|
|
|
+ $(this).removeClass("xz-active");
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
$(document).on('click', '.but-car', function() {
|
|
@@ -1376,18 +1354,18 @@ $(function() {
|
|
|
$(this).siblings('.hide2').find('.inp-text2').css('left', '220px');
|
|
|
$(this).siblings('.hide2').find('.change-buts2').css('left', '185px');
|
|
|
$(this).siblings('.hide2').find('.imgSearch2').css('right', '10px');
|
|
|
+ $(this).addClass("xz-active").siblings("input").removeClass("xz-active");
|
|
|
+ $(this).parents(".title-first").siblings("ul").find(".change-but").children("input").removeClass("xz-active");
|
|
|
+ var hideBlue2 = $(this).siblings('.hide2').css('display');
|
|
|
+ if (hideBlue2 == 'none') {
|
|
|
+ $(this).removeClass("xz-active");
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+ // 点击搜索的图标,显示
|
|
|
$('.inp-icon1').click(function() {
|
|
|
map.clearOverlays();
|
|
|
var searchInp = $('.inp').val();
|
|
|
- if (!/^([\u4e00-\u9fa5A-Za-z0-9,.?!;,。?!、;])*$/.test(searchInp)) {
|
|
|
- return false;
|
|
|
- $('.show-first').css('display', 'block');
|
|
|
- $('.show-second').css('display', 'none');
|
|
|
- $('.show-third').css('display', 'none');
|
|
|
- $('.show-fourth').css('display', 'none');
|
|
|
- }
|
|
|
if (searchInp === "") {
|
|
|
$('.show-first').css('display', 'block');
|
|
|
$('.show-second').css('display', 'none');
|
|
@@ -1399,7 +1377,6 @@ $(function() {
|
|
|
$('.show-second').css('display', 'none');
|
|
|
$('.show-fourth').css('display', 'block');
|
|
|
}
|
|
|
- // const tempInp = searchInp;
|
|
|
var options = {
|
|
|
renderOptions: {
|
|
|
map: map,
|
|
@@ -1407,40 +1384,29 @@ $(function() {
|
|
|
},
|
|
|
onSearchComplete: function(results) {
|
|
|
console.log(results);
|
|
|
- // var html4 ="";
|
|
|
- // for(var i = 0; i<results.Kr.length; i++){
|
|
|
- // html4+= "<ul class='title-first'>" +
|
|
|
- // "<li>" +
|
|
|
- // "<span>" + (i+1) + "." + "</span>" + results.Kr[i].title +
|
|
|
- // "</li>" +
|
|
|
- // "<li>" +
|
|
|
- // "<div class='differentdz'>" + "地址:" + "<p class='jzdz'>" + results.Kr[i].address + "</p>" + "</div>" +
|
|
|
- // "</li>" +
|
|
|
- // "<li class='change-but'>" +
|
|
|
- // "<input type='button' name='' id='' value='公交' class='but-bus' />" +
|
|
|
- // "<input type='button' name='' id='' value='自驾' class='but-car' />" +
|
|
|
- // "<div class='hide1'>" +
|
|
|
- // "<input type='text' name='' value='' placeholder='请输入地址' class='inps' />" +
|
|
|
- // "<div class='inp-text'>此位置</div>" +
|
|
|
- // "<div class='change-buts'></div>" +
|
|
|
- // "<img src='img/ss2.png' class='imgSearch'>" +
|
|
|
- // "</div>" +
|
|
|
- // "<div class='hide2'>" +
|
|
|
- // "<input type='text' name='' value='' placeholder='请输入地址' class='inpst' />" +
|
|
|
- // "<img src='img/ss2.png' class='imgSearch2'>" +
|
|
|
- // "<div class='inp-text2'>此位置</div>" +
|
|
|
- // "<div class='change-buts2'></div>" +
|
|
|
- // "</div>" +
|
|
|
- // "</li>" +
|
|
|
- // "</ul>"
|
|
|
- // }
|
|
|
- // $("#search-result").empty().append(html4);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
var local = new BMap.LocalSearch(map, options);
|
|
|
local.search(searchInp);
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+ // 当屏幕等于375px,将左上角的图片替换成小尺寸
|
|
|
+ $(window).resize(function(e) {
|
|
|
+ if (e.target.innerWidth < '750') {
|
|
|
+ $('.logo-img').attr('src', 'img/map-logo2.png');
|
|
|
+ $('.logo-img').css("width", "257px");
|
|
|
+ }
|
|
|
+ if (e.target.innerWidth > '750') {
|
|
|
+ $('.logo-img').attr('src', 'img/map-logo2.png');
|
|
|
+ $('.logo-img').css("width", "257px");
|
|
|
+ }
|
|
|
+ if (e.target.innerWidth < '1366') {
|
|
|
+ $('.logo-img').attr('src', 'img/map-logo2.png');
|
|
|
+ $('.logo-img').css("width", "257px");
|
|
|
+ }
|
|
|
+ if (e.target.innerWidth > '1366') {
|
|
|
+ $('.logo-img').attr('src', 'img/map-logo.png');
|
|
|
+ $('.logo-img').css("width", "446px");
|
|
|
+ }
|
|
|
+ });
|
|
|
})
|