123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588 |
- // 显示楼盘条数 ----------
- function Qalert(num = 0) {
- var M = {};
- if(M.dialog1){
- return M.dialog1.show();
- }
- M.dialog1 = jqueryAlert({
- 'content' : '共<span style="color:#FF6926;font-size: 1.0rem;"> '+num+' </span>个楼盘',
- '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 += '<li class="feng_search"><a class="f_search_click" name="city" value="'+_this.attr('value')+'" href="javascript:;">'+_this.find('a').html()+'</a></li>';
- $.each(data.data,function (k,v) {
- str += '<li class="feng_search"><a class="f_search_click" name="city" value="'+v.id+'" href="javascript:;">'+v.city_name+'</a></li>';
- })
- }
- $(".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('<a class="js_conditionLi" value="0" name="'+key+'" href="javascript:;"><span>'+val+'万</span><i><img src="/image/v3_ico19.png" alt=""></i></a>')
- }else if(key=='city'){
- $('.js_conditionBox').append('<a class="js_conditionLi" value="0" name="'+key+'" href="javascript:;"><span>'+$('.js_cityBot').text()+'</span><i><img src="/image/v3_ico19.png" alt=""></i></a>')
- }else{
- _hi=$('.js_showList[name="'+key+'"][value="'+val+'"]').text();
- $('.js_conditionBox').append('<a class="js_conditionLi" value="0" name="'+key+'" href="javascript:;"><span>'+_hi+'</span><i><img src="/image/v3_ico19.png" alt=""></i></a>')
- }
- }
- })
- // 点击展示筛选条件------------------
- $('.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+='<li class="c">';
- _html+='<div class="list_mian">';
- _html+='<a href="/house/'+v.id+'/">';
- _html+='<div class="y_img">';
-
- _html+='<p class="y_tu"><img src="'+v.thumb+'" alt=""></p>';
- _html+='<p class="y_vid c"><img src="/image/v2/search2.png" alt="">'+v.city_name+'</p>';
- if(v.video_url != null && v.video_url != ''){
- _html+='<p class="puic_video"><img src="/image/puic_vid.png" alt=""></p>';
- }
- _html+='</div>';
- _html+='<div class="y_text">';
- _html+='<div class="y_text_main">';
- _html+='<p class="y_title">'+v.name+'</p>';
- _html+='<p class="y_jiage"><span>'+house_price(v.price,v.price_nuit)+'</span><i class="u"></i><em></em></p>';
- _html+='<p style="font-size:0.6rem; color:#999;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;">有效期:'+time_yxq+'</p>';
- if(v.push_reason != null && v.push_reason != ""){
- _html+='<p class="m_Recommend c">';
- _html+='<span class="c"><img src="/image/v2/search1.png" alt="">'+v.push_reason+'</span>';
- _html+='</p>';
- }
- _html+='</div>';
- _html+='</div>';
- _html+='</a>';
- _html+='</div>';
- // _html+='<div class="list_tel"><a href="tel:'+v.tel+'"><img src="/image/edition/icon_tel.png" alt=""></a></div>';
- // if(v.push_reason != null && v.push_reason != ""){
- // _html+='<div class="xl_click"><img src="/image/lplsitv2_2.png" alt=""></div>';
- // _html+='<div class="m_Recommend_list c">';
- // _html+='<span>推荐:</span>';
- // _html+='<p>'+v.push_reason+'</p>';
- // _html+='</div>';
- // }
- _html+='</li>';
- _html+='<div class="m_bx"></div>';
- // 插入热销楼盘
- if(k == 3 && dht <2){
- if(data.data.hotsale.length != 0){
- _html += aiah(data.data.hotsale);
- _html+='<div class="m_bx"></div>';
- dht += 2;
- }
- }
- // 插入资讯
- if(k == 7 && dht <3){
- if(data.data.news.length != 0){
- _html += nawie(data.data.news);
- _html+='<div class="m_bx"></div>';
- 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 = '<div class="whot">';
- _h +='<dl class="swiper-wrapper">';
- $.each(data,function(k,v){
- _h +='<dd class="swiper-slide">';
- _h +='<a href="/house/'+v.id+'/">';
- _h +='<div class="whot-img">';
- _h +='<div class="wtop"><img src="/image/edition/top_'+(k+1)+'.png" alt="" /></div>'
- _h +='<img src="'+v.thumb+'" alt="">';
- _h +='</div>';
- _h +='<h2>'+v.name+'</h2>';
- _h +='<p>'+house_price(v.price,v.price_nuit)+'</p>';
- _h +='</a>';
- _h +='</dd>';
- })
- _h +='</dl>';
- _h +='<div class="whotb"></div>';
- _h +='</div>';
- return _h;
- }
- //列表插入资讯
- function nawie(data){
- var n = '<div class="wsek_news" style="display: none;">';
- n += '<a href="/news/details/'+data[0].id+'/">';
- n += '<h2>'+data[0].subject+'</h2>';
- n += '<div class="wsek_news-img">';
- $.each(data[0].thumb,function(k,v){
- n += '<i><img src="'+v+'" alt=""></i>';
- })
- n += '</div>';
- n += '</a>';
- n += '</div>';
- 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','');
- }
|