// 显示楼盘条数 ---------- function Qalert(num = 0) { var M = {}; if(M.dialog1){ return M.dialog1.show(); } M.dialog1 = jqueryAlert({ 'content' : '共 '+num+' 个楼盘', 'closeTime' : 4000, }); } Qalert($('.feng_count').attr('house_data')); // --------------------------------- // 列表加载js---------------------- // 页数 ----- var page = 1; // 每页展示5个 var size = 10; var SearchParams = {}; var urlParams = ''; var wUrl ="" // 用于繁体、简体切换 var ttf = {} ttf.txt = $('.y_homelist_list').attr('data-rent'); ttf.txt2 = $('.y_homelist_list').attr('data-proportion'); var dht =0; $(function(){ //获取GET请求参数 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] = decodeURI(val) ; // decodeURI 解决中文字符乱码问题 } } return theRequest; } var url = window.location.href; var params = getParams(url); //获取get请求的参数 if(!$.isEmptyObject(params)){ $.each(params,function(key,val){ if(key == 'city') feng_cityTel = val; SearchParams[key] = val; }) } // console.log(SearchParams) $('.y_qylist_hoe .y_qylist_con').on('click',function(){ var Idoption = $(this).attr('data-id'); $('.y_qylist_cnet_ind').hide(); $('.y_qylist_con').attr('id',''); if($(this).hasClass('on')){ //判断css on 是否存在 $('.y_qylist_cnet_ind[data-id="'+Idoption+'"]').hide(); $(this).removeClass('on'); $('.m_homelistzz').hide(); var _ster = $(window).scrollTop(); if (_ster < 180) {_hide()} $('#LRdiv3').show(); $('.qwpuic').show(); }else{ $(this).addClass('on').siblings().removeClass('on'); $('.y_qylist_cnet_ind[data-id="'+Idoption+'"]').show(); $(this).attr('id','m_color'); $('.m_homelistzz').show(); _show(); $('#LRdiv3').hide(); $('.qwpuic').hide(); } }) $('.m_homelistzz').on('click',function(){ $('.m_homelistzz').hide(); $('.y_qylist_hoe .y_qylist_con').removeClass('on'); $('.y_qylist_cnet_ind').hide(); $('.y_qylist_con').attr('id',''); }) $(".area").on('click','li.link_click',function(){ $(".dcity").animate({right:"-35%"}); }) $('.m_f_search_click').on('click',function(){ $('.feng_city_click').removeClass('on'); }) //获取子类区域 $(".feng_city_click").on('click',function(){ var _this = $(this); $('.m_f_search_click').removeClass('in'); _this.addClass('on'); _this.siblings().removeClass('on'); $('.three_area').show(); $.post('/house/soncity',{csrf_token_m:csrfToken,id:_this.attr('value')},function(data){ $(".dcity").html(''); if(data.code == 200){ var str = ''; str += ''; $.each(data.data,function (k,v) { str += ''; }) } $(".dcity").append(str); }) $(".dcity").animate({right:"0"}); }) //获取子类区域 $(".y_qylist_cnet_ind").on('click','a.f_search_click',function(){ _hide(); $('.m_homelistzz').hide(); $('#LRdiv3').show(); $('.qwpuic').show(); $('.y_qylist_con').attr('id',''); $('.y_qylist_con').removeClass('on'); var _this = $(this); var name = _this.attr('name'); $('.m_qylist_cnet_ind li a').removeClass('in'); delete SearchParams.name; //当点击搜索的时候 删除掉搜索的参数 _this.addClass('in').siblings().removeClass('in'); $('.y_qylist_cnet_ind').css("display","none"); SearchParams[_this.attr('name')] = _this.attr('value'); if (_this.attr('name')=='city') { feng_cityTel=_this.attr('value'); }; //************************** // console.log(SearchParams) $.each(SearchParams,function(key,val){ // if(key == 'py') return true; //跳出当前循环 urlParams += key+'='+val+'&'; }) var cityUrl = ''; urlParams = urlParams.substring(0,urlParams.length - 1); // console.log(urlParams) if(urlParams == '' && cityUrl != '') { cityUrl = cityUrl.substring(0,cityUrl.length - 1); } window.location.href = '/house/search?'+ cityUrl+urlParams; }) // 输入价格区间 确定----------------------------- $('.js_pricConfirm').on('click',function(){ var _Prictype=$(this).attr('name'); var pmin = $('input.js_pricMin').val(); var pmax = $('input.js_pricMax').val(); if(pmax != '' && pmax != null){ if(pmin == '' || pmin == null || pmin == NaN){ pmin = 0; } }else{ var M = {}; if(M.dialog1){ return M.dialog1.show(); } M.dialog1 = jqueryAlert({ 'content' : '请输入价格区间!', 'closeTime' : 2000, }); } delete SearchParams.name; //当点击搜索的时候 删除掉搜索的参数 SearchParams[_Prictype] = pmin+'-'+pmax; if (_Prictype=='city') { feng_cityTel=_this.attr('value'); }; //************************** // console.log(SearchParams) $.each(SearchParams,function(key,val){ // if(key == 'py') return true; //跳出当前循环 urlParams += key+'='+val+'&'; }) var cityUrl = ''; urlParams = urlParams.substring(0,urlParams.length - 1); if(urlParams == '' && cityUrl != '') { cityUrl = cityUrl.substring(0,cityUrl.length - 1); } // console.log(cityUrl) // console.log(urlParams) window.location.href = '/house/search?'+ cityUrl+urlParams; }) // 筛选------------- var url = window.location.href; var searchParamsv2 = ''; //最后拼接的参数 var urlParamsv2 = ''; var cityUrlv2 = ''; var objUrlv2 = {}; //获取get参数 var paramsv2 = getParams(url); //获取get请求的参数 if(!$.isEmptyObject(paramsv2)){ $.each(paramsv2,function(key,val){ if(key == 'city') feng_cityTel = val; objUrlv2[key] = val; urlParamsv2 += key+'='+val+'&'; }) urlParamsv2 = urlParamsv2.substring(0,urlParamsv2.length - 1); searchParamsv2 = '&'+ urlParamsv2; } var atrNamev2 =''; var _valv2 =''; $('.js_screen_box').on('click','a.js_filtrateBut',function(){ var _this = $(this); var ParamsArrv2 = ['l','y','sub']; //搜索字段 atrNamev2 = _this.attr('name'); _valv2 = _this.attr('value'); urlParamsv2 = ''; for (var k in ParamsArrv2){ if(ParamsArrv2[k] == atrNamev2){ objUrlv2[atrNamev2] = _valv2; delete objUrlv2.page; delete objUrlv2.name; } } $.each(objUrlv2,function(key,val){ urlParamsv2 += key+'='+val+'&'; }) cityUrlv2 = ''; urlParamsv2 = urlParamsv2.substring(0,urlParamsv2.length - 1); _this.addClass('on').siblings().removeClass('on'); }) // 清空 $('.js_unlimited').on('click',function(){ var ParamsArrv2 = ['l','y','sub']; //搜索字段 urlParamsv2 = ''; for (var k in ParamsArrv2){ objUrlv2[ParamsArrv2[k]]=0; } $.each(objUrlv2,function(key,val){ urlParamsv2 += key+'='+val+'&'; }) // console.log(urlParamsv2) cityUrlv2 = ''; urlParamsv2 = urlParamsv2.substring(0,urlParamsv2.length - 1); $('.js_screen_box a.js_filtrateBut').removeClass('on'); window.location.href = '/house/search?'+ cityUrlv2+urlParamsv2; }) // 确认 $('.js_confirm').on('click',function(){ if(_valv2 != '' && atrNamev2 !=''){ window.location.href = '/house/search?'+ cityUrlv2+urlParamsv2; }else{ var M = {}; if(M.dialog1){ return M.dialog1.show(); } M.dialog1 = jqueryAlert({ 'content' : '请选择', //txt 提示内容 'closeTime' : 2000, }) } }) //获取url中的参数----选中效果-------- function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg); //匹配目标参数 if (r != null) return unescape(r[2]); return null; //返回参数值 } var _label = getUrlParam('l'); var _y = getUrlParam('y'); var _sub = getUrlParam('sub'); var _rank = getUrlParam('rank'); var _pric = getUrlParam('p'); // 选中效果 ------------------- $('.js_screen_box[name="l"] .js_filtrateBut[value="'+_label+'"]').addClass('on'); $('.js_screen_box[name="y"] .js_filtrateBut[value="'+_y+'"]').addClass('on'); $('.js_screen_box[name="sub"] .js_filtrateBut[value="'+_sub+'"]').addClass('on'); $('.js_rankHover .f_search_click[value="'+_rank+'"]').addClass('on'); $('.js_privHover .f_search_click[value="'+_pric+'"]').addClass('on'); // 筛选条件展示 --------------- var _hi='' // console.log(SearchParams) $.each(SearchParams,function(key,val){ // console.log(key) if (val!=0 && val!='') { $('.y_condition').show(); if (key=='p') { $('.js_conditionBox').append(''+val+'万') }else if(key=='city'){ $('.js_conditionBox').append(''+$('.js_cityBot').text()+'') }else{ _hi=$('.js_showList[name="'+key+'"][value="'+val+'"]').text(); $('.js_conditionBox').append(''+_hi+'') } } }) // 点击展示筛选条件------------------ $('.js_conditionBox').on('click','a.js_conditionLi',function(){ $(this).remove(); var _CondId=$(this).attr('value'); var _CondName=$(this).attr('name'); $.each(SearchParams,function(key,val){ SearchParams[_CondName]=_CondId; }) $.each(SearchParams,function(key,val){ urlParams += key+'='+val+'&'; }) cityUrlv2 = ''; urlParams = urlParams.substring(0,urlParams.length - 1); console.log(urlParams) // window.location.href = '/house/search?'+ cityUrlv2+urlParams; }) }) $(function(){ $.each(SearchParams,function(key,val){ // if(key == 'py') return true; //跳出当前循环 wUrl += key+'='+val+'&'; }) var cityUrl = ''; wUrl = wUrl.substring(0,wUrl.length - 1); // console.log(wUrl) dropload_m(); }) function dropload_m(){ // dropload $('.y_homelist_list').dropload({ scrollArea : window, loadDownFn : function(me,da){ page++; // 拼接HTML var result = ''; $.ajax({ type: 'GET', // url: '/house/searchdata', url: '/house/searchdata?page='+page+'&limit='+size+'&'+wUrl, // data:{page:page,size:size,all:SearchParams,csrf_token_m:csrfToken}, dataType: 'json', success: function(data){ // var arrLen = data.length; var _html=""; if(data.code == 200){ $.each(data.data.data,function (k,v) { _html+='
  • '; _html+='
    '; _html+=''; _html+='
    '; _html+='

    '; _html+='

    '+v.city_name+'

    '; if(v.video_url != null && v.video_url != ''){ _html+='

    '; } _html+='
    '; _html+='
    '; _html+='
    '; _html+='

    '+v.name+'

    '; _html+='

    '+house_price(v.price,v.price_nuit)+'

    '; _html+='

    有效期:'+time_yxq+'

    '; if(v.push_reason != null && v.push_reason != ""){ _html+='

    '; _html+=''+v.push_reason+''; _html+='

    '; } _html+='
    '; _html+='
    '; _html+='
    '; _html+='
    '; // _html+='
    '; // if(v.push_reason != null && v.push_reason != ""){ // _html+='
    '; // _html+='
    '; // _html+='推荐:'; // _html+='

    '+v.push_reason+'

    '; // _html+='
    '; // } _html+='
  • '; _html+='
    '; // 插入热销楼盘 if(k == 3 && dht <2){ if(data.data.hotsale.length != 0){ _html += aiah(data.data.hotsale); _html+='
    '; dht += 2; } } // 插入资讯 if(k == 7 && dht <3){ if(data.data.news.length != 0){ _html += nawie(data.data.news); _html+='
    '; dht += 2; } } }) // 如果没有数据 }else{ // 锁定 me.lock(); // 无数据 me.noData(); $('.dropload-down').hide(); $('.dropload-down').eq(0).show(); } // 为了测试,延迟1秒加载 setTimeout(function(){ // 插入数据到页面,放到最后面 $('.y_homelist_list ul').append(_html); $('.xl_click').on('click',function(){ var _mthis = $(this).parent(); _mthis.find('.m_Recommend_list').toggle(); console.log(1); }) // 每次数据插入,必须重置 me.resetload(); $('.dropload-down').hide(); $('.dropload-down').eq(0).show(); // 特价活动 new Swiper('.whot',{ slidesPerView :'auto', slidesPerView : 3, slidesPerGroup :3, spaceBetween : 12, pagination: '.whotb', // 如果需要分页器 }); },1000); }, error: function(xhr, type){ // alert('Ajax error!'); // 即使加载出错,也得重置 me.resetload(); } }); } }); } // $(function(){ // var swiper = new Swiper('#swiper1', { // pagination: '.swiper-pagination', // effect: 'coverflow', // paginationType:'fraction', // grabCursor: true, // centeredSlides: true, // slidesPerView: 'auto', // loop: true, // coverflow: { // rotate: 0, // stretch: 100.5, // depth: 45, // modifier:3, // slideShadows : true // } // }); // }) /* * 获取 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 aiah(data){ var _h = '
    '; _h +='
    '; $.each(data,function(k,v){ _h +='
    '; _h +=''; _h +='
    '; _h +='
    ' _h +=''; _h +='
    '; _h +='

    '+v.name+'

    '; _h +='

    '+house_price(v.price,v.price_nuit)+'

    '; _h +='
    '; _h +='
    '; }) _h +='
    '; _h +='
    '; _h +='
    '; return _h; } //列表插入资讯 function nawie(data){ var n = ''; return n; } 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'); $('.y_input input').attr('id','y_inputinput'); $('.y_qylist_hoe').attr('id','y_qylist_hoe'); $('.y_qylist_height').show(); $('.y_qylist_cnet').attr('id','y_qylist_cnet'); } function _hide(){ $('.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_back').attr('id',''); $('.y_input input').attr('id',''); $('.y_qylist_hoe').attr('id',''); $('.y_qylist_height').hide(); $('.y_qylist_cnet').attr('id',''); }