2021-03-03 06:38:15 +00:00

56 lines
1.3 KiB
HTML

{% extends 'layouts/master.html' %}
{% block title %}View{% endblock %}
{% block body %}
<h1>登录次数统计</h1>
<p>请选择日期(默认为当日)</p>
<input id='inputDate' type="date" value=""/>
<table class="table table-hover">
<thead>
<tr>
<th scope="col">账号</th>
<th scope="col">登录次数</th>
</tr>
</thead>
<tbody>
{% for contact in contacts %}
<tr>
<td>{{ contact['account'] }}</td>
<td>{{ contact['count'] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<script type='text/javascript'>
window.onload=function(){
var inputDate = document.getElementById("inputDate");
inputDate.onchange = function(){
var selectedDate = inputDate.value;
setCookie('selectedDate', selectedDate, 1);
location.reload();
};
inputDate.value = getCookie('selectedDate');
}
function setCookie(cname,cvalue,exdays)
{
var d = new Date();
d.setTime(d.getTime()+(exdays*24*60*60*1000));
var expires = "expires="+d.toGMTString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function getCookie(cname)
{
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++)
{
var c = ca[i].trim();
if (c.indexOf(name)==0) return c.substring(name.length,c.length);
}
return "";
}
</script>
{% endblock %}