$(function() { var typeid = getparam("id"); var listname = getparam("listname"); var str = ""; if (listname === "information") { // 公司资讯 str = "
  • 公司活动
  • 公司新闻
  • 公司公告
  • " }else if (listname === "product") { //服务产品 str = "
  • 公司产品
  • 公司服务
  • "; }else if (listname === "investment") { //投资者招聘 str = "
  • 投资者关系
  • "; }else if (listname === "recruitment") { //人才招聘 str = "
  • 人才需求
  • 联系方式
  • "; }else if (listname === "family") { //党员之家 str = "
  • 员工风采
  • 党员之家
  • "; } $(".list ul").append(str); $("."+ listname).addclass("active").siblings().removeclass("active"); //侧边栏选项卡 var lists = $(".list ul li"); selectitem(lists, typeid); //首页轮播图 $.ajax({ url:"/cms/reception/imagetextlist", datatype: "json", type:"post", data:{ typeid: "2", page: 1, pagesize:10 }, success: function(res) { if (res.status === 0) { if (res.data.length === 0) return; var data = res.data; var controll = ""; var sliderstr = ""; for (var i = 0; i < data.length; i++) { controll += "
  • "; sliderstr += "
  • "; } // 往轮播容器添加轮播图 $("#slider .slides").html(sliderstr); // 轮播控制 //$("#slider .pagination").html(controll); // 轮播控制 $(".pagination li:first-child").addclass("active"); $("#slider").easyslider( { slidespeed: 500, paginationspacing: "20px", paginationdiameter: "12px", paginationpositionfrombottom: "20px", slidesclass: ".slides", controlsclass: ".controls", paginationclass: ".pagination" }); } } }); $(".company-activity p:nth-child(1)").html($(".nav li.active > a").text()); $(".company-activity p:nth-child(2)").html(listname); $(".present").text($(".nav li.active > a").text()+">"); $(".high-tit").text($(".list ul li.active a").text()); var page = 1; var pagesize = 15; $(".page-control p a").on("click", function(event) { var linktype = $(this).attr("class"); var currentpage = parseint($(".currentpage").text()); var total = parseint($(".total").text()); switch (linktype) { case 'currentpage': loadlist(currentpage, pagesize); break; case 'total': loadlist(total, pagesize); break; case 'prev': if (currentpage > 1) { currentpage -= 1; loadlist(currentpage, pagesize); } break; case 'next': if (currentpage < total) { currentpage += 1; loadlist(currentpage, pagesize); } break; case 'last': loadlist(total, pagesize); break; case 'first': loadlist(1, pagesize); } }); //活动 loadlist(page, pagesize) function loadlist(page, pagesize) { $.ajax({ url:"/cms/reception/imagetextlist", datatype: "json", type:"post", data:{ typeid: typeid, page: page, pagesize:pagesize }, success: function(res) { if (res.status === 0) { if (res.data.length === 0 || res.data === []) return console.log("暂时没有数据!"); //分页功能 var total = parseint(res.msg); total = parseint(total / pagesize )+ (total % pagesize > 0 ? 1 : 0); $(".total").text(total); $(".currentpage").text(page); if(page > 1) { $('.first').css("display","inline-block"); }else { $('.first').css("display","none"); } //列表数据 var data = res.data; var str = ""; var attachment = ""; for (var i = 0; i < data.length; i++) { var target = ""; var url = ""; if(typeof data[i].attachment === "string" && data[i].attachment !== "") { target = "_blank"; url = window.location.protocol + "//" + window.location.host + data[i].attachment; }else { target = "_self"; url = "./listdetail.html?id=" + data[i].id + "&listname=" + listname + "&tagid=" + typeid; } str += "
  • "+ ""+ "
    "+data[i].title+"
    "+ ""+data[i].createtime+""+ "
    "+ "
  • "; } $(".list-content").html(str); } } }); } //联系我们 $.ajax({ url:"/cms/reception/contactus", datatype: "json", type:"post", success: function(res) { if (res.status === 0) { $(".info").append(res.data.content); } } }); $('#search').bind('keypress', function (event) { if (event.keycode == "13") { //关键字 $.ajax({ url:"/cms/reception/keywordsearch", datatype: "json", type:"post", data:{ keyword:$(this).val(), page: 1, pagesize:10 }, success: function(res) { console.log(res); if (res.status === 0) { $(".search-down-menu").css("display", "block"); $(".search-down-menu").children("div").remove(); if (res.data.length === 0) { $(".search-down-menu").append(""); } var data = res.data; var str = ""; for(var i = 0; i< data.length; i++) { str += "
  • "+ ""+ data[i].title+ ""+ "
  • "; } $(".search-down-menu ul").html(str); $(document).on("click", function() { $(".search-down-menu").css("display", "none"); }) } } }); } }); $('#search').bind("input propertychange", function() { if($(this).val() === "") { $(".search-down-menu").css("display", "none"); } }); });