优化解析记录分页

This commit is contained in:
net909 2024-05-22 11:17:34 +08:00
parent b252816711
commit c1edf905f3
2 changed files with 36 additions and 2 deletions

View File

@ -191,14 +191,14 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:360px;
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/bootstrapValidator.min.js"></script>
<script src="/static/js/custom.js"></script>
<script src="/static/js/custom.js?v=1001"></script>
<script>
var recordLine = {$recordLine|json_encode|raw};
var dnsconfig = {$dnsconfig|json_encode|raw};
var defaultLine = recordLine[0].id;
$(document).ready(function(){
updateToolbar();
const defaultPageSize = 15;
let defaultPageSize = getCookie('record_pagesize') ? getCookie('record_pagesize') : 15;
const pageNumber = typeof window.$_GET['pageNumber'] != 'undefined' ? parseInt(window.$_GET['pageNumber']) : 1;
const pageSize = typeof window.$_GET['pageSize'] != 'undefined' ? parseInt(window.$_GET['pageSize']) : defaultPageSize;
@ -290,6 +290,12 @@ $(document).ready(function(){
}
},
],
onPageChange: function(number, size){
if(size != defaultPageSize){
defaultPageSize = size;
setCookie('record_pagesize', size);
}
},
});
$("select[name=type]").change(function(){

View File

@ -130,4 +130,32 @@ var isMobile = function(){
return true;
}
return false;
}
function setCookie(name,value,expire = null)
{
var cookie = name + "=" + escape(value);
if(expire){
var exp = new Date();
exp.setTime(exp.getTime() + expire*1000);
cookie += ";expires=" + exp.toGMTString();
}
document.cookie = cookie;
}
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
function delCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null){
document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
}