import 'css/bootstrap.less'; import 'bootstrap/dist/js/bootstrap.js'; import 'css/newMenu/public.css'; import 'css/newMenu/header.css' import 'css/facilitator/facilitator.css'; import 'js/public.js'; $(function(){ function GetQueryString(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if(r!=null)return unescape(r[2]); return null; } var UID=GetQueryString("uid"); var pageSize = 15, thePageNo = 1, thePageLength = 1; init(); function init() { pages(); inpFun(); loadDate(); $('.onSelect .preFirst').css('display', 'none') $('.onSelect .next').css('display', 'none') }; if(window.location.hash&&window.location.hash.indexOf('2')>-1){ let hash = window.location.hash, ind = [...hash][1]; $('.facJuan>div').eq(ind).show().siblings().hide(); $('.facTab span').eq(ind).addClass("facActive").siblings().removeClass('facActive'); loadJuan(); }else{ $('.facJuan>div').eq(0).show().siblings().hide(); $('.facTab span').eq(0).addClass("facActive").siblings().removeClass('facActive'); } $(".facTab>span").click(function(){ $(this).addClass("facActive").siblings().removeClass('facActive'); var facIndex=$(this).index(); $('.facJuan>div').eq(facIndex).show().siblings().hide(); if(facIndex==2){ loadJuan() } }) //领劵 function liJ(){ $('.listJ ul li a').click(function(){ let loginTxt=$('.head_login')[0]; if(loginTxt&&($(loginTxt).text())=='登录'){ $('.head_login').click(); window.location.hash='jump'; return false; } let ids = $(this).siblings('input').val(); $.ajax({ method: "post", dataType: "json", url: globalConfig.context + "/open/userGetVoucher", data: { vid:ids }, success: function (data) { if (data.error && data.error.length) { msg(data.error[0].message); return; } msg('领取成功,请至个人中心查看。') loadJuan() } }) }) } //获取卷 function loadJuan(){ $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/open/getUserVoucher", data: { pageNo: 1, pageSize: 999999, uid:UID }, success: function (data) { if (data.error && data.error.length) { msg(data.error[0].message); return ; } let htmls = ''; if(!data.data.list.length){ htmls="
暂无优惠劵
"; $('.listJ ul').html(htmls); return; } data.data.list.map(item=>{ htmls+=`
  • ${item.money}

    ${!item.isGet?'立即领取':'已领取'}

    限定:${item.name}

    有效天数:${item.durationDay} 天

  • ` }) $('.listJ ul').html(htmls); liJ(); } }) }; function loadDate(pageNo) { $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/open/user/projectList", data: { pageNo: pageNo || 1, pageSize: 15, uid:UID }, success: function (data) { if (data.error && data.error.length) { msg(data.error[0].message); }else if(data.error==""){ var contHtml=""; var dataList=data.data.list; if(dataList.length){ for(var a=0;a

    ${name}

    `; } } $(".facAll").html(contHtml); }else{ return; } //分页部分的处理 $('.pagination_box').css('display', 'block'); $('.inp').css('display', 'block'); if (data.data.list&&data.data.list.length === 0) { $('.achievementHot .hotList').html("
    "); $('.pagination_box').css('display', 'none') $('.inp').css('display', 'none'); }; thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1; $('.totalCount').html(`共${data.data.totalCount}条数据 ${thePageLength}页`) var pageArr = [], firstNo = 1, endNo = 5; if (thePageNo > 3) { firstNo = thePageNo - 2; endNo = Math.min((Number(thePageNo) + 2), thePageLength); } else { endNo = Math.min(thePageLength, 5); }; for (let i = firstNo; i <= endNo; i++) { if (i == thePageNo) { pageArr.push( '
  • ' + i + '
  • ' ); } else { pageArr.push( '
  • ' + i + '
  • ' ); } }; $('.pageNumber').remove(); $('.pagePre').after(pageArr.join('')); } }); } //f分页 function pages() { $('.pagination').on('click', 'li', function (e) { e.preventDefault(); if (this.className === 'pagePre') { if (thePageNo > 1) { thePageNo = 1; loadDate(thePageNo); } } else if (this.className === 'pageNext') { if (thePageNo < thePageLength) { thePageNo = thePageLength; loadDate(thePageNo); } } else { var nextPageNo = $(this).children()[0].text; if (thePageNo != nextPageNo) { $(this).siblings("li").removeClass("active"); $(this).addClass("active"); thePageNo = nextPageNo; loadDate(thePageNo); }; }; }); } //输入跳转 function inpFun() { $('.inp .btn').on('click', function () { let val = $(this).siblings().val(); if (!isNaN(val) && val <= thePageLength && val > 0&&val%1=='0') { thePageNo = val; loadDate(thePageNo); }else{ msg('请输入正确页码') } }) } /* 提示 */ //提示框渐隐函数 function msg(txt) { if($('.smg').hasClass('active')){ return ; } $('.smg').addClass('active'); var lit = $('#msg').val(txt); setTimeout(function () { $('.smg').removeClass('active'); $('#msg').val(''); }, 2000) } $(".facAll").on("click","div",function(){ var id=$(this).children("input").attr("dates"); var module=$(this).children("input").attr("datee"); if(module==1){ window.open(globalConfig.context+"/portal/service/patentDetail?id="+id); }else{ window.open(globalConfig.context+"/portal/service/serviceDetail?id="+id); } }) })