123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- $(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 = '<span class="countdowns">剩余<i class="day">' + timeDay + '</i>天<i class="hour">' + timeHour +
- '</i>小时</span>';
- var iconStyle = list[i].notice_nature;
- if (iconStyle === "正常公告" || iconStyle === "再次公告") {
- iDom = '<i class="icons greens">新</i>';
- } else if (iconStyle === "变更公告") {
- iDom = '<i class="icons blues">变更</i>';
- } else if (iconStyle === "延期公告") {
- iDom = '<i class="icons blues">延期</i>';
- } else if (iconStyle === "补充公告") {
- iDom = '<i class="icons blues">补充</i>';
- } else if (iconStyle === "控制价") {
- iDom = '<i class="icons blues">控价</i>';
- } else if (iconStyle === "撤销公告") {
- iDom = '<i class="icons reds">撤销</i>';
- }
- if (timeDay < 0 || iconStyle === "控制价" || iconStyle === "变更公告" || iconStyle === "延期公告" || iconStyle ===
- "补充公告" || iconStyle === "撤销公告") {
- timeHtml = '<span class="countdowns">无</span>';
- }
- // 判断用户现在使用的设备
- 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 += '<li>' + iDom + '<a href="' + porjectUrl + '" class="names" target="_blank" title="' + list[i].project_name +
- '">' + list[i].project_name + '</a><span class="times">' + list[i].notice_release_time +
- '</span><a href="javascript:void(0)" class="sources" title="' + list[i].org_name + '">' + list[i].org_name +
- '</a><span class="areas">' + list[i].region_name + '</span>' + timeHtml + '</li>';
- }
- $('.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();
- }())
- })
|