$('.m_video_img').on('click',function(){ //处理视频播放图标 var _video = document.getElementById("myVideo"); myVideo.play(); //点击图标视频播放 $('.m_video_sp').attr('controls','controls'); //点击 显示默认的控件 $(this).hide(); var id = $(".m_video_img").attr('data-id'); $.ajax({ url:'/video/houseplays', dataType:"json", type:'GET', data:{id:id}, success:function(data){ } }); }) // 汇率弹窗 $('.m_conversion').on('click',function(){ $('.exchange_rate_box').fadeIn(100); }) $('.exchange_gb').on('click',function(){ $('.exchange_rate_box').fadeOut(100); }) // 精选楼盘 换一换 var idQh = 1; //默认页数 var DataN = $('.m_zaigai_title i').attr('city'); //默认ID var _number = $('.m_zaigai_title i').attr('number'); //换一换页数 ajax_lp(); if(_number < 2){ $('.m_zaigai_title i').hide(); }else{ $('.m_zaigai_title i').show(); $('.m_zaigai_title i').on('click',function(){ idQh += 1; // console.log(idQh); if (idQh > _number) { idQh = 1; }; ajax_lp(); }) } // 精选楼盘 function ajax_lp (){ var html = ''; $.ajax({ url: "/video/videodetailspush", // 索取 data:{page:idQh,city:DataN}, //传ID type: "GET", dataType: "json", success: function(data) {//请求成功完成后要执行的方法 if(data.code == 200){ $.each(data.data, function (i, data) { // html+= ''; html+= '
  • '; html+= ''; html+= '
    '; html+= ''; html+= '

    '; html+= ''+data.city_name+''; html+= '

    '; html+= ''; html+= '
    '; html+= '
    '; html+= '

    '+data.name+'

    '; html+= '

    '; html+= '约¥'+data.price+''+data.price_nuit+''; html+= '

    '; html+= '

    有效期至:'+getNextMonth(time)+'

    '; html+= '

    '; html+= '房价涨幅'+data.recent_price+''; html+= '参考收益'+data.rent.proportion+''; html+= '

    '; html+= '
    '; html+= '
    '; html+= '
  • '; }); } $('.sell_conter ul').html(html); } }); } // 有效期 时间加两个自然月 function getNextMonth(date,an) { var arr = date.split('/'); var year = arr[0]; //获取当前日期的年份 var month = arr[1]; //获取当前日期的月份 var day = arr[2]; //获取当前日期的日 var days = new Date(year, month, 0); days = days.getDate(); //获取当前日期中的月的天数 var year2 = year; // console.log(an) 当an不为空或undefined时输出一个月,否则输出两个月 if(an != undefined && an != '' && an != 'undefined'){ var month2 = parseInt(month) + 1; if (month2 > 12) { year2 = parseInt(year2) + 1; if (parseInt(month)==12) { month2 = 1; } } var day2 = day; var days2 = new Date(year2, month2, 0); days2 = days2.getDate(); if (day2 > days2) { day2 = days2; } if (month2 < 10) { month2 = '0' + month2; } var t2 = year2 + '-' + month2 + '-' + day2; }else{ var month2 = parseInt(month) + 2; if (month2 > 13) { year2 = parseInt(year2) + 1; if (parseInt(month)==11) { month2 = 1; }else if (parseInt(month)==12) { month2 = 2; }; } var day2 = day; var days2 = new Date(year2, month2, 0); days2 = days2.getDate(); if (day2 > days2) { day2 = days2; } if (month2 < 10) { month2 = '0' + month2; } var t2 = year2 + '/' + month2 + '/' + day2; } return t2; } var myDate = new Date; var year = myDate.getFullYear(); //获取当前时间年份 var yue = myDate.getMonth()+1;//获取当前时间月份 if (yue<10) { yue= '0' + yue; }; // 有效期时间 获取当前时间 var time = year+'/'+yue+'/01'; var time_yxq= year+'/'+yue+'/01-'+getNextMonth(time);