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