From bffdb339b8293fa30a8865b361a13834dc062255 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Fri, 16 Mar 2018 16:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E5=8C=BA=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fangija-zsyf/config.js | 2 +- fangija-zsyf/css/main.css | 8 +- fangija-zsyf/fangija-zsyf/index.html | 10 ++ fangija-zsyf/images/icon-clear.png | Bin 0 -> 527 bytes fangija-zsyf/js/district-search.js | 0 fangija-zsyf/js/searchDistrict-app.js | 124 ++++++++++++++++------ fangija-zsyf/yfindex.html | 145 +++++++++----------------- 7 files changed, 156 insertions(+), 133 deletions(-) create mode 100644 fangija-zsyf/fangija-zsyf/index.html create mode 100644 fangija-zsyf/images/icon-clear.png create mode 100644 fangija-zsyf/js/district-search.js diff --git a/fangija-zsyf/config.js b/fangija-zsyf/config.js index 39a89b6..fc576e7 100644 --- a/fangija-zsyf/config.js +++ b/fangija-zsyf/config.js @@ -1,2 +1,2 @@ /**服务端地址**/ -var BASE_PATH = "http://192.168.10.128:8084"; \ No newline at end of file +var BASE_PATH = "http://192.168.10.53:8084"; \ No newline at end of file diff --git a/fangija-zsyf/css/main.css b/fangija-zsyf/css/main.css index 8067a11..3d449db 100644 --- a/fangija-zsyf/css/main.css +++ b/fangija-zsyf/css/main.css @@ -327,10 +327,10 @@ i.loginIcon03{width:14px;height:24px;background:url(../images/loginIcon03.png) n .popup-about02 .list-block.historyList{margin-top:-1px;} .popup-about02 .list-block.historyList .searchHistory{padding-top:0;} -.popup-about02 .list-block ul{padding:0.75rem;padding-top:0;padding-left:0.25rem;overflow:hidden;} -.popup-about02 .list-block ul li{background:#F4F4F4;border-radius:0.16rem;float:left;margin-left:0.5rem;margin-bottom:0.5rem;padding:0 0.75rem;line-height:1.5rem;} -.popup-about02 .list-block ul li a{font-size:0.65rem;color:#333;} -.popup-about02 .list-block ul:before,.popup-about02 .list-block ul:after{height:0;} +.popup-about02 .list-block.newCss ul{padding:0.75rem;padding-top:0;padding-left:0.25rem;overflow:hidden;} +.popup-about02 .list-block.newCss ul li{background:#F4F4F4;border-radius:0.16rem;float:left;margin-left:0.5rem;margin-bottom:0.5rem;padding:0 0.5rem;line-height:1.5rem;} +.popup-about02 .list-block.newCss ul li a{font-size:0.65rem;color:#333;} +.popup-about02 .list-block.newCss ul:before,.popup-about02 .list-block.newCss ul:after{height:0;} .list-block .item-content label.label-checkbox{float:left;padding-left:0;} .list-block .item-content label.label-checkbox .item-media{width:auto;height:auto;padding:0;margin:0;} diff --git a/fangija-zsyf/fangija-zsyf/index.html b/fangija-zsyf/fangija-zsyf/index.html new file mode 100644 index 0000000..a9d1c8d --- /dev/null +++ b/fangija-zsyf/fangija-zsyf/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/fangija-zsyf/images/icon-clear.png b/fangija-zsyf/images/icon-clear.png new file mode 100644 index 0000000000000000000000000000000000000000..495cb325789686cce1c88b9aae730e348177492e GIT binary patch literal 527 zcmV+q0`UEbP)J5A`D*aaakImVmJ4UD7Us*r8Rct^7SFbQjA zLY`{loy-I#t>qb58U4ACqRxW2E3mh-fTUc2f-mIaFFHyQU*w&hpWoWEG>L-uB*!5b z0eJ|Jtt>!RUI0a40wNni?ug*t^|BZKaE3`(zfWRXSG?IQ!L0n-M&sC5)%gg^GrH=3 z=+zg%Eawi)7nbf>GpI}BW^fB)C$;e(_WVo2msJan-7xNxUMy|~E(Axlai8zTa$EW; zsy$Ft=N;o->x+lMBLPl3#=W^O_6)*NUG}O4u;1E)&akkwXqrF1EsCc3>rE3!^@~D| zJH}t>i$}o~p*`*xztNwst>qbZOC!4CwuTyQc`wA=!~35C RD&hbD002ovPDHLkV1m7#`C0$~ literal 0 HcmV?d00001 diff --git a/fangija-zsyf/js/district-search.js b/fangija-zsyf/js/district-search.js new file mode 100644 index 0000000..e69de29 diff --git a/fangija-zsyf/js/searchDistrict-app.js b/fangija-zsyf/js/searchDistrict-app.js index 8a0fc78..5a54d6a 100644 --- a/fangija-zsyf/js/searchDistrict-app.js +++ b/fangija-zsyf/js/searchDistrict-app.js @@ -1,35 +1,57 @@ var xhr; +var searchDistVue = new Vue({ + el: '#searchList', + data: { + searchDistricts: [] + } + }) $("#districtName").bind("input propertychange keyup" , function () { var keyword = $(this).val() if(xhr){ xhr.abort() } if(keyword == ""){ - $('#districtList').empty() + // $('.searchList #searchList').empty() return } - xhr = $.ajax({ - url:'../auto/district', - data:{keywords : keyword, cityName:$("#input_city").text(),max:20}, - dataType:'json', - success:function (data){ - $('#searchHistoryDiv').hide(); - if(data.length == 0){ - $("#notFound").show() - $('#districtList').empty(); - }else{ - $("#notFound").hide() - var html = $('
    ') - $(data).each(function () { - var li = $('
  • ').attr("data-region", this.district).attr("data-name", this.name).attr("data-addr", this.address).attr("data-cityAddress", this.city) - li.append('
    ' + this.name + '
    ' + this.city + this.district + this.address + '
    ') - html.append(li) - }) - $('#districtList').empty().html(html) - } - } - }) - }) + + axios.get(BASE_PATH+"/rest/districts/search", { + params: { + keywords : keyword, + cityName:$("#input_city").text(), + max:20 + } + }).then(function (response) { + + var datas = response.data.data + + $('.hotList').hide(); + $('.historyList').hide(); + if(datas == null || datas.length == 0){ + $("#notFound").show() + searchDistVue.$data.searchDistricts = [] + //$('.searchList #searchList').empty(); + }else{ + + console.log(keyword +" "+datas.length); + $("#notFound").hide() + var dists = []; + for(var i in datas){ + var o = datas[i] + var map={city:o.city, region:o.district, name:o.name,address:o.address}; + dists.push(map); + } + + //searchDistVue.$set("searchDistricts") = dists; + searchDistVue.$data.searchDistricts=dists + $('.searchList').show(); + } + }).catch(function (error) { + alert(error) + console.log(error); + }); + +}) function saveHistory(district) { var history = recover() @@ -66,24 +88,66 @@ $("body").delegate(".open-about02", "click", function () { $.toast("请选择城市") return false; } - $('#searchHistoryDiv').show(); + $('.historyList').show(); $("#notFound").hide(); + $('.hotList').show(); + $('.searchList').hide(); + addHotDistricts($("#input_city").val()); addHistory(); $.popup(".popup-about02") $("input").blur() -}); +}); + +//添加热门小区 +function addHotDistricts(cityParam){ + axios.get(BASE_PATH+"/rest/districts/hotDistricts", { + params: { + city: cityParam, + top:6 + } + }).then(function (response) { + + var datas = response.data.data + if(datas.length>0){ + var dists = []; + for(var i in datas){ + + var o = datas[i] + var map={city:o.city, region:o.region, name:o.name}; + dists.push(map); + } + + new Vue({ + el: '#hotList', + data: { + hotDists: dists + } + }) + + } + + }).catch(function (error) { + alert(error) + console.log(error); + }); +} function addHistory(){ var history = recover() if(history.length>0){ - var ul = '
      ' + var histories = []; $(history).each(function(){ - ul += '
    • '+this.name+'
      '+this.city+this.district+this.address+'
    • '; + var map={city:this.city, region:this.district, name:this.name}; + histories.push(map) + }) + new Vue({ + el: '#districtList', + data: { + histories: histories + } }) - ul += '
    ' - $('#districtList').empty().html(ul) }else{ - $("#districtList").empty(); + $(".historyList #districtList").empty(); } } diff --git a/fangija-zsyf/yfindex.html b/fangija-zsyf/yfindex.html index da354ed..f89782f 100644 --- a/fangija-zsyf/yfindex.html +++ b/fangija-zsyf/yfindex.html @@ -1352,101 +1352,51 @@ + +
    +

    没有找到相关的小区

    +

    没搜到?立刻告诉我们

    +

    返回

    +
    + - + @@ -1458,7 +1408,7 @@ $.config = {router: false} - + @@ -1467,8 +1417,7 @@ $.config = {router: false} - - +