$(function() { var dataLength; var EndTime = new Date().getTime(); var StartTime = EndTime - 31536000000; var NoticeType = '招标公告'; var dataUrl = '/nx/n/list/notice'; AjaxFan(1); function AjaxFan(pagenum) { $.ajax({ url: getServerHttp() + dataUrl, type: 'post', cache: false, dataType: 'json', data: { p: pagenum, notice_type: NoticeType, start_time: StartTime, end_time: EndTime }, success: function(data) { var data = ajaxDataParames(data); var doms = ""; // dataLength = data.count; dataLength = data.pagePackage.page.totalRow; $('.result-content-title-right span i').html(dataLength); if (NoticeType == "招标公告") { var type = 1 } else { var type = 2 } var list = data.pagePackage.data; for (var i = 0; i < list.length; i++) { var iDom = ""; var applyTime = list[i].apply_date_end; var noticeTime = list[i].notice_end_time; var nowDate = new Date(); if (applyTime > noticeTime || applyTime === noticeTime) { var endDate = new Date(applyTime); } else if (applyTime < noticeTime) { var endDate = new Date(noticeTime); } var overDate = endDate - nowDate; var timeDay = Math.floor(overDate / 86400000); var timeHour = Math.floor((overDate % 86400000) / 3600000); var timeHtml = '剩余' + timeDay + '' + timeHour + '小时'; var iconStyle = list[i].notice_nature; if (iconStyle === "正常公告" || iconStyle === "再次公告") { iDom = ''; } else if (iconStyle === "变更公告") { iDom = '变更'; } else if (iconStyle === "延期公告") { iDom = '延期'; } else if (iconStyle === "补充公告") { iDom = '补充'; } else if (iconStyle === "控制价") { iDom = '控价'; } else if (iconStyle === "撤销公告") { iDom = '撤销'; } if (timeDay < 0 || iconStyle === "控制价" || iconStyle === "变更公告" || iconStyle === "延期公告" || iconStyle === "补充公告" || iconStyle === "撤销公告") { timeHtml = ''; } // 判断用户现在使用的设备 if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) { var porjectUrl = '../page_detailed/list_Phone.html?kid=' + list[i].kid + '&type=' + type; } else { var porjectUrl = '../page_detailed/list.html?kid=' + list[i].kid + '&type=' + type; } doms += '
  • ' + iDom + '' + list[i].project_name + '' + list[i].notice_release_time + '' + list[i].org_name + '' + list[i].region_name + '' + timeHtml + '
  • '; } $('.result-content-line ul').html(doms); layui.laypage.render({ elem: 'paging', count: dataLength, limit: 20, first: '首页', last: '尾页', curr: pagenum, groups: 5, jump: function(obj, first) { if (!first) { AjaxFan(obj.curr); } } }); } }) } //条件筛选 $.fn.extend({ Screen: function() { $(this).on('click', function() { if (!$(this).find('a').hasClass('all-btn')) { $(this).find('a').addClass('all-btn'); $(this).siblings().find('a').removeClass('all-btn'); } else { return } if ($(this).find('a').hasClass('notices')) { NoticeType = $(this).find('a').html(); } else if ($(this).find('a').hasClass('releasetime')) { var ReleaseTime = $(this).find('a').attr('id'); if (ReleaseTime == 'year') { StartTime = EndTime - 31536000000; } else if (ReleaseTime == 'month') { StartTime = EndTime - 2592000000; } else if (ReleaseTime == 'week') { StartTime = EndTime - 604800000; } else if (ReleaseTime == 'day') { StartTime = EndTime - 259200000; } } AjaxFan(1); }) } }); (function() { $('.screen-content-box div ul li').Screen(); }()) })