// 头部导航---------------------------- $(function () { //demo示例六 通过id调取 $('#demo06').navbarscroll({ defaultSelect: 0, scrollerWidth: 6, fingerClick: 1, endClickScroll: function (obj) { // console.log(obj.text()) } }); }); //-------------------------------------- // 楼盘ajax切换-------------------------------- // 页数 var page = 0; // 每页展示5个 var size = 5; var IdData = $('.m_switch li').eq(0).attr("dataid"); //默认传全国ID ajax_lp(); $('.m_switch li').on('click', function () { var _this = $(this); page = 1; IdData = _this.attr("dataid"); $('.dropload-down').remove(); $.ajax({ type: 'GET', url: '/timelimitsgroup/gethouselist', data: {id: IdData, page: page, limit: size, csrf_token_f: csrfToken}, dataType: 'json', async: false, success: function (data) { // Qalert(data.count); if (data.code == 200) { var data = data.data.data; if (data != null) { console.log(data); var html = ""; $('.m_lpList_box').html(""); $.each(data, function (i, data) { html += '
'; html += '
'; html += ''; if (data.panorama != 0 && data.panorama != '' && data.panorama != null && data.panorama != undefined) { html += ''; } html += '
'; html += '
限时团购
'; html += '
'; html += ''; html += '
'; html += '
' + data.click + '人已关注
'; html += '
' + data.group_num + '人已抢
'; html += '
'; html += '
'; html += ''; html += '
建筑面积:' + data.main_units + '
'; html += '
'; if (data.group_price != null && data.group_price != 0 && data.group_price != "") { html += '¥' + data.group_price + ''; } else { html += '待定'; } if (data.sale_price != null && data.sale_price != 0 && data.sale_price != "") { html += '¥' + data.sale_price + '' + data.price_unit + ''; } html += '有效期:2018/12/01-2020/03/01'; html += '
'; html += '
'; $.each(data.style, function (k, v) { html += '' + v + ''; }) html += '
'; html += '
'; html += '
'; html += '
'; }) $('.m_lpList_box').append(html); ajax_lp(); $('.m_lpList').each(function () { var that = $(this); var timeid = that.find('.m_xgsj_time').attr('start-time'); // console.log(timeid); setInterval(function () { // let nowTime = new Date(timeid) - new Date; // // console.log(nowTime); // let minutes = parseInt(nowTime / 1000 / 60 % 60, 10);//计算剩余的分钟 // // console.log(minutes); // let seconds = parseInt(nowTime / 1000 % 60, 10);//计算剩余的秒数 // minutes = checkTime(minutes); // seconds = checkTime(seconds); // let hours = parseInt(nowTime / ( 1000 * 60 * 60), 10); //计算剩余的小时 // hours = checkTime(hours); let nowTime = new Date(timeid) - new Date; let minutes = parseInt(nowTime / 1000 / 60 % 60, 10);//计算剩余的分钟 let seconds = parseInt(nowTime / 1000 % 60, 10);//计算剩余的秒数 minutes = checkTime(minutes); seconds = checkTime(seconds); let days = parseInt(nowTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数 let hours = parseInt(nowTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时 days = checkTime(days); hours = checkTime(hours); // document.getElementById('m_time').innerHTML=days + "天" + hours + "小时" + minutes + "分" + seconds + "秒"; // 判断当前时间 var Set_up = new Date(timeid); var current = new Date; if (Set_up > current) { that.find('.m_xgsj_time').html('' + days + '' + hours + '' + minutes + '' + seconds + ' 秒'); } else { that.find('.m_xgsj_time').html('00000000 秒'); } }, 1000); function checkTime(i) { //将0-9的数字前面加上0,例1变为01 if (i < 10) { i = "0" + i; } return i; } }) } } } }); $(document).scrollTop(0); }) function ajax_lp() { $('.m_lpList_box').dropload({ scrollArea: window, loadDownFn: function (me, da) { $('.dropload-down').remove(); page++; // 拼接HTML var html = ''; $.ajax({ type: 'GET', url: '/timelimitsgroup/gethouselist', data: {id: IdData, page: page, limit: size, csrf_token_f: csrfToken}, // dataType: 'json', async: false, success: function (data) { // Qalert(data.count); if (data.code == 200) { var data = data.data.data; if (data != null) { console.log(data); $.each(data, function (i, data) { html += '
'; html += '
'; html += ''; if (data.panorama != 0 && data.panorama != '' && data.panorama != null && data.panorama != undefined) { html += ''; } html += '
'; html += '
限时团购
'; html += '
'; html += ''; html += '
'; html += '
' + data.click + '人已关注
'; html += '
' + data.group_num + '人已抢
'; html += '
'; html += '
'; html += ''; html += '
建筑面积:' + data.main_units + '
'; html += '
'; if (data.group_price != null && data.group_price != 0 && data.group_price != "") { html += '¥' + data.group_price + ''; } else { html += '待定'; } if (data.sale_price != null && data.sale_price != 0 && data.sale_price != "") { html += '¥' + data.sale_price + '' + data.price_unit + ''; } html += '有效期:2018/12/01-2020/03/01'; html += '
'; html += '
'; $.each(data.style, function (k, v) { html += '' + v + ''; }) html += '
'; html += '
'; html += '
'; html += '
'; }) // 如果没有数据 } } else { // 锁定 me.lock(); // 无数据 me.noData(); } // 处理资讯详情页面的底部一个月的有效日期 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 htmltime = year + '/' + yue + '/' + '01' + '-' + year + '/' + yue + '/' + mGetDate(yue); $('.m_lpList_box').append(html); // 每次数据插入,必须重置 me.resetload(); $('.m_lpList').each(function () { var that = $(this); var timeid = that.find('.m_xgsj_time').attr('start-time'); // console.log(timeid); setInterval(function () { // let nowTime = new Date(timeid) - new Date; // // console.log(nowTime); // let minutes = parseInt(nowTime / 1000 / 60 % 60, 10);//计算剩余的分钟 // // console.log(minutes); // let seconds = parseInt(nowTime / 1000 % 60, 10);//计算剩余的秒数 // minutes = checkTime(minutes); // seconds = checkTime(seconds); // let hours = parseInt(nowTime / ( 1000 * 60 * 60), 10); //计算剩余的小时 // hours = checkTime(hours); let nowTime = new Date(timeid) - new Date; let minutes = parseInt(nowTime / 1000 / 60 % 60, 10);//计算剩余的分钟 let seconds = parseInt(nowTime / 1000 % 60, 10);//计算剩余的秒数 minutes = checkTime(minutes); seconds = checkTime(seconds); let days = parseInt(nowTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数 let hours = parseInt(nowTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时 days = checkTime(days); hours = checkTime(hours); // document.getElementById('m_time').innerHTML=days + "天" + hours + "小时" + minutes + "分" + seconds + "秒"; // 判断当前时间 var Set_up = new Date(timeid); var current = new Date; if (Set_up > current) { that.find('.m_xgsj_time').html('' + days + '' + hours + '' + minutes + '' + seconds + ' 秒'); } else { that.find('.m_xgsj_time').html('00000000 秒'); } }, 1000); function checkTime(i) { //将0-9的数字前面加上0,例1变为01 if (i < 10) { i = "0" + i; } return i; } }) }, error: function (xhr, type) { // alert('Ajax error!'); // 即使加载出错,也得重置 me.resetload(); } }); } }); }