function getParams(url) { var theRequest = new Object(); if (!url) url = location.href; if (url.indexOf("?") !== -1) { var str = url.substr(url.indexOf("?") + 1) + "&"; var strs = str.split("&"); for (var i = 0; i < strs.length - 1; i++) { var key = strs[i].substring(0, strs[i].indexOf("=")); var val = strs[i].substring(strs[i].indexOf("=") + 1); theRequest[key] = val; } } return theRequest; } var objUrl = {}; //获取get参数 var url = window.location.href; var searchParams = ''; //最后拼接的参数 var urlParams = ''; // 页数 进入页面php渲染了10条数据,分页从1开始,请求的时候 page++ 就是从第二页开始请求 var page = 1; // 每页展示10个 var size = 10; var Wxdata = new Object(); // 用于处理选中问题 var params = getParams(url); //获取get请求的参数 if(!$.isEmptyObject(params)){ $.each(params,function(key,val){ if(key == 'city') feng_cityTel = val; objUrl[key] = val; urlParams += key+'='+val+'&'; }) urlParams = urlParams.substring(0,urlParams.length - 1); searchParams = '&'+ urlParams; } // 为了解决选中问题 if(!$.isEmptyObject(params)){ $.each(params,function(k,v){ if(k != 'price' && k !='py'){ $('.y_qylist_cnet a[name="'+k+'"][value="'+v+'"]').addClass('ki'); } }) } function AlertMsg(msg){ var vir ='
'; vir +='
'; vir +='
'; vir +='
'+msg+'
'; vir +='
'; vir +='
'; $('body').append(vir); } function AlertMsgDel(clearTime = 1000) { if($('.main')){ setTimeout(function(){ $('.main').remove(); //删除加载转圈 },clearTime); } } $(function(){ $('.y_homelist_list').dropload({ scrollArea : window, domDown : { domClass : 'dropload-down', domRefresh : '
↑上拉加载更多
', domLoad : '
加载中...
', domNoData : '
我也是有底线的...
' }, loadDownFn : function(me,da){ page++; // 拼接HTML var result = ''; $.ajax({ type: 'GET', url: '/housech/searchdata?page='+page+'&limit='+size+searchParams, dataType: 'json', // async:false, //去掉同步,要不然会出来卡的感觉 beforeSend:function(){ // AlertMsg('数据加载中...'); }, success: function(data){ var lpsun = data.count; // 2019-5-8 删除加载转圈效果 // AlertMsgDel(500); if(data.code == 200){ var data = data.data; if(data != null){ $.each(data,function (key,val) { var randomX = 300; var randomY = 800; var randvalue = parseInt(Math.random() * (randomX - randomY + 1) + randomY); result += '
  • ' result +='' result +='
    ' result +='' result +=''+val.city_name+'' result +='
    ' if(val.video !=0 && val.video !='' && val.video != null && val.video != undefined){ result +='' } if(val.panorama !=0 && val.panorama !='' && val.panorama != null && val.panorama != undefined){ result +='' } if(val.albumCount !=0 && val.albumCount !='' && val.albumCount != null && val.albumCount != undefined){ result +='' } result +='
    ' result +='
    ' result +='
    ' result +='

    '+val.name+'

    ' if(val.sale_price != 0 && val.sale_price != null && val.sale_price != ''){ result += '

    '+ val.sale_price +''+val.price_unit+'

    '; }else{ result += '

    待定

    '; } result += '

    有效期:'+whtmltime+'

    ' result +='
    ' result +='
    ' result +='

    已有 '+randvalue+' 人关注

    ' result +='
    ' if(val.characteristic){ $.each(val.characteristic,function(k,v){ result +=''+v+''; }) } result += '
    ' result +='
    ' result +='
    ' if(val.is_tel != null && val.is_tel != ''){ result +='
    ' }else{ result +='
    ' } result +='
  • ' }) $('.y_homelist_list ul').append(result); // 每次数据插入,必须重置 // me.resetload(); // 如果没有数据 } }else{ // 锁定 me.lock(); // 无数据 me.noData(); } me.resetload(); //重置 }, error: function(xhr, type){ // AlertMsgDel(500); // alert('Ajax error!'); // 即使加载出错,也得重置 me.resetload(); } }); }, threshold :80 //升高底部触发加载的距离; }); }); $.each($('.m_nav_qy').find('a'),function(){ var each_name = $(this).attr('name'); var each_val = $(this).attr('value'); if(each_val == objUrl[each_name]){ $(this).attr('id','nav'); } }) // $(".y_qylist_cnet_ind").on('click','a.link-item',function(){ var _this = $(this); _this.addClass('on'); _this.siblings().removeClass('on'); $('.three_area').show(); // _this.show(); $.post('/housech/soncity',{pid:_this.attr('value')},function(data){ $(".three_area").html(''); if(data.code == 200){ var str = ''; // str += '全部'; str += ''+_this.find('span').html()+''; $.each(data.data,function (k,v) { str += ''+v.city_name+''; }) } $(".three_area").append(str); // 为了解决AJAX请求数据选中 if(!$.isEmptyObject(params)){ $.each(params,function(k,v){ if(k != 'price' && k !='py'){ $('.y_qylist_cnet a[name="'+k+'"][value="'+v+'"]').addClass('ki'); } }) } }) $(".three_area").animate({left:"110px"}); }) $(".y_qylist_cnet_ind").on('click','a.actived-item',function(){ $(".three_area").animate({left:"100%"}); }) function waptab(name1,name2,name3){ $(name1).on('click',function(){ $(name2).hide(); var Idoption = $(this).attr(name3); if($(this).hasClass('on')){ //判断css on 是否存在 $(name2+'['+name3+''+'='+ Idoption +']').hide(); $(this).removeClass('on'); }else{ $(this).addClass('on').siblings().removeClass('on'); $(name2+'['+name3+''+'='+ Idoption +']').show(); } }) } waptab('.y_qylist_hoe .y_qylist_con','.y_qylist_cnet_ind','data-id'); var mySwiper1= new Swiper(".swiper-container1",{ loop : true, loopedSlides:4, autoplay:5500, autoplayDisableOnInteraction : false, // 如果需要分页器 pagination: '.swiper-pagination', slidesPerView :"auto" }); // 处理资讯详情页面的底部一个月的有效日期 var myDate = new Date; var year = myDate.getFullYear(); //获取当前时间年份 var yue = myDate.getMonth()+1;//获取当前时间月份 if (yue<10) { yue= '0' + yue; }else if(yue == 13){ yue = '01'; }; // 返回下个月有多少天数 function mGetDate(yue){      var date = new Date();      var year = date.getFullYear();      var d = new Date(year,parseInt(yue), 0); return d.getDate(); } var whtmltimes = year + '/'+ yue + '/' + mGetDate(yue); var whtmltime = year + '/'+ yue + '/' +'01'+'-'+ year + '/'+ yue + '/' + mGetDate(yue); // 处理选中价格 function price_deal(subject){ switch(subject){ case '8000-10000元': subject = '8千-1万'; break; case '6000-8000元': subject = '6-8千'; break; case '4000-6000元': subject = '4-6千'; break; case '4000元以下': subject = '4千以下'; break; default: subject = 1; break; } return subject; } // 处理跳转过来选中价格 var textspan=$('.y_qylist_con p.feng_price span').text(); $('.y_qylist_con p.feng_price span').text(price_deal2(textspan)) function price_deal2(subject2){ switch(subject2){ case '8000-10000元': subject2 = '8千-1万'; break; case '6000-8000元': subject2 = '6-8千'; break; case '4000-6000元': subject2 = '4-6千'; break; case '4000元以下': subject2 = '4千以下'; break; } return subject2; } function Qalert(num = 0) { var M = {}; if(M.dialog1){ return M.dialog1.show(); } M.dialog1 = jqueryAlert({ 'content' : '已为您找到 '+num+' 套房源', 'closeTime' : 4000, }) } var house_total = $('.feng_house_total').html(); if(house_total){ Qalert(house_total); } $(function(){ //转换价格格式 $('.wx_btn a').each(function(){ var _this = $(this); var txt = _this.text(); _this.html(price_deal2(txt)); }) // 筛选确定按钮 $('.wx_confirm').on('click',function(){ var _this = $(this); var oi = _this.attr('data-id'); var pthis = $('.y_qylist_cnet_ind[data-id="'+oi+'"]'); if(pthis.find('a.in').attr('name') == 'city'){ objUrl['py'] = pthis.find('a.in').attr('pinyin'); } var ParamsArr = ['city','type','characteristic','price','py']; //搜索字段 var atrName = pthis.find('a.in').attr('name'); var _val =pthis.find('a.in').attr('value'); var urlParams = ''; for (var k in ParamsArr){ if(ParamsArr[k] == atrName){ objUrl[atrName] = _val; delete objUrl.page; delete objUrl.name; //数据存储 } // if(atrName == 'price'){ //处理价格 // Wxdata[atrName] = _val; //楼盘名称存储格式 // var odata = JSON.stringify(Wxdata); //对象转换为字符串 // window.localStorage.setItem("data",odata); // } } $.each(objUrl,function(key,val){ if(key == 'py') return true; //跳出当前循环 urlParams += key+'='+val+'&'; }) var cityUrl = ''; urlParams = urlParams.substring(0,urlParams.length - 1); if(typeof objUrl.py == 'string'){ cityUrl = 'py='+objUrl.py+'&'; } if(urlParams == '' && cityUrl != '') { cityUrl = cityUrl.substring(0,cityUrl.length - 1); } window.location.href = '/housech/search?'+ cityUrl+urlParams; }) // 筛选取消按钮 $('.wx_cls').on('click',function(){ $('.w_barrier').fadeOut(); $('.wx_screen_box').animate({bottom:'-500px'}); p() }) // 筛选框展示 var condition = ['区域','价格','特色','户型']; $('.y_qylist_con').on('click',function(){ var oi = $(this).attr('data-id'); $('.wx_screen_box').animate({bottom:'0'}); $('.wx_screen_btn').find('i').html(condition[oi-1]); $('.wx_screen_btn .wx_confirm').attr('data-id',oi); $('.w_barrier').fadeIn(); $('.y_qylist_cnet .y_qylist_cnet_ind[data-id="'+oi+'"]').show(); s(); if(oi == 2){ /*用于处理选中问题*/ var txt = $(this).find('span').text(); if(txt != condition[oi-1]){ $('.wx_btn[data-id="2"] a').each(function(){ var _this = $(this) if(txt == _this.text()){ _this.addClass('ki'); } }) } } }) // 点击遮层隐藏 $('.w_barrier').on('click',function(){ $('.wx_screen_box').animate({bottom:'-500px'}); $('.w_barrier').fadeOut(); p() }) // 点击选中 $('.wx_sreen_con').on('click','a.link_click',function(){ $(this).addClass('in').siblings().removeClass('in'); $(this).siblings().removeClass('ki'); }) $('.link_click_a').on('click',function(){ $(this).attr('id','on') $('.link-item').removeClass('on'); $('.three_area').html(''); }) $(document).bind("click",function(e){ var target = $(e.target); if(target.closest(".link_click_a").length == 0){ //点击 .inputxz 之外的地方触发 $('.link_click_a').attr('id',''); } }) }) // 以下两个方法为了隐藏/显示商务通 function s(){ clearInterval(time) stime=setInterval(function(){ $('#LXB_CONTAINER_SHOW').hide(); $('#LRMINIBar').hide(); },80); } function p(){ clearInterval(stime) time=setInterval(function(){ $('#LXB_CONTAINER_SHOW').show(); $('#LRMINIBar').show(); },80); } /* * 获取 DOC 超出可视区域的高度 */ $(window).scroll(function (){ var ster = $(this).scrollTop(); var _hasClass = $('.y_qylist_hoe .y_qylist_con').hasClass('on'); if (ster < 180 && _hasClass == false) { _hide() }else{ _show(); } }); function _show(){ $('.m_top').css('background','#FFF'); $('.header_menu img').attr('src','/image/indexv2_19.png'); $('.header_back img').attr('src','/image/indexv2_17.png'); $('.header_menu').attr('id','header_menu'); $('.header_back').attr('id','header_back'); $('.xm_v2logo').show(); } function _hide(){ $('.m_top').css('background','rgba(0,0,0,0)'); $('.header_menu img').attr('src','/image/indexv2_18.png'); $('.header_back img').attr('src','/image/menu_a02.png'); $('.header_menu').attr('id',''); $('.header_back').attr('id',''); $('.xm_v2logo').hide(); }