You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
4.2 KiB
113 lines
4.2 KiB
{layout name="layout" /}
|
|
<style>
|
|
#propage{padding: 15px 20px;text-align: left;color: #ccc;text-align:center;}
|
|
#propage a{display: inline-block;color:#666;display: inline-block;line-height:1.4em;padding:6px 12px;border: 1px solid #ddd; margin: 0 2px;border-radius: 4px;vertical-align: middle;}
|
|
#propage a:hover{text-decoration: none;border: 1px solid #d43f3a;}
|
|
#propage span.current{display: inline-block;line-height:1.4em;padding:6px 12px;margin: 0 2px;color: #fff;background-color:#d43f3a; border: 1px solid #d43f3a;border-radius: 4px;vertical-align: middle;}
|
|
#propage span.disabled{ display: inline-block;line-height:1.4em;padding:6px 12px;margin: 0 2px; color: #bfbfbf;background: #f2f2f2;border: 1px solid #bfbfbf;border-radius: 4px;vertical-align: middle;}
|
|
</style>
|
|
<div class="projectWraper">
|
|
<div class="project-wrapper">
|
|
<div class="content">
|
|
<div class="policy clearfix">
|
|
|
|
</div>
|
|
<div class="col-xs-12 text-center list-page" align="center">
|
|
<ul id="propage" class="pagination">
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript" src="{$yf_theme_path}public/js/jquery.page.js"></script>
|
|
<script>
|
|
//项目分类
|
|
$(function(){
|
|
|
|
var prolist=[];
|
|
$("body").on('click','.policy-item',function(){
|
|
event.preventDefault();
|
|
var id=$(this).data('id');
|
|
var jump="__URL__/policydetail/id/"+id+".html";
|
|
window.location.href=jump;
|
|
});
|
|
layer.load(1, {shade: [0.1,'#fff']});
|
|
function projects(list){
|
|
var html='';
|
|
prolist=list;
|
|
console.log(list);
|
|
list.forEach(function(item){
|
|
var jump="javascript:void(0);";
|
|
html+='<div class="policy-item clearfix" data-id='+item['id']+'>';
|
|
html+='<div class="title">◆ '+item['name']+'</div>';
|
|
html+='<div class="date">'+item['created_at']+'</div>';
|
|
html+='</div>';
|
|
|
|
});
|
|
return html;
|
|
}
|
|
function propage(meta){
|
|
var per_page=meta['per_page'];
|
|
var total=parseInt(meta['total']);
|
|
var current_page=parseInt(meta['current_page']);
|
|
var pages=Math.ceil(total/per_page);
|
|
console.log(pages);
|
|
|
|
var total=parseInt(meta['total']);
|
|
var lastpage=parseInt(meta['last_page']);
|
|
$("#propage").remove();
|
|
$(".list-page").append('<ul id="propage" class="pagination"></ul>');
|
|
$("#propage").createPage({
|
|
pageCount:lastpage,
|
|
current:current_page,
|
|
backFn:function(p){
|
|
fillProject(p,0);
|
|
}
|
|
});
|
|
}
|
|
function fillProject(curpage,showpage){
|
|
layer.load(1, {shade: [0.1,'#fff']});
|
|
var query="page="+curpage;
|
|
var url="{:url('ajaxpolicys')}?"+query;
|
|
$(this).attr('disabled',true);
|
|
console.log(url);
|
|
$.get(url,function(data){
|
|
$(this).attr('disabled',false);
|
|
data=JSON.parse(data);
|
|
console.log(data);
|
|
layer.closeAll();
|
|
if(typeof data =='object'&&typeof data['data']!='undefined'){
|
|
var meta=data['meta'];
|
|
var list=data['data'];
|
|
if(showpage){
|
|
$("#propage").html("");
|
|
propage(meta);
|
|
}
|
|
var html=projects(list);
|
|
$(".policy").html(html);
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
var curpage=1;
|
|
//项目列表
|
|
var url="{:url('ajaxpolicys')}";
|
|
$.get(url,function(data){
|
|
data=JSON.parse(data);
|
|
console.log(data);
|
|
layer.closeAll();
|
|
if(typeof data =='object'&&typeof data['data']!='undefined'){
|
|
|
|
var meta=data['meta'];
|
|
var list=data['data'];
|
|
var html=projects(list);
|
|
$(".policy").html(html);
|
|
|
|
var html=propage(meta);
|
|
$(".projectWraper").show();
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|