This commit is contained in:
xuhe@fangjia.com
2018-03-19 13:14:45 +08:00
parent f590bdf8f6
commit 6542065e84
+59 -21
View File
@@ -88,18 +88,18 @@
<div class="topic" style="border:none;">
<div class="topicContent" style="padding-left:0;padding-right:0;">
<div class="topicContent_center home">
<!--
<div onclick="window.location.href='01_index01_myHouse02_inputInfo.html'">
<div onclick="openUrl(BASE_PATH+'/fsh/form',true)" id="addHouseDiv">
<i class="icon icon-home01"></i>
<span>添加房产</span>
<img src="images/houseNote.png" >
</div>
-->
<div onclick="window.location.href='01_index01_myHouse01_index.html'">
<div onclick="openUrl(BASE_PATH+'/myHouse/detail',true)" id="detailHouseDiv">
<i class="icon icon-home01"></i>
<span>我的房产</span>
</div>
<div onclick="window.location.href='01_index03_selectHouse01_index.html'">
<div onclick="openUrl(BASE_PATH+'/intelligentHouse/index',true)">
<i class="icon icon-home02"></i>
<span>智能选房</span>
</div>
@@ -212,13 +212,14 @@
</ul>
</div>
<div class="infinite-scroll-preloader">
<div class="preloader"></div>
</div>
<div class="preloader"></div>
</div>
</div>
</div>
</div>
</div>
<!-- About Popup -->
<div class="popup popup-about popup-about01">
<div class="bar">
@@ -1244,7 +1245,14 @@ function getPosition(){
}
localStorage.setItem("init_city", city);
addLocation(lat,lng);
/*city="北京";
region="";
$("#input_city").text("北京");
getDistrictList($("#input_city").text(),0,0,"",6,0,0,"");*/
initBaseInfo(city,region,address,lat,lng);
if(city!="上海"){
@@ -1285,7 +1293,8 @@ var baseInfo = new Vue({
momRate: "",
dealCount:"",
priceRate:"",
priceRateType:""
priceRateType:"",
isLogin:""
}
})
function initBaseInfo(city,region,address,lat,lng){
@@ -1300,7 +1309,6 @@ function initBaseInfo(city,region,address,lat,lng){
}
$(".content-block-title.cardNearbyName span").text(nearAddressParam);
}
//显示基本信息
var cityParam = city;
var regionParam = region;
@@ -1320,6 +1328,15 @@ function initBaseInfo(city,region,address,lat,lng){
baseInfo.dealCount = response.data.data.dealCount;
baseInfo.priceRate = response.data.data.priceRate;
baseInfo.priceRateType = response.data.data.priceRateType;
baseInfo.isLogin = response.data.data.isLogin;
if(response.data.data.isLogin){
$("#addHouseDiv").hide();
$("#detailHouseDiv").show();
}else{
$("#addHouseDiv").show();
$("#detailHouseDiv").hide();
}
if(response.data.data.priceRateType=="up"){
$("#priceInfo").text("上涨概率");
@@ -1349,6 +1366,7 @@ function initBaseInfo(city,region,address,lat,lng){
}
}
function initNearDistricts(cityParam,latParam,lngParam,regionParam,order,minPrice,maxPrice,tag){
axios.get(BASE_PATH+"/rest/index/districtList", {
params: {
@@ -1399,6 +1417,7 @@ function initNearDistricts(cityParam,latParam,lngParam,regionParam,order,minPric
console.log(error);
});
}
function initNews(){
//资讯列表
axios.get(BASE_PATH+"/rest/news/list", {
@@ -1409,6 +1428,11 @@ function initNews(){
})
.then(function (response) {
dataObj = response.data.data.list;
if(dataObj.length==0){
$("#todayDate").hide();
}else{
$("#todayDate").show();
}
lastIndex = 0;
addItems(itemsPerLoad, 0)
if(dataObj.length>5){
@@ -1484,6 +1508,10 @@ function changeRegion(){
baseInfo.topMonth = response.data.data.topMonth;
baseInfo.momAvgPrice = response.data.data.momAvgPrice;
baseInfo.momRate = response.data.data.momRate;
baseInfo.dealCount = response.data.data.dealCount;
baseInfo.priceRate = response.data.data.priceRate;
baseInfo.priceRateType = response.data.data.priceRateType;
regionChange(response.data.data.region);
$("#region_copy").val(response.data.data.region);
})
@@ -1502,15 +1530,16 @@ var dataObj = {};
var dataObj2 = {};
function addItems(number, lastIndex) {
// 生成新条目的HTML
if(dataObj.length == 0) {
// 加载完毕,则注销无限加载事件,以防不必要的加载
$.detachInfiniteScroll($('.infinite-scroll'));
// 删除加载提示符
$('.infinite-scroll-preloader').remove();
$('.infinite-scroll-bottom .list-container').html("<div style='text-align: center; line-height: 3rem;'></div>");
return;
}
if($("#input_city").text()=="上海"){
if(dataObj.length == 0) {
// 加载完毕,则注销无限加载事件,以防不必要的加载
$.detachInfiniteScroll($('.infinite-scroll'));
// 删除加载提示符
$('.infinite-scroll-preloader').remove();
$('.infinite-scroll-bottom .list-container').html("<div style='text-align: center; line-height: 3rem;'></div>");
return;
}
var html = '';
for(var i in dataObj){
if(i>=lastIndex){
@@ -1605,6 +1634,14 @@ function addItems(number, lastIndex) {
$('#newsList').append(html);
}
}else{
if(dataObj2.length == 0) {
// 加载完毕,则注销无限加载事件,以防不必要的加载
$.detachInfiniteScroll($('.infinite-scroll'));
// 删除加载提示符
$('.infinite-scroll-preloader').remove();
$('.infinite-scroll-bottom .list-container').html("<div style='text-align: center; line-height: 3rem;'></div>");
return;
}
var html = '';
for(var i in dataObj2){
if(i>=lastIndex2){
@@ -1674,7 +1711,6 @@ $(document).on('infinite', '.infinite-scroll-bottom',function() {
if (loading) return;
// 设置flag
loading = true;
// 模拟1s的加载过程
setTimeout(function() {
// 重置加载flag
@@ -1685,6 +1721,7 @@ $(document).on('infinite', '.infinite-scroll-bottom',function() {
// 更新最后加载的序号
lastIndex = $('.cardInfo').length;
}else{
alert(lastIndex2);
addItems(itemsPerLoad, lastIndex2);
// 更新最后加载的序号
lastIndex2 = $('.list-container li').length;
@@ -1874,7 +1911,7 @@ $("body").delegate(".popup-about01 p", "click", function () {
//不同城市查询价格区间
getCityPriceLevel($(this).text());
//加载列表
sort=5;
sort=6;
getDistrictList($(this).text(),lat,lng,"",sort,0,0,"");
initBaseInfo($(this).text(),"","",0,0);
@@ -2258,12 +2295,13 @@ function getDistrictList(cityParam,latParam,lngParam,regionParam,order,minPrice,
dataObj2 = response.data.data.dtos;
lastIndex2 = 0;
addItems(itemsPerLoad, 0)
if(dataObj.length>5){
if(dataObj2.length>5){
$(".infinite-scroll-preloader").show();
}else{
$(".infinite-scroll-preloader").hide();
}
lastIndex2 = $('.list-container li').length;
})
.catch(function (error) {
console.log(error);