$(function() { var typeid = getparam("id"); var listname = getparam("listname"); var tagid = getparam("tagid"); tagid = tagid == null ? "23" : tagid var str = ""; if (listname === "family") { $(".tab-tie").text("员工风采"); str = "
  • 英伦之家
  • 员工风采
  • 党员之家
  • "; } $(".list ul").append(str); $("."+ listname).addclass("active").siblings().removeclass("active"); var lists = $(".list ul li"); selectitem(lists, tagid); //首页轮播图 $.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)").text($(".nav li.active > a").text()); $(".company-activity p:nth-child(2)").text(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) return; var data = res.data; var str = ""; //分页功能 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"); } for (var i = 0; i < data.length; i++) { var imgsrc = ""; if (data[i].image === "") { imgsrc = "../images/placeholder.jpg"; }else { imgsrc = data[i].image; } 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"; console.log(typeid) url = typeid === "7" ? "./family.html?id=" + data[i].id+"&listname=family" + "&tagid=" + typeid : "./listdetail.html?id=" + data[i].id+"&listname=family" + "&tagid=" + typeid; } console.log( url); if(typeid === "7"){ str += "
  • " + ""+ ""+ ""+ "
    "+ "
    "+data[i].title+"
    "+ ""+data[i].createtime+""+ "
    "+ "
    "+"

    "+data[i].abstract+"

    "+"
    "+ "
    "+ "
  • "; }else{ str += "
  • " + ""+ ""+ ""+ "
    "+ "
    "+data[i].title+"
    "+ ""+data[i].createtime+""+ "
    "+ "
    "+"

    "+data[i].artabstract+"

    "+"
    "+ "
    "+ "
  • "; } } $(".list-content").html(str); $(".list-content li").on('click', function(event) { var listid = $(this).children("input").val(); if (listid !== "" && listid != null) { } }) } } }); } //联系我们 $.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"); } }); });