From bc9d554dc79ff906412b8f16cc3d31d37a251c37 Mon Sep 17 00:00:00 2001 From: "xuhe@fangjia.com" Date: Fri, 16 Mar 2018 17:56:10 +0800 Subject: [PATCH] aa --- fangija-zsyf/fangija-zsyf/index.html | 10 ++ fangija-zsyf/images/icon-address03.png | Bin 0 -> 1370 bytes 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/views/news/newsDetail.html | 85 ++++++++++++++++ 6 files changed, 189 insertions(+), 30 deletions(-) create mode 100644 fangija-zsyf/fangija-zsyf/index.html create mode 100644 fangija-zsyf/images/icon-address03.png create mode 100644 fangija-zsyf/images/icon-clear.png create mode 100644 fangija-zsyf/js/district-search.js create mode 100644 fangija-zsyf/views/news/newsDetail.html 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-address03.png b/fangija-zsyf/images/icon-address03.png new file mode 100644 index 0000000000000000000000000000000000000000..1cc4d39ff09701b04f61dfa2d94ea58233d6b3ba GIT binary patch literal 1370 zcmV-g1*Q6lP)(ah#ovjg2Qq+G|))cX#(x$8pve zV-^8OR0yabgxD5E(dtYlbE4e0WkEp@JOW@NfNB7}MD&R|ZDHn!nV0*%|8}Jw#_ic`_DLdolZYHSViD)blP4_(SyZ(%{)~lHLRUyP?&+`Ul69mBv0M-JC ziuLa_#!Lh7Jb)_ze590GFf_ARR;#3x>-s@K5Oe^zm5A<@Qnr z0Ifx7vA=Qa&0twzsz@tE;R3v?W(cxr0DGJw0wqOG^|xsNNat8na4*_G`YFC`CQ2%48t1=g~Cy0&bzKV zBb7=WE7=YmI#ko!+xrcGDFEgxr9O>=IyyQgR#jEmy?#|n)s`~)3c&1g4qEFEnE7D< zCxsAC6$*t;A%q==w*Yun!KIY95K$ox%H?u%jWN54s8dQgs|0!uz#9N|D5V~VI~+WC za9m$s-yQ(zGQ)XV2yus4bn99uOh-jA(VqH3&w)fJYwQt|Pt6bMT4!|uG3O6=2H60s}pdbh~09X#-bEVYW zGSQFvFRk@E%)A7^$4aS(tm6PE48sYw@c_pC7g5z(-_6Xs0px`c^`7V1S-J$WKXSR; zLSu}*v@W`?D;padza4cN0J7Qa)d2Pr(IhKTN+~;o{j1!?XYV81#1ll6ky4%+4XnMr zeQb4gwLQHl0AENc=Mj+^7Gx*7rlw{uGdJ1j5{bm^>2&(HkzhriUCewZ5q)1%Q{l0nI;**fL}Jcxu%guL05Au@nJ9{8H8(fg6E|oL`wG%pUjv|>nQyR} zC6mc{4Gj$gs$q92&X`s7+W?$3#e9uEUj({Ar={9Y?HSE7*9lpjWKh5-#P&PDF6Tf07*qoM6N<$f{_?|IRF3v literal 0 HcmV?d00001 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/views/news/newsDetail.html b/fangija-zsyf/views/news/newsDetail.html new file mode 100644 index 0000000..ed5e7cb --- /dev/null +++ b/fangija-zsyf/views/news/newsDetail.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +

    +
    +
    +
    +

    +


    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + \ No newline at end of file