123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- 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 ='<div class="main">';
- vir +='<div class="slice">';
- vir +='<div data-loader="circle"></div>';
- vir +='<div>'+msg+'</div>';
- vir +='</div>';
- vir +='</div>';
- $('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 : '<div class="dropload-refresh">↑上拉加载更多</div>',
- domLoad : '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
- domNoData : '<div class="dropload-noData">我也是有底线的...</div>'
- },
- 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 += '<li>'
- result +='<a href="/housech/'+val.id+'/">'
- result +='<div class="sell_img">'
- result +='<img class="m_list_img" src="'+val.thumb+'/same" alt="">'
- result +='<i class="sell_img_i">'+val.city_name+'</i>'
- result +='<div class="m_tblist c">'
- if(val.video !=0 && val.video !='' && val.video != null && val.video != undefined){
- result +='<i><img src="/image/video/sp1.png" alt=""></i>'
- }
- if(val.panorama !=0 && val.panorama !='' && val.panorama != null && val.panorama != undefined){
- result +='<i><img src="/image/video/vr1.png" alt=""></i>'
- }
- if(val.albumCount !=0 && val.albumCount !='' && val.albumCount != null && val.albumCount != undefined){
- result +='<i><img src="/image/video/xc1.png" alt=""></i>'
- }
- result +='</div>'
- result +='</div>'
- result +='<div class="sell_conter_right">'
- result +='<p class="title">'+val.name+'</p>'
- if(val.sale_price != 0 && val.sale_price != null && val.sale_price != ''){
- result += '<p class="jg_ing jg_ingdd" style="margin-top:9px"><span><em>'+ val.sale_price +'</em>'+val.price_unit+'</span></p>';
- }else{
- result += '<p class="jg_ing jg_ingdd" style="margin-top:9px"><span><em>待定</em></span></p>';
- }
- result += '<p class="jg_ing" style="margin-top:8px">有效期:'+whtmltime+'</p>'
- result +='</div>'
- result +='<div class="m_gzlx">'
- result +='<p class="attention">已有 <span>'+randvalue+'</span> 人关注</p>'
- result +='<div class="m_gzlx_style">'
- if(val.characteristic){
- $.each(val.characteristic,function(k,v){
- result +='<i>'+v+'</i>';
- })
- }
- result += '</div>'
- result +='</div>'
- result +='</a>'
- if(val.is_tel != null && val.is_tel != ''){
- result +='<div class="cal_price"><a href="tel:'+val.is_tel+'"><img src="/image/index/tel_calltu.png"></a></div>'
- }else{
- result +='<div class="cal_price"><a href="tel:'+val.citytel+'"><img src="/image/index/tel_calltu.png"></a></div>'
- }
- result +='</li>'
- })
- $('.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 += '<a class="link_click" name="city" value="'+_this.attr('value')+'" href="javascript:;">全部</a>';
- str += '<a class="link_click" name="city" pinyin="'+_this.attr('pinyin')+'" value="'+_this.attr('value')+'" href="javascript:;">'+_this.find('span').html()+'</a>';
- $.each(data.data,function (k,v) {
- str += '<a class="link_click" name="city" pinyin="'+v.pinyin+'" value="'+v.id+'" href="javascript:;"><span>'+v.city_name+'</span></a>';
- })
- }
- $(".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' : '已为您找到<span style="color:#FF6926;font-size: 1.0rem;"> '+num+' </span>套房源',
- '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();
- }
|