小区搜索
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
/**服务端地址**/
|
||||
var BASE_PATH = "http://192.168.10.128:8084";
|
||||
var BASE_PATH = "http://192.168.10.53:8084";
|
||||
@@ -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;}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 527 B |
@@ -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 = $('<ul>')
|
||||
$(data).each(function () {
|
||||
var li = $('<li>').attr("data-region", this.district).attr("data-name", this.name).attr("data-addr", this.address).attr("data-cityAddress", this.city)
|
||||
li.append('<a class="item-link item-content close-popup"><div class="item-inner"><div class="item-title-row"><div class="item-title">' + this.name + '<br><small>' + this.city + this.district + this.address + '</small></div></div></div></a>')
|
||||
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 = '<ul>'
|
||||
var histories = [];
|
||||
$(history).each(function(){
|
||||
ul += '<li data-region="'+this.district+'" data-cityAddress="'+this.city+'" data-name="'+this.name+'" data-addr="'+this.address+'"><a class="item-link item-content close-popup"><div class="item-inner"><div class="item-title-row"><div class="item-title"><font>'+this.name+'</font><br><small>'+this.city+this.district+this.address+'</small></div></div></div></a></li>';
|
||||
var map={city:this.city, region:this.district, name:this.name};
|
||||
histories.push(map)
|
||||
})
|
||||
new Vue({
|
||||
el: '#districtList',
|
||||
data: {
|
||||
histories: histories
|
||||
}
|
||||
})
|
||||
ul += '</ul>'
|
||||
$('#districtList').empty().html(ul)
|
||||
|
||||
}else{
|
||||
$("#districtList").empty();
|
||||
$(".historyList #districtList").empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+47
-98
@@ -1352,101 +1352,51 @@
|
||||
<input type="search" id="districtName" placeholder="请输入小区名或地址">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-block dn" id="notFound" style="margin-top:50%;">
|
||||
<p style="text-align:center;">没有找到相关的小区</p>
|
||||
<p><a class="button button-big theme open-modal" id="notFound_btn" style="font-size:0.8rem;">没搜到?立刻告诉我们</a></p>
|
||||
<p style="text-align:center;text-decoration:underline;margin-top:2rem;"><a class="close-popup">返回</a></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="content-block content-block01 content">
|
||||
<div class="container">
|
||||
<div class="list-block media-list historyList">
|
||||
<div class="searchHistory" id="searchHistoryDiv"><i class="icon icon-history"></i>搜索历史<a id="clearSearchHistory">清空</a></div>
|
||||
<div class="list-block media-list hotList newCss">
|
||||
<div class="searchHistory" id="searchHotDiv">热门小区</div>
|
||||
<div id="hotList">
|
||||
<ul>
|
||||
<li v-for="dist in hotDists"><a v-bind:data-name="dist.name" v-bind:data-region="dist.region" v-bind:data-city="dist.city">{{dist.name}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-block media-list historyList newCss">
|
||||
<div class="searchHistory" id="searchHistoryDiv">历史记录<a id="clearSearchHistory"></a></div>
|
||||
<div id="districtList">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="item-link item-content close-popup">
|
||||
<div class="item-inner">
|
||||
<div class="item-title-row">
|
||||
<div class="item-title">
|
||||
<font>龙盛佳苑</font><br>
|
||||
<small>上海市静安区沪太路1329弄</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="item-link item-content close-popup">
|
||||
<div class="item-inner">
|
||||
<div class="item-title-row">
|
||||
<div class="item-title">
|
||||
<font>水韵华庭</font><br>
|
||||
<small>上海市宝山区灵石路1509弄</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="item-link item-content close-popup">
|
||||
<div class="item-inner">
|
||||
<div class="item-title-row">
|
||||
<div class="item-title">
|
||||
<font>中远两湾城</font><br>
|
||||
<small>上海市普陀区中潭路100弄2-360号</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="item-link item-content close-popup">
|
||||
<div class="item-inner">
|
||||
<div class="item-title-row">
|
||||
<div class="item-title">
|
||||
<font>康宁坊</font><br>
|
||||
<small>上海市徐汇区浦北路21弄</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="item-link item-content close-popup">
|
||||
<div class="item-inner">
|
||||
<div class="item-title-row">
|
||||
<div class="item-title">
|
||||
<font>雅鹿新苑</font><br>
|
||||
<small>上海市松江区九新公路2335弄</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li v-for="history in histories"><a v-bind:data-name="history.name" v-bind:data-region="history.region" v-bind:data-city="history.city">{{history.name}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-block media-list searchList dn">
|
||||
<div id="searchList">
|
||||
<ul>
|
||||
<li v-for="searchDist in searchDistricts">
|
||||
<a class="item-link item-content close-popup" v-bind:data-name="searchDist.name" v-bind:data-region="searchDist.region" v-bind:data-city="searchDist.city">
|
||||
<div class="item-inner">
|
||||
<div class="item-title-row">
|
||||
<div class="item-title">{{searchDist.name}}<br><small>{{searchDist.city}}{{searchDist.region}}{{searchDist.address}}</small></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="popup popup-about popup-about02">
|
||||
<div class="bar">
|
||||
<div class="searchbar row">
|
||||
<a class="col-5 close-popup"><span class="icon icon-left"></span></a>
|
||||
<div class="search-input col-95">
|
||||
<label class="icon icon-search" for="search"></label>
|
||||
<input type="search" id="districtName" placeholder="请输入小区名或地址">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-block content-block01 content">
|
||||
<div class="container">
|
||||
<div class="content-block" style="margin-top:50%;">
|
||||
<p style="text-align:center;">没有找到相关的小区</p>
|
||||
<p><a class="button button-big theme open-modal" id="notFound_btn" style="font-size:0.8rem;">没搜到?立刻告诉我们</a></p>
|
||||
<p style="text-align:center;text-decoration:underline;margin-top:2rem;"><a class="close-popup">返回</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
|
||||
<script type="text/javascript" src="http://g.alicdn.com/sj/lib/zepto/zepto.js" charset="utf-8"></script>
|
||||
|
||||
@@ -1458,7 +1408,7 @@ $.config = {router: false}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="js/vue.js"></script>
|
||||
<script type="text/javascript" src="js/mui.min.js"></script>
|
||||
<script type="text/javascript" src="js/mui.min.jsmui.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/light7-2.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="js/cn.js" charset="utf-8"></script>
|
||||
@@ -1467,8 +1417,7 @@ $.config = {router: false}
|
||||
|
||||
<script type='text/javascript' src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
<script type='text/javascript' src='js/city-app.js?version=${version!}' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='js/searchDistrict-app.js?version=${version!}' charset='utf-8'></script>
|
||||
|
||||
<script type='text/javascript' src='js/searchDistrict-app.js?' charset='utf-8'></script>
|
||||
<script type="text/javascript">
|
||||
var jQuery = $;
|
||||
$.config = {router: false}
|
||||
@@ -1744,13 +1693,13 @@ $(document).on('click','#notFound_btn', function () {
|
||||
|
||||
$.ajax({
|
||||
type : 'post',
|
||||
url :"../fsh/addNoFoundDistrict",
|
||||
url :BASE_PATH + "/rest/districts/addNoFoundDistrict",
|
||||
data:{city:c,name:a, address:b},
|
||||
dataType:'json',
|
||||
success:function(result){
|
||||
$('.modal').remove();
|
||||
$('.modal-overlay').remove();
|
||||
if(result.success){
|
||||
if(result.data){
|
||||
$.toast('提交成功,我们会尽快完善信息');
|
||||
}else{
|
||||
$.toast('提交失败,请重试');
|
||||
@@ -1839,15 +1788,6 @@ function openUrl(url){
|
||||
clicked(url,true);
|
||||
}
|
||||
|
||||
$("body").delegate("#districtList ul li", "click", function () {
|
||||
var select_city = $(this).attr("data-cityAddress");
|
||||
var select_region = $(this).attr("data-region");
|
||||
var select_name = $(this).attr("data-name");
|
||||
saveHistory({district:$(this).attr("data-region"),name:$(this).attr("data-name"),address:$(this).attr("data-addr"),city:$(this).attr("data-cityAddress")})
|
||||
//window.location.href='../district/details?city='+select_city+"®ion="+select_region+"&name="+select_name;
|
||||
var url = '../district/details?city='+select_city+"®ion="+select_region+"&name="+select_name;
|
||||
clicked(url, true);
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
@@ -1873,6 +1813,15 @@ $(document).ready(function () {
|
||||
}
|
||||
});*/
|
||||
|
||||
$("body").delegate("#hotList ul li", "click", function () {
|
||||
var select_city = $(this).find("a").attr("data-city");
|
||||
var select_region = $(this).find("a").attr("data-region");
|
||||
var select_name = $(this).find("a").attr("data-name");
|
||||
saveHistory({district:select_region,name:select_name,city:select_city})
|
||||
window.location.href=BASE_PATH + '/district/details?city='+select_city+"®ion="+select_region+"&name="+select_name;
|
||||
//var url = '../district/details?city='+select_city+"®ion="+select_region+"&name="+select_name;
|
||||
//clicked(url, true);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user