This commit is contained in:
杜恒
2021-05-21 17:27:27 +08:00
parent 5a56bfdc52
commit 71834710c8
11 changed files with 243 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@@ -89,6 +89,7 @@
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 15px;
margin-bottom: 15px;
&-item {
background: var(--background);
box-shadow: var(--box-shadow);
@@ -119,4 +120,129 @@
}
}
}
&__filing {
background: var(--background);
box-shadow: var(--box-shadow);
border-radius: var(--radius-wrap);
.title {
display: flex;
align-items: center;
height: 45px;
padding: 0 12px;
border-bottom: 1px solid var(--classC);
color: var(--main);
justify-content: space-between;
user-select: none;
}
.content {
padding: 15px;
.item {
position: relative;
&:last-child {
.wrapper {
padding-bottom: 0;
}
}
.head {
position: absolute;
top: 14px;
width: 13px;
height: 13px;
background: var(--classC);
border-radius: 50%;
}
.tail {
position: absolute;
left: 6px;
top: 0;
width: 1px;
height: 100%;
background: var(--classC);
}
.wrapper {
padding-left: 30px;
padding-bottom: 15px;
.panel {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
color: var(--routine);
cursor: pointer;
background: var(--classD);
padding: 10px;
height: 40px;
border-radius: 4px;
svg {
width: 10px;
height: 10px;
fill: var(--minor);
transform: rotate(180deg);
transition: transform 0.25s;
}
&.in {
svg {
transform: rotate(90deg);
}
}
&::before {
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
left: -8px;
width: 0;
height: 0;
border-right: 8px solid var(--classD);
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
}
}
.panel-body {
display: none;
padding-left: 20px;
li {
margin-top: 20px;
a {
color: var(--routine);
&:hover {
color: var(--theme);
}
}
}
}
}
&.load {
padding-top: 15px;
.head {
top: 25px;
background: #2db7f5;
}
.button {
position: relative;
margin-left: 30px;
border: none;
background: #2db7f5;
color: #fff;
border-radius: 4px;
padding: 0 12px;
height: 34px;
font-size: 13px;
&::before {
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
left: -8px;
width: 0;
height: 0;
border-right: 8px solid #2db7f5;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
}
}
}
}
}
}
}

View File

@@ -2,22 +2,20 @@ document.addEventListener('DOMContentLoaded', () => {
{
/* 转换字节 */
const bytesToSize = bytes => {
if (!bytes) return '0 B';
const k = 1024,
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
};
const categories = [];
const upSeries = [];
const downSeries = [];
const flowDom = document.querySelector('#flow');
const workDom = document.querySelector('#work');
const flowChart = flowDom && echarts.init(flowDom);
const workChart = workDom && echarts.init(workDom);
if (flowDom && workDom) initChart();
function initChart() {
$.ajax({
url: Joe.BASE_API,
@@ -27,6 +25,7 @@ document.addEventListener('DOMContentLoaded', () => {
routeType: 'server_status'
},
success(res) {
if (!res.status) Qmsg.warning('服务器接口异常!');
{
$('.joe_census__server-item .count .up').html(`总发送:${bytesToSize(res.upTotal)}`);
$('.joe_census__server-item .count .down').html(`总接收:${bytesToSize(res.downTotal)}`);
@@ -48,7 +47,7 @@ document.addEventListener('DOMContentLoaded', () => {
grid: {
left: '3%',
right: '4%',
bottom: '0',
bottom: '3%',
containLabel: true
},
tooltip: {
@@ -250,6 +249,9 @@ document.addEventListener('DOMContentLoaded', () => {
},
success(res) {
latelyChart.setOption({
title: {
subtext: '单位 数量'
},
tooltip: {
trigger: 'axis',
axisPointer: {
@@ -294,4 +296,55 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
}
/* 初始化归档 */
{
let page = 0;
initFiling();
function initFiling() {
if ($('.joe_census__filing .button').html() === 'loading...') return;
$.ajax({
url: Joe.BASE_API,
type: 'POST',
dataType: 'json',
data: {
routeType: 'article_filing',
page: ++page
},
success(res) {
if (!res.length) {
$('.joe_census__filing .item.load').remove();
return Qmsg.warning('没有更多内容了');
}
let htmlStr = '';
res.forEach(item => {
htmlStr += `
<div class="item">
<div class="tail"></div>
<div class="head"></div>
<div class="wrapper">
<div class="panel">${item.date}<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M21.6 772.8c28.8 28.8 74.4 28.8 103.2 0L512 385.6l387.2 387.2c28.8 28.8 74.4 28.8 103.2 0 28.8-28.8 28.8-74.4 0-103.2L615.2 282.4l-77.6-77.6c-14.4-14.4-37.6-14.4-51.2 0l-77.6 77.6L21.6 669.6c-28.8 28.8-28.8 75.2 0 103.2z" /></svg></div>
<ol class="panel-body">
${item.list.map(_ => `<li><a rel="noopener noreferrer" target="_blank" href="${_.permalink}">${_.title}</a></li>`).join('')}
</ol>
</div>
</div>
`;
});
$('#filing').append(htmlStr);
$('.joe_census__filing .button').html('加载更多');
}
});
}
$('.joe_census__filing .content').on('click', '.panel', function () {
const panelBox = $(this).parents('.content');
panelBox.find('.panel').not($(this)).removeClass('in');
panelBox.find('.panel-body').not($(this).siblings('.panel-body')).stop().hide('fast');
$(this).toggleClass('in').siblings('.panel-body').stop().toggle('fast');
});
$('.joe_census__filing .button').on('click', function () {
initFiling();
$(this).html('loading...');
});
}
});

File diff suppressed because one or more lines are too long