$(function() { var typeid = getparam("id"); var listname = getparam("listname"); var 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; for (var i = 0; i < data.length; i++) { // 往轮播容器添加轮播图 $(".slider").append("
  • "); // 轮播控制 //$(".control-item").append("
  • i
  • "); } // 轮播控制 //$(".control-item li:first-child").addclass("on"); $(".banner").slide({ titcell:".control-item li", maincell:".slider", effect:"left",vis:1,scroll:1,delaytime:800,trigger:"click",easing:"easeoutcirc",autoplay:false}); } } }); $(".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 = 9; //活动 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 totalpage = parseint(res.msg); totalpage = parseint(totalpage / pagesize )+ (totalpage % pagesize > 0 ? 1 : 0); var pagestr = "" for(var p = 0; p < totalpage; p++) { pagestr += "
  • "+(p+1)+"
  • "; } $(".page-control ul").html(pagestr); $(".page-control ul li:nth-child("+page+")").addclass("active").siblings().removeclass("active"); $(".page-control ul li").on('click', function() { var page = $(this).text(); loadlist(page, 9); }) //列表数据 var data = res.data; var str = ""; for (var i = 0; i < data.length; i++) { var imgsrc = data[i].image === "" ? "../images/placeholder.jpg" : data[i].image; str += "
  • "+ //""+ ""+ "
    "+ "荣誉证书" + "
    "+ "

    "+data[i].title+"

    "+ "
    "+ "
  • "; } $(".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"); } }); });