Merge pull request #798 from midoks/dev

站点搜索,排序优化
pull/799/head
Mr Chen 4 weeks ago committed by GitHub
commit f8c2580773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      scripts/install.sh
  2. 9
      web/static/app/public.js
  3. 35
      web/templates/default/site.html
  4. 7
      web/thisdb/sites.py

@ -43,6 +43,9 @@ if [ "$LOCAL_ADDR" != "common" ];then
PROXY_URL["gh_felicity_ac_cn"]="https://gh.felicity.ac.cn/https://"
PROXY_URL["ghfast_top"]="https://ghfast.top/"
PROXY_URL["ghproxy_net"]="https://ghproxy.net/"
PROXY_URL["gh_927223_xyz"]="https://gh.927223.xyz/https://"
PROXY_URL["gh_proxy_net"]="https://gh-proxy.net/"
PROXY_URL["source"]="https://"

@ -1120,15 +1120,20 @@ function listOrder(skey,type,obj){
if(or){
if(or.split(' ')[1] == 'desc'){
orderType = 'asc';
} else if(or.split(' ')[1] == 'asc'){
orderType = 'none';
}
}
setCookie('order',skey + ' ' + orderType);
getWeb(1);
$(obj).find(".glyphicon-triangle-bottom").remove();
$(obj).find(".glyphicon-triangle-top").remove();
if(orderType == 'asc'){
$(obj).find(".glyphicon-stop").remove();
if(orderType == 'none'){
$(obj).append("<span class='glyphicon glyphicon glyphicon-stop' style='margin-left:5px;color:#bbb'></span>");
} else if(orderType == 'asc') {
$(obj).append("<span class='glyphicon glyphicon-triangle-bottom' style='margin-left:5px;color:#bbb'></span>");
}else{
} else {
$(obj).append("<span class='glyphicon glyphicon-triangle-top' style='margin-left:5px;color:#bbb'></span>");
}
}

@ -33,15 +33,15 @@
<div class="divtable mtb10">
<div class="tablescroll">
<table class="table table-hover" style="min-width: 900px;border: 0 none;">
<thead>
<thead id="webBodyHeader">
<tr>
<th width="30"><input type="checkbox" onclick="checkSelect();" id="setBox"></th>
<th width="150" onclick="listOrder('name','site',this)" style="cursor: pointer;">域名<span class="glyphicon glyphicon-triangle-top" style="margin-left:5px;color:#bbb"></span></th>
<th width="150" onclick="listOrder('name','site',this)" style="cursor: pointer;">域名<span class="glyphicon glyphicon-stop" style="margin-left:5px;color:#bbb"></span></th>
<th style="cursor: pointer;" width="98">网站状态</th>
<th width="58">备份</th>
<th width="26%">网站目录</th>
<th onclick="listOrder('edate','site',this)" style="cursor: pointer;" width="86">
到期日期<span class="glyphicon glyphicon-triangle-top" style="margin-left:5px;color:#bbb"></span>
到期日期<span class="glyphicon glyphicon-stop" style="margin-left:5px;color:#bbb"></span>
</th>
<th>备注</th>
<th width='130' class='text-right'>操作</th>
@ -75,5 +75,34 @@
setTimeout(function(){
getWeb(1);
},500);
function initPage(){
var order = getCookie('order');
if (order != ''){
var sort = order.split(' ');
if (sort[0] == 'name'){
if (sort[1] == 'desc'){
$($('#webBodyHeader .glyphicon-stop')[0]).removeClass('glyphicon-stop').addClass('glyphicon-triangle-top');
} else if (sort[1] == 'asc'){
$($('#webBodyHeader .glyphicon-stop')[0]).removeClass('glyphicon-stop').addClass('glyphicon-triangle-bottom');
}
}
if (sort[0] == 'edate'){
if (sort[1] == 'desc'){
$($('#webBodyHeader .glyphicon-stop')[1]).removeClass('glyphicon-stop').addClass('glyphicon-triangle-top');
} else if (sort[1] == 'asc'){
$($('#webBodyHeader .glyphicon-stop')[1]).removeClass('glyphicon-stop').addClass('glyphicon-triangle-bottom');
}
}
}
}
initPage();
</script>
{% endblock %}

@ -85,23 +85,24 @@ def getSitesList(
if type_id != '' and int(type_id) >= 0:
sql_where = " type_id=" + str(type_id)
dbM = dbC = mw.M('sites').field(__FIELD)
if sql_where != '':
count = dbC.where(sql_where).count()
dbM.where(sql_where)
else:
count = dbC.count()
start = (int(page) - 1) * (int(size))
limit = str(start) + ',' +str(size)
if order is not None:
if order.find("none") > -1:
site_list = dbM.limit(limit).order('').select()
elif order is not None:
site_list = dbM.limit(limit).order(order).select()
else:
site_list = dbM.limit(limit).order('id desc').select()
data = {}
data['list'] = site_list
data['count'] = count

Loading…
Cancel
Save